diff --git a/docs/Application_guide/en/media/network-comm/nic/network_usbnet_demo_8.png b/docs/Application_guide/en/media/network-comm/nic/network_usbnet_demo_8.png new file mode 100644 index 0000000000000000000000000000000000000000..054d95a62253dbfd7cb7e463d247eb849216e1b7 Binary files /dev/null and b/docs/Application_guide/en/media/network-comm/nic/network_usbnet_demo_8.png differ diff --git a/docs/Application_guide/en/network-comm/nic/usbnet/usbnet-ios-example.md b/docs/Application_guide/en/network-comm/nic/usbnet/usbnet-ios-example.md new file mode 100644 index 0000000000000000000000000000000000000000..bcd463b0e27e1d6d0795cc5c584832996c806bef --- /dev/null +++ b/docs/Application_guide/en/network-comm/nic/usbnet/usbnet-ios-example.md @@ -0,0 +1,66 @@ +# Apply IOS Network Adapter on Android + +This section takes QuecPython EC200UEU_AB EVB as an example to demonstrate how to use a USB network adapter on an IOS phone. + +> Note 1: The ECM mode can be directly loaded and used in Linux, Android, or IOS without a driver. +> Note 2: In ECM mode, the MAC address of some module models may not be recognized by the phone. In such cases, you can refer to the corresponding [USBNET](https://python.quectel.com/doc/API_reference/en/peripherals/misc.USBNET.html) section on the Wiki and update the available MAC address with MAC configuration interface . + +1. Prepare the development environment + + Please refer to the [Getting Started](https://python.quectel.com/doc/Getting_started/en/) section (skip if you are already familiar) to set up the development environment. + You will also need a mobile phone and a cable that can be converted into a mobile phone interface. + +2. Open the QPYCOM tool and connect the device + + Power on the module, connect to the computer via a USB port, and use QPYCOM tool to connect to the python interface of USB. + ![](../../../media/network-comm/nic/network_usbnet_demo_qpycom.png) + +3. Write a startup script for the USB network adapter + + Please refer to the corresponding [USBNET](https://python.quectel.com/doc/API_reference/en/peripherals/misc.USBNET.html) section on the Wiki for specific USB network adapter interface. + Create a new file named `main.py` and enter the following content: + + ```python + # Import required packages + from misc import USBNET + from misc import Power + import sim + import dataCall + import utime + + def usbnet_start(): + # Check if the USBNET working mode is ECM, if not, set it to ECM and restart the module. + saved_type = USBNET.get_worktype() + if saved_type != USBNET.Type_ECM : + USBNET.set_worktype(USBNET.Type_ECM) + Power.powerRestart() + utime.sleep(2) + # Check SIM card status, exit if no SIM card is inserted. + sim_info = sim.getStatus() + if sim_info != 1: + return + # Continuously check the network registration status, and enable USBNET when network registration information is obtained. + while True: + lte = dataCall.getInfo(1,0) + if type(lte) == tuple and lte[2][0] == 1: + if lte[2][2] != '0.0.0.0': + break + utime.sleep(1) + # Enable USBNET functionality. + USBNET.open() + + usbnet_start() + ``` + +4. Import the startup file + + Drag the written script into the module file system's usr partition via the QPYCom file panel. The `main.py` file is executed during startup. + + ![](../../../media/network-comm/nic/network_usbnet_demo_5.png) + +5. Connect the USB to the phone + + After configuring the startup on the computer, connect the USB port to the Type-C port on the phone and power on the module by pressing the PWRKEY button. After the module is started, you can open the browser to access the network normally. Please prepare the adapter cable yourself. + + ![](../../../media/network-comm/nic/network_usbnet_demo_8.png) + diff --git a/docs/Application_guide/en/sidebar.yaml b/docs/Application_guide/en/sidebar.yaml index b35ce4f0cf83ee00679326c7862929005aee0ceb..9bdbae1138fb7cf10442802c239419a938150e14 100644 --- a/docs/Application_guide/en/sidebar.yaml +++ b/docs/Application_guide/en/sidebar.yaml @@ -173,6 +173,8 @@ items: file: network-comm/nic/usbnet/usbnet-linux-example.md - label: Apply USB Network Adapter on Android file: network-comm/nic/usbnet/usbnet-android-example.md + - label: Apply USB Network Adapter on IOS + file: network-comm/nic/usbnet/usbnet-ios-example.md - label: Network Configuration file: network-comm/nic/network-config.md - label: Network Protocol diff --git a/docs/Application_guide/zh/media/network-comm/nic/network_usbnet_demo_8.png b/docs/Application_guide/zh/media/network-comm/nic/network_usbnet_demo_8.png new file mode 100644 index 0000000000000000000000000000000000000000..054d95a62253dbfd7cb7e463d247eb849216e1b7 Binary files /dev/null and b/docs/Application_guide/zh/media/network-comm/nic/network_usbnet_demo_8.png differ diff --git a/docs/Application_guide/zh/network-comm/nic/usbnet/usbnet-ios-example.md b/docs/Application_guide/zh/network-comm/nic/usbnet/usbnet-ios-example.md new file mode 100644 index 0000000000000000000000000000000000000000..6f453b77ff9c2724a7ed5a4cb8b773d07450bd8a --- /dev/null +++ b/docs/Application_guide/zh/network-comm/nic/usbnet/usbnet-ios-example.md @@ -0,0 +1,66 @@ +# IOS 系统使用 USB 网卡 + +下面以 QuecPython EC200UEU_AB 开发板为例,在 IOS 手机环境下使用 USB 网卡功能进行演示。 + +> 1. ECM 模式在 Linux/Android/IOS 系统中无需驱动,可以直接加载使用。 +> 2. ECM 模式下部分型号模块 MAC 地址手机无法识别,请根据 Wiki 上对应 [USBNET](https://python.quectel.com/doc/API_reference/zh/peripherals/misc.USBNET.html) 章节,使用 MAC 配置接口更新可用 MAC 即可。 + +1. 开发环境准备 + + 请参考[快速入门章节](https://python.quectel.com/doc/Getting_started/zh/index.html)(如已熟悉请跳过此步骤),搭建开发使用环境。 + 另需要手机一部,以及能够转换成手机接口的转换线。 + +2. 打开 QPYCOM 工具连接设备 + + 将模块上电,通过 USB 口连接电脑,使用 QPYCOM 工具连接 USB 的 python 交互口。 + ![](../../../media/network-comm/nic/network_usbnet_demo_qpycom.png) + +3. 编写 USB 网卡开机启动脚本 + + 具体 USB 网卡功能接口请参考 Wiki 上对应的 [USBNET章节](https://python.quectel.com/doc/API_reference/zh/peripherals/misc.USBNET.html)。 + 新建一个 main.py 文件,输入以下内容: + ```python + # 导入所需包 + from misc import USBNET + from misc import Power + import sim + import dataCall + import utime + + def usbnet_start(): + #判断 USBNET 工作模式为 ECM,若不是,则设置为 ECM 并重启模组。 + saved_type = USBNET.get_worktype() + if saved_type != USBNET.Type_ECM : + USBNET.set_worktype(USBNET.Type_ECM) + Power.powerRestart() + utime.sleep(2) + #判断 SIM 卡状态,没有插卡则退出。 + sim_info = sim.getStatus() + if sim_info != 1: + return + #循环查询注网状态,得到注网信息则开启 USBNET。 + while True: + lte = dataCall.getInfo(1,0) + if type(lte) == tuple and lte[2][0] == 1: + if lte[2][2] != '0.0.0.0': + break + utime.sleep(1) + #开启USBNET功能。 + USBNET.open() + + usbnet_start() + ``` + +4. 导入开机启动文件 + + 通过 QPYCom 文件栏把编写的脚本拖入模组文件系统 usr 分区,开机启动会执行main.py文件。 + + ![](../../../media/network-comm/nic/network_usbnet_demo_5.png) + +5. USB 连接手机 + + 通过电脑配置好开机启动后,将 USB 口接到手机上的 Type-C 口,并按 PWRKEY 键给模组上电,模组启动后即可打开浏览器正常访问网络。请自行准备转接线。 + + ![](../../../media/network-comm/nic/network_usbnet_demo_8.png) + + diff --git a/docs/Application_guide/zh/sidebar.yaml b/docs/Application_guide/zh/sidebar.yaml index 8c7c4b53b825481383cc5a25b5d534db36fab9e4..1b0cc119a12ca3f88c55b25fb57e3894809a4afb 100644 --- a/docs/Application_guide/zh/sidebar.yaml +++ b/docs/Application_guide/zh/sidebar.yaml @@ -172,6 +172,8 @@ items: file: network-comm/nic/usbnet/usbnet-linux-example.md - label: Android 系统使用 USB 网卡 file: network-comm/nic/usbnet/usbnet-android-example.md + - label: IOS 系统使用 USB 网卡 + file: network-comm/nic/usbnet/usbnet-ios-example.md - label: 网络配置 file: network-comm/nic/network-config.md - label: 网络协议