From f1d3cb0435ef8f7568e472973d930afa144105c6 Mon Sep 17 00:00:00 2001 From: Chen Jiali Date: Fri, 17 Jan 2025 11:33:58 +0800 Subject: [PATCH] refactor: radxa-os: change to use rsetup enable usbnet --- docs/common/config/_rsetup.mdx | 14 +++- docs/common/radxa-os/_usbnet.mdx | 71 +++++++------------ .../current/common/config/_rsetup.mdx | 14 +++- .../current/common/radxa-os/_usbnet.mdx | 63 +++++----------- 4 files changed, 69 insertions(+), 93 deletions(-) diff --git a/docs/common/config/_rsetup.mdx b/docs/common/config/_rsetup.mdx index b6926e541..796eaff48 100644 --- a/docs/common/config/_rsetup.mdx +++ b/docs/common/config/_rsetup.mdx @@ -104,7 +104,7 @@ import EnableUart2 from "./rsetup/_enable-uart2-m0.mdx"; │ GPIO LEDs │ │ Thermal governor │ │ Configure DSI display mirroring │ -│ │ +│ USB OTG services │ │ │ │ │ │ │ @@ -135,6 +135,18 @@ import EnableUart2 from "./rsetup/_enable-uart2-m0.mdx"; 在同时使用 HDMI 显示器和 DSI 显示器时,如果 DSI 显示器有一些问题,启用这个选项会有所帮助。 +### USB OTG services + +用于开启 OTG 端口的设备功能配置: + +``` +# `*.*` 为对应的 USB 控制器 + +radxa-adbd@*.* # 配置为 ADB 设备 +radxa-ecm@*.* # 配置为 ECM 设备(不推荐) +radxa-ncm@*.* # 配置为 NCM 设备(推荐) +``` + ## Overlays 该选项用于配置设备树 Overlays。 diff --git a/docs/common/radxa-os/_usbnet.mdx b/docs/common/radxa-os/_usbnet.mdx index ce2a924e5..84055ab1e 100644 --- a/docs/common/radxa-os/_usbnet.mdx +++ b/docs/common/radxa-os/_usbnet.mdx @@ -1,52 +1,24 @@ -大多数radxa产品都预留了一个USB端口作为OTG端口,在运行Android时也作为adb调试端口。你可以在此查阅相应[产品](https://radxa.com/products)的端口定义。 -你可以通过OTG端口连接两个产品来建立一个共享网络。现在官方支持最新的linux和android图像。 +大多数 Radxa 产品都预留了一个 USB 端口作为 OTG 端口,在运行 Android 时也作为 ADB 调试端口。你可以在此查阅相应[产品](https://radxa.com/products)的端口定义。 +你可以通过 OTG 端口连接两个产品来建立一个共享网络。此文档仅适用于官方发布的最新的 Radxa OS 和 Android 镜像。 ### 准备工作 -**线缆**: 首先,你将需要一条USB-A转USB-A的线来连接两个SBC。 - -**软件**: 如果你的SBC没有最新的软件,请将你的SBC连接到互联网,并输入以下命令以更新到最新: - -```bash -sudo apt update && sudo apt full-upgrade -``` - -**服务**: 更新软件后,你需要启动`radxa-usbnet`服务: - -```bash -sudo systemctl enable --now radxa-usbnet -``` - -**状态**: 输入以下命令来确认服务是否正常运行: - -```bash -sudo systemctl status radxa-usbnet.service -``` - -服务运行时的活动状态信息为 `active(exited)`。 +**线缆**: 首先,你将需要一条数据线来连接 SBC 的 OTG 端口,具体使用的端口请参考对应产品的硬件信息页面。 +**软件**: 如果你的 SBC 没有最新的软件,请将你的 SBC 连接到互联网,并使用 [`rsetup` 更新系统](rsetup#system-update): ### OTG设置 -首先,用USB-A转USB-A数据线连接两个SBC的OTG端口。 -共享网络里的设备性质由你所启用的[overlay](../os-config/rsetup#overlay)决定,主机的设备名称为host。 -主机启用此项overlay: +首先,使用数据线连接 SBC 的 OTG 端口。 +使用 [`rsetup`](rsetup#overlays) 启用 `Set OTG port to Peripheral mode` overlay 并重启。 -```bash - [*] Set OTG port to Host mode -``` +### 开启 `NCM` 服务 -从机启用此项overlay: +使用 [`rsetup`](rsetup#usb-otg-services) 启用 `radxa-ncm@*.*` 服务。 -```bash - [*] Set OTG port to Peripheral mode -``` +### 主机网络设置 -启用设置后需要重启。 - -#### 主机设置 - -为了给设备机共享网络,主机需要连接到外部网络,有线和无线网络都可以。 -接下来,我们需要给设备机的连接设置一个共享适配器,在KDE桌面和终端上都可以设置。 +为了给设备机共享网络,主机需要连接到外部网络,有线和无线网络都可以。 +接下来,我们需要给设备机的连接设置一个共享适配器,在KDE桌面和终端上都可以设置。 此处以在终端设置为例: **设置共享适配器:** @@ -66,9 +38,9 @@ ip a valid_lft forever preferred_lft forever ``` -如果没有新的网卡,你可能需要再次设置overlay或重启。 +如果没有新的网卡,请检查前面的步骤:打开 [Overlay](#otg设置),重启,并[启动 NCM 服务](#开启-ncm-服务)。 -网络管理器工具(/radxa-os/config/network)是推荐的管网络理工具,输入命令即可打开界面: +`NetworkManager` 是推荐的网络管理工具,输入命令即可打开界面: ```bash sudo nmtui @@ -91,7 +63,9 @@ sudo nmtui ``` 选择 `Edit a connection -- ` 里的 `Ethernet` 项来设置一个适配器: + ![add adapter](/img/configuration/add_adapter.webp) + 在众多选项中,只需要填写其中的以下两项: ```bash @@ -100,6 +74,7 @@ sudo nmtui ``` 保存配置并返回到设置界面 `Activate a connection`,选择你刚刚添加的选项。 + 配置好后,则设置会更新为与以下相同: ```bash @@ -108,6 +83,7 @@ sudo nmtui ``` **确认适配器设置:** + 设置之后,检查是否出现第三张网卡的信息: ```bash @@ -128,11 +104,12 @@ ip a 如果它与你的结果相似,接下来就可以设置从设备了。 -#### 从设备设置 +### 从设备设置 **启用usb网络连接:** + 相对于主机来说,从设备较容易设置。 -首先, 启用 `Set OTG port to Peripheral mode` overlay并且开启 `radxa-usbnet` 服务, 之后重启。 + 输入 `ip a` 以确认名为 `usb0` 的设备是否被添加到网卡列表: ```bash @@ -140,10 +117,10 @@ ip a link/ether 76:c7:9d:9e:d5:da brd ff:ff:ff:ff:ff:ff ``` -如果没有,请检查前面的步骤:重新打开Overlay(别忘了重启),并重新启动usbnet服务。 +如果没有,请检查前面的步骤:打开 [Overlay](#otg设置),重启,并[启动 NCM 服务](#开启-ncm-服务)。 + +**设置 NCM 适配器:** -**设置usbnet适配器:** -接下来,像设置主设备一样设置适配器: 打开网络管理器工具: ```bash @@ -173,7 +150,7 @@ Device usb0 **检查连接情况:** -检查usb0是否被分配了IP地址,如下所示: +检查 `usb0` 是否被分配了IP地址,如下所示: ```bash $ ip a diff --git a/i18n/en/docusaurus-plugin-content-docs/current/common/config/_rsetup.mdx b/i18n/en/docusaurus-plugin-content-docs/current/common/config/_rsetup.mdx index 78411e39d..3ac60876b 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/common/config/_rsetup.mdx +++ b/i18n/en/docusaurus-plugin-content-docs/current/common/config/_rsetup.mdx @@ -104,7 +104,7 @@ Some peripherals can be modified on this menu, the following is the introduction │ GPIO LEDs │ │ Thermal governor │ │ Configure DSI display mirroring │ -│ │ +│ USB OTG services │ │ │ │ │ │ │ @@ -134,6 +134,18 @@ Generally, we select `power_allocator` when using DC fan or fanless, select `ste If DSI display has some problems when using HDMI display and DSI display at the same time, enable this option will helpful. +### USB OTG services + +Enabling Device function configuration for the OTG port: + +``` +# `*.*` is the corresponding USB controller + +radxa-adbd@*.* # Configured as an ADB device +radxa-ecm@*.* # Configured as an ECM device (not recommended) +radxa-ncm@*.* # Configured as an NCM device (recommended) +``` + ## Overlays This option is for Configure Device Tree Overlay. diff --git a/i18n/en/docusaurus-plugin-content-docs/current/common/radxa-os/_usbnet.mdx b/i18n/en/docusaurus-plugin-content-docs/current/common/radxa-os/_usbnet.mdx index 03ca18f38..7003a79ed 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/common/radxa-os/_usbnet.mdx +++ b/i18n/en/docusaurus-plugin-content-docs/current/common/radxa-os/_usbnet.mdx @@ -1,52 +1,26 @@ -Most of radxa products have reserved a USB port as an OTG port, it also a adb debug port when runuing Android. You can consult the port definitions of the corresponding [products](https://radxa.com/products). -You can set up a shared network between two products by connecting their OTG ports. Now officially supported for latest linux and android images. +Most Radxa products reserve a USB port as an OTG port, and also as an ADB debug port when running Android. +You can check the port definition of the corresponding [product](https://radxa.com/products) here. +You can create a shared network by connecting two products via the OTG port. +This document only applies to the latest officially released Radxa OS and Android images. ## Preparations -**Cable**: Before you start, you will need one USB-A to USB-A cable to connect two SBCs. - -**Software**: If your SBC has not the latest software, connect you SBC to internet and type the following command: - -```bash -sudo apt update && sudo apt full-upgrade -``` - -**Service**: After updating software, you need to start the `radxa-usbnet` service: - -```bash -sudo systemctl enable --now radxa-usbnet -``` - -**Status**: Typing the command to confirm if the service is running: - -```bash -sudo systemctl status radxa-usbnet.service -``` - -The service active status is usually `active(exited)` when running. +**Cable**: First of all, you will need a cable to connect to the OTG port of your SBC, please refer to the hardware information page of the corresponding product for the specific port used. +**Software**: If your SBC does not have the latest software, please connect your SBC to the Internet and use [`rsetup` to update the system](rsetup#system-update): ## OTG Settings -At first, connect the two SBC OTG ports by USB-A to USB-A cable. -Device identity of this shared network depends on what [overlay](../os-config/rsetup#overlay) you enable,the host machine shares the network to device mahine. -The host machine enable this overlay: +First, connect the OTG port of the SBC using the data cable. +Enable `Set OTG port to Peripheral mode` overlay using [`rsetup`](rsetup#overlays) and reboot. -```bash -[*] Set OTG port to Host mode -``` +### Enable `NCM` services -The device machine enable this overlay: - -```bash -[*] Set OTG port to Peripheral mode -``` - -Reboot after enable options. +Use [`rsetup`](rsetup#usb-otg-services) to enable the `radxa-ncm@*.*` Service. ### To the Host machine -For sharing the network to device machine, host machine need to connect to the external network, both wired and wireless networks are available. -Next, we need to set up a shared adapter for the device machine connection, which can be set on the KDE Desktop and Terminal. +For sharing the network to device machine, host machine need to connect to the external network, both wired and wireless networks are available. +Next, we need to set up a shared adapter for the device machine connection, which can be set on the KDE Desktop and Terminal. This guide you set it on terminal: **Set shared adapter:** @@ -66,7 +40,7 @@ The name of it may be different: valid_lft forever preferred_lft forever ``` -If there is not a new network card, you may need to set overlay once again. +If there is no new NIC, check the previous steps: open [Overlay](#otg-settings), reboot, and [start NCM service](#enable-ncm-services). Network Manager Tool is the recommended tool to manage the network, typing the command to open the interface: @@ -91,7 +65,9 @@ After identification, the setting interface appears: ``` Select `Edit a connection -- ` to add a `Ethernet` adapter: + ![add adapter](/img/configuration/add_adapter.webp) + Of the many options, we only need to fill in two of them: ```bash @@ -108,6 +84,7 @@ It would be following if you apply it right: ``` **Confirm adapter setting:** + After you settings, check if there is a IP address of third network card: ```bash @@ -131,8 +108,7 @@ If it's similar with your result, time to set up device machine. ### To Device machine **Enable usb network connection:** -Relative to Host machine, it woulb be easy for device machine settings. -At first, enable the `Set OTG port to Peripheral mode` overlay and start the `radxa-usbnet` service, reboot. +Relative to Host machine, it woulb be easy for device machine settings. Typing `ip a` to confirm if a new device named `usb0` like the following added: ```bash @@ -140,10 +116,9 @@ Typing `ip a` to confirm if a new device named `usb0` like the following added: link/ether 76:c7:9d:9e:d5:da brd ff:ff:ff:ff:ff:ff ``` -If not, check previous steps: reopen the overlay (Don't forget to reboot.) and restart the usbnet service. +If there is no new NIC, check the previous steps: open [Overlay](#otg-settings), reboot, and [start NCM service](#enable-ncm-services). -**Set up usbnet adapter:** -Next, set up the adapter as set up the Host device: +**Setup NCM adapter:** Open the Network Manager Tool: ```bash