Skip to content

Commit

Permalink
socat with minicom
Browse files Browse the repository at this point in the history
  • Loading branch information
huataihuang committed Sep 22, 2024
1 parent f7f19a3 commit 90c4e86
Show file tree
Hide file tree
Showing 23 changed files with 170 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/android/hack/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Android Hack
project_soli.rst
pixel_usb_devices.rst
pixel_uart.rst
pixel_minicom.rst

.. only:: subproject and html

Expand Down
42 changes: 42 additions & 0 deletions source/android/hack/pixel_minicom.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _pixel_minicom:

======================================
使用Pixel运行minicom(串口调试服务器)
======================================

:ref:`pixel_uart` 相反(方向),我想使用 :ref:`pixel_4` 作为一个 :ref:`mobile_pixel_dev` ,通过 :ref:`pi_5_uart` 访问树莓派终端。这样,在旅途中,即使没有显示器,我也能够连接和使用 :ref:`pi_5` 进行 :ref:`mobile_work` 。

硬件设备
===========

- 具有控制器的USB拨号modem(也就是 ``Raspberry Pi 5代 UART串口通信模块调试器`` ,我在淘宝上买的)
- OTG转接头(我在淘宝上买了一个绿联usb转type-c otg转接头)

软件
======

- 先安装 :ref:`termux`
- 在 ``termux`` 中安装 ``socat`` 和 ``minicom``

.. literalinclude:: pixel_minicom/socat_minicom
:caption::ref:`termux` 中安装 ``socat`` 和 ``minicom``

- 在Android系统的Play Store中安装一个名为 ``TCPUART`` 的应用程序

运行
========

- 打开 ``termux`` 程序,执行以下命令,在 ``/ataa/data/com.termux/files/home/minicom/`` 目录(目录提前创建好)下创建一个 ``ttyS0`` 设备,连接到TCP服务器(也就是Android系统中的 ``TCPUART`` 创建的TCP服务:

.. literalinclude:: pixel_minicom/socat_connect
:caption: 使用 ``socat`` 连接串口设备文件和TCP服务器

- 再在 ``termux`` 中执行 ``minicom`` :

.. literalinclude:: pixel_minicom/minicom
:caption: 使用 ``minicom`` 连接桥接的TTY设备

参考
=======

- `Minicom on apk <https://www.reddit.com/r/androidapps/comments/uksj8g/minicom_on_apk/>`_
1 change: 1 addition & 0 deletions source/android/hack/pixel_minicom/minicom
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
minicom -D /data/data/com.termux/files/home/minicom/ttyS0
1 change: 1 addition & 0 deletions source/android/hack/pixel_minicom/socat_connect
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
socat /data/data/com.termux/files/home/minicom/ttyS0,b115200,raw,echo=0 TCP:192.168.1.5:8080
1 change: 1 addition & 0 deletions source/android/hack/pixel_minicom/socat_minicom
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apt install socat minicom
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
.. _hostapd:
.. _hostap:

=================================
hostapd - Linux无线热点AP
HostAP - Linux无线热点AP
=================================

.. toctree::
:maxdepth: 1

intro_hostap.rst
create_ap.rst
create_ap_kali.rst
linux_router.rst
Expand Down
41 changes: 41 additions & 0 deletions source/linux/network/hostap/intro_hostap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. _intro_hostap:

========================
HostAP简介
========================

HostAP
===========

``HostAP`` 是Linux的IEEE 80.211 设备驱动,它适用于使用过时的Conexant(以前称为Intersil) Prism 2/2.5/3 芯片组的网卡,并支持Host AP模式,这样无线网卡就能作为无线AP来使用。HostAP驱动代码由Jouni Malinen编写,并在Linux 2.6.14时引入到内核主线。

.. warning::

根据 `HostAP维护者申明,2016年9月开始,内核HostAP 驱动已经被标记为过时 <https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ffd74aca44b70a2564da86e8878c1dd296009ffb>`_ ,后续 ``需要采用替代hostap的解决方案``

.. _hostapd:

hostapd
===========

``hostapd`` (host access point daemon) 即主机无线AP服务,是一个将主机网卡作为无线AP和认证服务器的用户空间daemon,一共有3个实现:

- `Jouni Malinen's hostapd <https://w1.fi/hostapd/>`_ 可参考内核无线文档 `hostapd Linux documentation page <https://wireless.wiki.kernel.org/en/users/documentation/hostapd>`_
- OpenBSD's hostapd
- Devicescape's hostapd

Jouni Malinen's Hostapd
--------------------------

**这应该是我们最常使用的Linux上HostAP管理工具**

无线软件堆栈指南
==================

`Infineon英飞凌公司 <https://www.infineon.com/>`_ (前身是西门子半导体,1999年独立。无线解决方案部于2010年8月出售给intel) 在开发社区知识库提供了一片非常详尽的 `HostApd setup in Linux <https://community.infineon.com/t5/Knowledge-Base-Articles/HostApd-setup-in-Linux/ta-p/246026#.>`_ ,这篇文档属于英飞凌公司提供的 `AN232689 - Wi-Fi software user guide <https://www.infineon.com/dgdl/Infineon-AN232689_-_Wi-Fi_software_user_guide-ApplicationNotes-v01_00-EN.pdf>`_ (非常专业和详尽的Linux无线软件堆栈指南) 的 4.2 章节。

参考
=========

- `Wikipedia: HostAP <https://en.wikipedia.org/wiki/HostAP>`_
- `Wikipedia: hostapd <https://en.wikipedia.org/wiki/Hostapd>`_
2 changes: 1 addition & 1 deletion source/linux/network/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Linux网络
iproute2/index
iptables/index
socat.rst
hostapd/index
hostap/index
dpdk/index
ethtool/index

Expand Down
11 changes: 8 additions & 3 deletions source/linux/network/socat.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
.. _socat:

=================
socat 多用途转发
=================
============
socat
============

``socat`` 是一个神奇的工具,我是在想要 :ref:`pixel_minicom` 来作为控制台访问 :ref:`pi_5_uart` (这样我可以不需要连接显示器就能够看到 :ref:`pi_5` 的终端进行交互) 发现这个工具的。

参考
=======

- `Serial to Ethernet or WiFi bridge with Linux socat <https://www.digi.com/support/knowledge-base/serial-to-ethernet-or-wifi-bridge-with-linux-socat>`_
- `TCP to virtual serial port with socat <https://superuser.com/questions/1764202/tcp-to-virtual-serial-port-with-socat>`_
- `Getting started with socat, a multipurpose relay tool for Linux <https://www.redhat.com/sysadmin/getting-started-socat>`_
- `socat: Linux / UNIX TCP Port Forwarder <https://www.cyberciti.biz/faq/linux-unix-tcp-port-forwarding/>`_
- `Getting started with socat, a multipurpose relay tool for Linux <https://www.redhat.com/sysadmin/getting-started-socat>`_
1 change: 1 addition & 0 deletions source/network/wifi/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Wi-Fi无线网络
:maxdepth: 1

wi-fi_direct.rst
wi-fi_software.rst

.. only:: subproject and html

Expand Down
5 changes: 5 additions & 0 deletions source/network/wifi/wi-fi_direct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Wi-Fi Direct无线直连通常用于文件传输,Miracast,无线打印以及

看起来 :ref:`wpa_supplicant` 在 ``P2P GO`` 网络上有独立实现,后续可以参考 `wpa_supplicant.conf 配置样例 <https://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf>`_ 研究

目标规划
===========

- :ref:`pi_wi-fi_direct`

参考
=======

Expand Down
9 changes: 9 additions & 0 deletions source/network/wifi/wi-fi_software.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _wi-fi_software:

====================
Wi-Fi无线网络软件
====================

英飞凌公司提供的 `AN232689 - Wi-Fi software user guide <https://www.infineon.com/dgdl/Infineon-AN232689_-_Wi-Fi_software_user_guide-ApplicationNotes-v01_00-EN.pdf>`_ (非常专业和详尽的Linux无线软件堆栈指南)

我后续会系统学习了解一下(挖坑)
1 change: 1 addition & 0 deletions source/raspberry_pi/network/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
raspbian_static_ip.rst
dhcpcd.rst
router/index
wifi/index

.. only:: subproject and html

Expand Down
18 changes: 18 additions & 0 deletions source/raspberry_pi/network/wifi/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _pi_wifi:

=================================
树莓派Wi-Fi无线
=================================

.. toctree::
:maxdepth: 1

pi_wi-fi_direct.rst
pi_wi-fi_ad_hoc.rst

.. only:: subproject and html

Indices
=======

* :ref:`genindex`
16 changes: 16 additions & 0 deletions source/raspberry_pi/network/wifi/pi_wi-fi_ad_hoc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _pi_wi-fi_ad_hoc:

===========================
树莓派构建无线ad hoc网络
===========================

参考
=======

- `Wikipedia: Wireless ad hoc network <https://en.wikipedia.org/wiki/Wireless_ad_hoc_network>`_
- `wireless ad hoc network (WANET) <https://www.techtarget.com/searchmobilecomputing/definition/ad-hoc-network>`_ (Wireless ad hoc network, Mobile ad hoc network, 缩写WANET, MANET) 最有名的MANET实现是苹果公司的"隔空投送" (AirDrop)

- `GitHub: seemoo-lab/opendrop <https://github.com/seemoo-lab/opendrop>`_ 实现了开源的Apple AirDrop ( `Open Wireless Link项目 <https://owlink.org/>`_ )

- `KDE Connect <https://kdeconnect.kde.org/>`_
- `GSConnect <https://extensions.gnome.org/extension/1319/gsconnect/>`_
21 changes: 21 additions & 0 deletions source/raspberry_pi/network/wifi/pi_wi-fi_direct.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. _pi_wi-fi_direct:

================================
树莓派Wi-Fi Direct无线直连(p2p)
================================

目标
========

- 实现树莓派和 :ref:`android` (有案例) :ref:`iphone` (有可能不行)手机连接,实现文件传输

.. note::

`树莓派论坛: We need a WiFi Direct guide <https://forums.raspberrypi.com/viewtopic.php?t=282553>`_ 的讨论提到建议采用 ad hoc 网络 ( `Wikipedia: Wireless ad hoc network <https://en.wikipedia.org/wiki/Wireless_ad_hoc_network>`_ 来取代Wi-Fi Direct

iOS已经支持 ad-hoc ,而 Android不支持(不知道现在如何?)

参考
======

- `Set up WiFi direct (p2p) between a dedicated pair of Raspberry Pi 3 B+ (one as the Group Owner, the other as the client) <https://raspberrypi.stackexchange.com/questions/114012/set-up-wifi-direct-p2p-between-a-dedicated-pair-of-raspberry-pi-3-b-one-as-t>`_ 其中介绍了 `德州仪器: WiLink8 Linux Advanced Demons <https://www.ti.com/lit/ug/swru576/swru576.pdf?ts=1726911018874#Connect_in_Pin_.28PIN_Number.29_where_EVM_.231_is_defined_as_the_group_owner>`_ 介绍了详细的P2P模式,可以作为技术参考

0 comments on commit 90c4e86

Please sign in to comment.