Linux Network Configuration Introduction
:::info 文档信息
文档标识:RK-KF-YF-378 · 发布版本:V1.0.2 · 发布日期:2022-1-14 · 页数:21 · 语言:英文
原始文档:Rockchip_Developer_Guide_Network_Config_EN.pdf
:::
章节大纲
- Linux Network Configuration Introduction(P1)
- Wi-Fi/BT Configuration(P4)
- Kernel Configuration(P4)
- Buildroot Configuration(P4)
- Compilation Introduction(P6)
- Configuration Network by Command Line(P6)
- Network Configuration by Mobile Phone(P7)
- BLE Network Configuration(P7)
- Introduction(P7)
- Interface Description(P7)
- Sample Program(P7)
- APP(P8)
- Network Configuration Steps(P8)
- AirKiss Network Configuration(P11)
- Introduction(P11)
- Kernel Modification(P11)
- Interface Description(P11)
- Sample Program(P12)
- WeChat Network Configuration(P12)
- Operation Example(P13)
- SoftAP Network Configuration(P14)
- Introduction(P14)
- APP(P14)
- Buildroot Configuration(P14)
- Interface Description(P15)
- Sample Program(P15)
- Network Configuration Steps(P16)
- Softap Web UI Configure Network(P18)
- Introduction(P18)
- Code Directory(P19)
- Buildroot Configuration(P19)
- Configure Network(P19)
- BLE Network Configuration(P7)
- Wi-Fi/BT Configuration(P4)
在线预览
若预览无法显示,请直接下载 PDF 后用本地阅读器打开。
1. Wi-Fi/BT Configuration
1.1 Kernel Configuration
Please refer to the the Second chapter "WIFI/BT Configuration" in the Rockchip_Developer_Guide_Linux_WIFI_BT_EN.pdf document under the /docs/Linux Wifibt directory.
1.2 Buildroot Configuration
Execute in the root directory: make menuconfig .
- Wi-Fi configuration:
Please select the corresponding configuration according to the actual Wi-Fi used, and it must be consistent with the kernel configuration.
- Bluetooth configuration
Realtek modules are recommended to use BlueZ protocol, and Ampak/AzureWave modules are recommended to use BSA protocol. Choose one of the following configurations according to the module type:
For Realtek modules, please choose: bluez-utils 5.x, if BlueZ is used, bluez-alsa and readline are needed to be turned on at the same time For Ampak modules, please choose: broadcom(ampak) bsa server and app Enter wifi/bt chip support(XXX)---> select the actual chip model, which must be consistent with the rkwifibt configuration.
For AzureWave modules, please choose: broadcom(cypress) bsa server and app
Enter wifi/bt chip support(XXX)---> select the actual chip model, which must be consistent with the rkwifibt configuration.
- Exit the configuration dialog box and save the configuration with
make savedefconfig
1.3 Compilation Introduction
- Compile rkwifibt and execute in the root directory:
make rkwifibt-dirclean && make rkwifibt-rebuild
- Compile the Bluetooth module, choose one of the following three compilation options according to the module type
Realtek module compilation:
make bluez5_utils-rebuild
make bluez-alsa-rebuild
Ampak module compilation:
make broadcom_bsa-rebuild
AzureWave module compilation:
make cypress_bsa-rebuild
- Compile deviceio, execute in the root directory:
make deviceio-dirclean && make deviceio-rebuild
- Package the firmware and execute it in the root directory:
./mkfirmware.sh #Or ./build.sh, global compilation, will package the firmware
automatically
2. Configuration Network by Command Line
- First make sure that the Wi-Fi service process is enabled, and enter the serial port:
ps | grep
wpa_supplicant
- If it does not start, please start it manually:
wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf &
- Modify the /data/cfg/wpa_supplicant.conf file and add the following configuration items:
network={
ssid="WiFi-AP" // Wi-Fi name
psk="12345678" // Wi-Fi password
key_mgmt=WPA-PSK // Encryption method(Optional), if it is not filled in, it
can be identified automatically
#key_mgmt=NONE // No encryption
}
- Re-read the above configuration:
wpa_cli reconfigure5. Rconnect:wpa_cli reconnect
3. Network Configuration by Mobile Phone
3.1 BLE Network Configuration
3.1.1 Introduction
BLE network configuration supports both BlueZ BLE and BSA BLE. Please refer to the first chapter "WIFI/BT Configuration" of this document for details. And BLE network configuration has been integrated into deviceio, and the interface is located in RkBle.h.
3.1.2 Interface Description
Please refer to the the second chapter "BLE Interface Introduction (RkBle.h)" in the "Rockchip_Developer_Guide_Rk3308_DeviceIo_Bluetooth_EN.pdf" document in the /docs/Develop reference documents/DeviceIo directory.
3.1.3 Sample Program
The sample program is located in: external/deviceio/test/rk_ble_app.c .
3.1.4 APP
APP is located in: /external/app/RockHome.apk
APP source code is located in: /external/app/src/RockHome
This APP is only used as a development demo on the mobile phone side. We have adapted Hornor 8, Remi 6, Xiaomi 6, OnePlus 6, OPPO A5 models, iphone6s (plus), Samsung S6, VIVO X9 and other mobile phones. Other models of mobile phones have not been tested, and there may be app compatibility risk.
3.1.5 Network Configuration Steps
The network configuration steps are explained by taking BSA BLE network configuration as an example, and all logs on the board side are logs of BSA configuration network. The BlueZ operation steps are the same, but the log on the board side is different.
- Make sure that the Wi-Fi service process is started, and enter from the serial port:
ps | grep
wpa_supplicant
- If it does not start, please start it manually:
wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf &
-
On the board side, command line execute "
deviceio_test wificonfig" , enter 1 and press Enter to start BLE network configuration -
The name of the "set BLE broadcast device" must be prefixed with RockChip, otherwise the APK cannot search the device: 5. Open the APK on the mobile phone
Click CONTINUE -> START SCAN to scan for BLE devices named with RockChip as the prefix:
-
Click on the BLE device you want to connect to and start to connect to the device. If the device is connected successfully, the log on the board side will be showed as follows
-
When the device is connected successfully, enters the network configuration interface on the APK, click the >> button to get the Wi-Fi list, select the Wi-Fi you want to connect to, enter the password, and click Confirm to start the network configuration: 8. After the board receives the ssid and psk, it starts to connect to the network
-
If the connection is successful, the board will send a notification to the phone APK
-
After the APK receives the notification with successful network configuration, it disconnects the BLE connection and returns to the device search interface. The log on the board side is as follows 11. To start the network configuration again, you need to enter 2 to turn off the BLE network configuration; then enter 1 to restart BLE, and repeat the above network configuration process.
3.2 AirKiss Network Configuration
3.2.1 Introduction
At present, AirKiss only supports rtl8723ds, please refer to the first chapter of this document ‘Wi-Fi/BT Configuration’ for detailed configuration; for AP modules, please refer to the introduction in the external/wifiAutoSetup directory.
AirKiss has poor compatibility and it is not recommended to be used as the only one network configuration solution, and other network configuration solution need to be added. Please refer to "/docs/Develop reference documents/WIFIBT/RK platform RTL8723DS AIRKISS network configuration introduction.pdf" for detailed introduction.
At present, AirKiss network configuration has been integrated into deviceio, and the interface is located in Rk_wifi.h.
3.2.2 Kernel Modification
Modify the /drivers/net/wireless/rockchip_wlan/rtl8723ds/Makefile file:
-CONFIG_WIFI_MONITOR = n
+CONFIG_WIFI_MONITOR = y
3.2.3 Interface Description
Start AirKiss network configuration, return 0 if it succeeds, return -1 if it fails:
int RK_wifi_airkiss_start(char *ssid, char *password)
ssid: the name of Wi-Fi sent from the mobile phone password: the password of the Wi-Fi sent by the mobile phone
Close AirKiss network configuration:
void RK_wifi_airkiss_stop()
3.2.4 Sample Program
The sample program is located in: external/deviceio/test/rk_wifi_test.c
This test case calls RK_wifi_airkiss_start() to start AirKiss, obtain ssid and password, and start Wi-Fi network configuration. Main interface : void rk_wifi_airkiss_start(void *data), called in DeviceIOTest.cpp.
3.2.5 WeChat Network Configuration
You can use the mobile APP or scan the WeChat QR code to configure the network.
-
Mobile APP download address:
https://iot.weixin.qq.com/wiki/document-download.html,enter the download center -> WiFi device -> AirKiss debugging tool, download AirKissDebugger.apk -
Scan the following QR code on WeChat. When configuring the network with the QR code, the phone must be connected to Wi-Fi first, otherwise it will prompt: failed to search for the device, please turn on the phone’s Wi-Fi and try again
3.2.6 Operation Example
-
Take the APP as an example to explain the operation on the mobile phone. Open AirKissDebugger.apk, enter the ssid and password, and the AESKey can leave empty. Click the send button, will prompt "AirKissDebugger: Bingo" when the network configuration is successful
-
Command line execute:
deviceio_test wificonfigon the board side , enter 3 and press Enter to start airkiss network configuration -
AirKiss started successfully 4. Received ssid and password successfully, and started to configure network
-
Network configuration is successful
-
To start the network configuration again, you need to enter 4 to close the AirKiss network configuration; then enter 3 to restart AirKiss and repeat the above network configuration process.
3.3 SoftAP Network Configuration
3.3.1 Introduction
First, use the Wi-Fi of the SDK board to create an AP hotspot and connect to the AP hotspot on the mobile phone; second, obtain the currently scanned hotspot list of the SDK board through the mobile phone APK, and fill in the password to connect to the AP on the mobile phone. The APK will send the AP's ssid and password to the SDK board; finally, the SDK board will connect to Wi-Fi according to the received information.
SoftAP configuration network has been integrated into deviceio, and the interface is located in Rk_softap.h.
3.3.2 APP
APP is located in: /external/app/RockHome.apk
App source code is located in: /external/app/src/RockHome
3.3.3 Buildroot Configuration
3.3.4 Interface Description
- Start softap network configuration:
RK_softap_start(char* name, RK_SOFTAP_SERVER_TYPE server_type)
name: the name of the Wi-Fi hotspot, the prefix must be Rockchip-SoftAp server_type: network protocol type, currently, only supports TCP protocol
- Stop softap network configuration
int RK_softap_stop(void)
- Registration status callback
RK_softap_register_callback(RK_SOFTAP_STATE_CALLBACK cb)
Connecting to the network: RK_SOFTAP_STATE_CONNECTTING The network connection is successful: RK_SOFTAP_STATE_SUCCESS Network connection failed: RK_SOFTAP_STATE_FAIL
3.3.5 Sample Program
The path of the sample program is: external/deviceio/test/rk_wifi_test.c
Main interface:
void rk_wifi_softap_start(void *data)
rk_wifi_softap_stop(void *data)
Called in DeviceIOTest.cpp.
3.3.6 Network Configuration Steps
- First, make sure that the Wi-Fi service process is started. Enter on the serial port:
ps | grepwpa_supplicant, if it doesn't start, please start it manually:
wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf &
-
Execute
deviceio_test wificonfigin the command line of the board, enter 5 and press Enter to start SoftAP network configuration -
Open RockHome.apk, slide left to select the third option, enter the SoftAP network configuration mode, click SEARCH DEVICES, scan for SoftAP devices named with Rockchip-SoftAp as the prefix 4. Click the SoftAP device you want to connect to, start to connect to the device, when the device is connected successfully, and there will be the following log on the board side:
-
When the device is successfully connected, enters the network configuration interface on the APK, click >> to get the Wi-Fi list, select the Wi-Fi you want to connect to, enter the password, and click Confirm to start the network configuration
-
The board receives the ssid and psk and starts to connect to the network 7. The network connection is successful:
-
After the network configuration is successful, disableWifiAp on the board side, the mobile phone APK returns to the device search interface, and the log on the board side is as follows:
-
If you want to start SoftAP network configuration again, you need to enter 6, press Enter to de-initialize SoftAP, and then enter 5 to re-initialize SoftAP, and repeat the above network configuration steps.
3.4 Softap Web UI Configure Network
3.4.1 Introduction
The rule of the Softap Web UI network configuration is the same as the above SoftAP network configuration, except that there is no need to install any APK on the mobile phone, connect to the hotspot, and then configure the network in the browser directly.
3.4.2 Code Directory
external/rk_webui/ (contains source code, startup script)
buildroot/package/boa/
buildroot/package/rockchip/rk_webui/ (including compilation script)
3.4.3 Buildroot Configuration
First, Buildroot selects BR2_PACKAGE_RK_WEBUI = y , then saves the configuration and recompiles make rk_webui to regenerate the new firmware.
3.4.4 Configure Network
-
After startup regularly, execute ps to ensure that the following 4 processes are started:
-
Open the setting interface of the phone and search for APs with Rockchip_WebUI_ prefix, such as Rockchip_WebUI_9604 (the last 4 number represents the last 4 number of the Wi-Fi MAC address of the device, which is convenient to distinguish), and click connect:
-
Open the mobile browser, enter: 192.168.88.1 (the browser will jump to /cgi-bin/home.c automatically), then press Enter, the following interface appears: 4. Click WiFi AP:
-
Click Scan:
-
Click the Wi-Fi you want to connect, then enter the password and click Connect (Note: Due to the hardware limitation of the Wi-Fi chip: When the current Wi-Fi connection such as TP-LINK_HKH and its own hotspot Rockchip_WebUI_XXXX are not in the same channel, it will cause the phone disconnected from the hotspot, please reconnect to the hotspot to obtain the network configuration status) 7. Reconnect the phone to the hotspot, click refresh, you can see that it is connected (and supports forget and disconnect operations)