|
x210 linux平台WIFI测试方法
一:加载WIFI驱动
insmod /lib/modules/wlan.ko
二:给WIFI设置IP,确定IP在自己的网段:
ifconfig wlan0 192.168.0.123 up
三:在/etc目录下,修改wpa_supplicant.conf文件:
默认内容为:
# WPA-PSK/TKIP
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="armeasy"
scan_ssid=1
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
pairwise=TKIP CCMP
group=CCMP TKIP WEP104 WEP40
psk="phosphor"
}
注意,这里ssid表示WIFI名称,psk表示WIFI密码,请填写自己对应的名称和密码。
四:建立工作目录
mkdir –p /var/run/wpa_supplicant
五:执行如下指令:
wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf &
如加载成功,会有如下打印:
[root@x210ii /]# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf &
[1] 133
[root@x210ii /]# [ 466.153272] [rtw_wx_set_pmkid] IW_PMKSA_FLUSH!
[ 466.157421] set_mode = IW_MODE_INFRA
[ 467.391102] survey done event(4e)
Trying to associa[ 467.395149] wpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM
te with 8c:21:[ 467.401263] set_mode = IW_MODE_INFRA
[ 467.405887]
[ 467.405891] wpa_ie(length:22):
[ 467.410476] 0x30 0x14 0x01 0x00 0x00 0x0f 0xac 0x02
[ 467.415291] 0x01 0x00 0x00 0x0f 0xac 0x04 0x01 0x00
[ 467.420130] 0x00 0x0f 0xac 0x02 0x00 0x00 0x00 0x00
[ 467.425081] =>rtw_wx_set_essid
[ 467.427166] ssid=armeasy, len=7
[ 467.431275] #### dst_ssid=(armeasy) Opt_Ant_(B) , cur_Ant(B)
[ 467.435966] rtw_restructure_ht_ie IEEE80211_HT_CAP_MAX_AMSDU is set
[ 467.443130] <=rtw_wx_set_essid
[ 467.445346] link to new AP
0a:0d:4b:0c (SSID='armeasy' freq=2452 MHz)
[ 467.611179] link to Artheros AP
[ 467.621406] OnAuthClient
[ 467.633762] OnAssocRsp
[ 467.634656] report_join_res(1)
[ 467.637744] OnAction_back
[ 467.640286] OnAction_back, action=0
[ 467.643751] issue_action_BA, category=3, action=1, status=0
[ 467.649769] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 467.655488] WMM(0): 0, a42b
[ 467.658395] WMM(1): 0, a44f
[ 467.661045] WMM(2): 0, 5e4322
[ 467.664353] WMM(3): 0, 2f3222
[ 467.666726] HTOnAssocRsp
Associated with 8c:21:0a:0d:4b:0c
[ 467.676099] update raid entry, mask=0xfffff, arg=0xa0
[ 467.680474] HW_VAR_BASIC_RATE: BrateCfg(0x15d)
[ 467.687477] rtl8192c_set_FwJoinBssReport_cmd mstatus(1)
[ 467.692589] SetFwRsvdPagePkt
[ 467.694236] Set RSVD page location to Fw.
[ 467.699043]
[ 467.699048] ~~~~stastakey:unicastkey
[ 467.703925]
[ 467.703930] ~~~~stastakey:groupkey
[ 467.708756] ==> rtw_set_key algorithm(2),keyid(1),key_mask(2)
WPA: Key negot[ 467.715470] =>mlmeext_joinbss_event_callback
iation completed with 8c:21:0a:0d:4b:0c [PTK=CCMP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to 8c:21:0a:0d:4b:0c completed (auth) [id=0 id_str=]
六:ping路由,这时应该能够PING通路由:
[root@x210ii /]# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: seq=0 ttl=64 time=13.804 ms
64 bytes from 192.168.0.1: seq=1 ttl=64 time=18.033 ms
--- 192.168.0.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 13.804/15.918/18.033 ms
[root@x210ii /]#
七:添加网关
route add default gw 192.168.0.1
成功后可通过route指令查询:
[root@x210ii /]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 wlan0
[root@x210ii /]# route add default gw 192.168.0.1
[root@x210ii /]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 wlan0
default 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0
[root@x210ii /]#
八:ping外网
[root@x210ii /]# ping 58.63.236.39
PING 58.63.236.39 (58.63.236.39): 56 data bytes
64 bytes from 58.63.236.39: seq=0 ttl=55 time=2903.754 ms
64 bytes from 58.63.236.39: seq=1 ttl=55 time=2990.038 ms
64 bytes from 58.63.236.39: seq=2 ttl=55 time=2963.814 ms
64 bytes from 58.63.236.39: seq=3 ttl=55 time=3113.067 ms
64 bytes from 58.63.236.39: seq=4 ttl=55 time=2949.479 ms
64 bytes from 58.63.236.39: seq=5 ttl=55 time=2371.217 ms
64 bytes from 58.63.236.39: seq=6 ttl=55 time=1503.418 ms
--- 58.63.236.39 ping statistics ---
9 packets transmitted, 7 packets received, 22% packet loss
round-trip min/avg/max = 1503.418/2684.969/3113.067 ms
[root@x210ii /]#
表明已经成功连上外网。上面IP为新浪IP地址。
说明:linux USB WIFI的移植,关键就是如何生成wpa_supplicant工具。用户
可直接从x210 linux_qt平台中提取。
|
|