Buildroot WiFi Connection
Modify the configuration file
Method 1
Configuration via the qsetting QT application.
Method 2
Modify the following files:
vi /data/cfg/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1Add the following configuration items:
network={
ssid="WiFi-AP" // WiFi name
psk="12345678" // WiFi password
key_mgmt=WPA-PSK // encryption method
# key_mgmt=NONE // no encryption
}Start the wpa_supplicant process:
wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.confTemporary modification method
Modify the following files:
vi /data/cfg/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1Start the wpa_supplicant process:
wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.confConfigure WiFi via wpa_cli
Common commands:
wpa_cli -i wlan0 scan // Search for nearby wifi networks
wpa_cli -i wlan0 scan_result // print search wifi network
wpa_cli -i wlan0 add_network // add a network connectionIf the encryption method to connect is WPA-PSK-CCMP+TKIP / WPA2-PSK-CCMP+TKIP / ESS (wpa encryption), the wifi name is name, and the wifi password is: psk. The operation is as follows:
wpa_cli -i wlan0 set_network 0 ssid '"name"'
wpa_cli -i wlan0 set_network 0 psk '"psk"'
wpa_cli -i wlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -i wlan0 enable_network 0 //Enable WiFiIf the connection encryption method is WEP / ESS (wep encryption), the wifi name is name, and the wifi password is psk. The operation is as follows:
wpa_cli -i wlan0 set_network 0 ssid '"name"'
wpa_cli -i wlan0 set_network 0 key_mgmt NONE
wpa_cli -i wlan0 set_network 0 wep_key0 '"psk"'
wpa_cli -i wlan0 enable_network 0If the connection encryption method is ESS (no encryption), the wifi name is name. The operation is as follows:
wpa_cli -i wlan0 set_network 0 ssid '"name"'
wpa_cli -i wlan0 set_network 0 key_mgmt NONE
wpa_cli -i wlan0 enable_network 0Enable to save WIFI connection information:
wpa_cli -i wlan0 set update_config 1Save WIFI connection information:
wpa_cli -i wlan0 save_configConnect an existing connection:
wpa_cli -i wlan0 list_network // List all saved connections
wpa_cli -i wlan0 select_network 0 // connect to the first saved connection
wpa_cli -i wlan0 enable_network 0 // enable the first saved connectionTurn off WiFi:
ifconfig wlan0 down
