Yan
Yan Just a simple man.

buildroot如何连接wifi

buildroot如何连接wifi

wpa_cli

使用wpa_cli命令直接连接wifi,重启即失效.

1
2
3
4
5
6
7
8
buildroot# wpa_cli -i wlan0 add_network
0
buildroot# wpa_cli -i wlan0 set_network 0 ssid '"XXX"'
buildroot# wpa_cli -i wlan0 set_network 0 key_mgmt WPA-PSK
buildroot# wpa_cli -i wlan0 set_network 0 psk '"XXXXXXXX"'
buildroot# wpa_cli -i wlan0 select_network 0
buildroot# wpa_cli -i wlan0 enable_network 0
buildroot# dhcpcd wlan0

wpa_supplicant

修改配置文件

1
buildroot# nano /etc/wpa_supplicant

示例如下

1
2
3
4
5
6
7
8
9
10
11
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
    ssid=”myAP” pairwise=CCMP TKIP
    group=CCMP TKIP
    proto=WPA RSN
    key_mgmt=WPA-PSK
    priority=5
    psk=”my_passwd”
}

重启服务

直接重启整个wifi服务

1
buildroot# /etc/init.d/S42wifi reload

或者

1
buildroot# wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

重启dhcpcd

1
buildroot# dhcpcd

issues

如果有疑惑或错误,请提issues –> Issues