wpa_supplicant 一切正常:
# wpa_supplicant -i wlan0 -D nl80211 -c /etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
# udhcpc -i wlan0
udhcpc: started, v1.31.0
[ 80.342527] random: mktemp: uninitialized urandom read (6 bytes read)
udhcpc: sending discover
udhcpc: sending select for 192.168.43.14
udhcpc: lease of 192.168.43.14 obtained, lease time 3599
deleting routers
运行 hostapd 出错:
# hostapd /etc/hostapd2.conf
Configuration file: /etc/hostapd2.conf
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Could not read interface wlan0 flags: No such device
nl80211 driver initialization failed.
wlan0 : interface state UNINITIALIZED->DISABLED
wlan0 : AP-DISABLED
wlan0 : CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
/etc/hostapd2.conf 内容:
interface=wlan0
driver=nl80211
ssid=mywifi
channel=1
wmm_enabled=0
wpa=3
wpa_passphrase=wa12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
离线
离线
不会,帮顶→_→一下吧。
离线
特意试了一下我的华嵌S3, 也是AP6212同一个WIFI芯片, /etc/hostapd3.conf
interface=wlan0
ctrl_interface=/var/run/hostapd
beacon_int=100
dtim_period=1
preamble=0
#wps_state=2
#eap_server=1
ssid=test_device
max_num_sta=5
channel=1
hw_mode=g
手机可以发现 S3 wifi 热点:
# hostapd /etc/hostapd3.conf
Configuration file: /etc/hostapd3.conf
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b0:02:47:30:fb:ea and ssid "test_device"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0: STA a4:45:19:d4:27:c5 IEEE 802.11: associated
wlan0: AP-STA-CONNECTED a4:45:19:d4:27:c5
wlan0: STA a4:45:19:d4:27:c5 IEEE 802.11: disassociated
wlan0: AP-STA-DISCONNECTED a4:45:19:d4:27:c5
wlan0: STA a4:45:19:d4:27:c5 IEEE 802.11: disassociated
^Cwlan0: interface state ENABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
^C[ 2466.296698] brcmfmac: brcmf_cfg80211_stop_ap: SET SSID error (-110)
[ 2466.307040] brcmfmac: brcmf_cfg80211_stop_ap: BRCMF_C_DOWN error -512
[ 2466.313525] brcmfmac: brcmf_cfg80211_stop_ap: setting AP mode failed -110
[ 2466.320386] brcmfmac: brcmf_cfg80211_stop_ap: BRCMF_C_UP error -110
[ 2466.326711] brcmfmac: brcmf_set_mpc: fail to set mpc
然后继续测试手机连开发板的WIFI热点:
#设置wifi网卡固定IP地址
ifconfig wlan0 192.168.2.234 netmask 255.255.255.0 up
#启动dhcpd服务器, 手机连上热点之后可以自动获取到IP地址
dnsmasq -i wlan0 --dhcp-range=192.168.2.100,192.168.2.109,2h
完全OK了。
离线
分享一个我在X3 AP6212下面的WIFI热点设置:
先设置网卡ip地址:
ifconfig wlan0 192.168.10.1 netmask 255.255.255.0 up
再开启dhcpd服务器:
dnsmasq -i wlan0 --dhcp-range=192.168.10.100,192.168.10.109,2h
配置文件: etc/hostapd.conf
interface=wlan0
ctrl_interface=/var/run/hostapd
beacon_int=100
dtim_period=1
preamble=0
#wps_state=2
#eap_server=1
ssid=x3_smallwit
max_num_sta=5
channel=1
hw_mode=g
wpa=2
#wpa_psk_file=/etc/hostapd.wpa_psk
wpa_passphrase=smallwit
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
wpa_group_rekey=600
wpa_gmk_rekey=86400
然后执行: hostapd /etc/hostapd.conf
离线