概述
在手机开发之初,我们很多时候要在lcm和tp还没有正常工作的时候就需要同步的进行wifi模块功能的开发,所以了解常用的命令会有助于我们快速的开发我们的手机,以下就是列出的常用命令供大家借鉴运用:
1、开启或关闭wifi:
首先adb shell进入手机调试
root@Eclipse:/ # echo 0 > dev/wmtWifi 关闭wifi
root@Eclipse:/ # echo 1 > dev/wmtWifi 开启wifi
2、查看wifi工作状态命令netcfg
root@Eclipse:/ # netcfg
rndis0 UP 192.168.42.129/24 0x00001043 b6:49:11:24:f4:74
ip6tnl0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
ifb1 DOWN 0.0.0.0/0 0x00000082 f6:c2:f5:3b:86:5f
ifb0 DOWN 0.0.0.0/0 0x00000082 62:76:1d:10:b5:1f
lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00
wlan0 UP 172.26.61.36/24 0x00001043 78:f5:fd:64:7b:fa //说明wifi已经正常开启
tunl0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
ccmni2 DOWN 0.0.0.0/0 0x00000080 96:25:62:66:5b:91
ccmni1 DOWN 0.0.0.0/0 0x00000080 16:d9:3b:66:9e:69
ccmni0 DOWN 0.0.0.0/0 0x00000080 62:eb:82:7d:ec:b3
3、对wifi进行扫描连接等操作由如下两个操作
首先进入System/bin目录
root@Eclipse:/ # cd system/bin/
root@Eclipse:/system/bin # ./wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf & //将wpa_supplicant调起来,可用ps命令查看是否起来
(如果配置文件不在上述目录,请使用这个路径:/system/etc/wifi/wpa_supplicant.conf)
(上述命令执行后会阻塞在命令行,如果要执行其他命令,请另开一个命令行界面)
(判断wifi或者supplicant是否运行起来,可以通过ps命令查看是否有tx_thread和./wpa_supplicant进程)
运行wpa_cli:
如果上面命令不成功,请执行:wpa_cli -p /data/misc/wpa_supplicant
接下来我们看一下测试结果:
root@Eclipse:/ # cd system/bin/
root@Eclipse:/system/bin # ./wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf &
[1] 22855
root@Eclipse:/system/bin # wpa_cli
wpa_cli v2.0-devel-4.2.2-MTK-MR1-PDK
Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Using interface 'wlan0'
Interactive mode
Warning: Failed to attach to wpa_supplicant.
Could not connect to wpa_supplicant: wlan0 - re-trying
Warning: Failed to attach to wpa_supplicant.
^CWarning: Failed to attach to wpa_supplicant.
^CWarning: Failed to attach to wpa_supplicant. //没有成功再执行以下第二个命令
[1] + Done (255) ./wpa_supplicant -Dnl80211 -iwlan0 -c/data/
root@Eclipse:/system/bin #
-----------------------------------------------------------------------------------------------------
root@Eclipse:/system/bin # wpa_cli -p /data/misc/wpa_supplicant
wpa_cli v2.0-devel-4.2.2-MTK-MR1-PDK
Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Selected interface 'wlan0'
Interactive mode
> scan
OK
<3>CTRL-EVENT-SCAN-RESULTS
> scan_r
bssid / frequency / signal level / flags / ssid
00:3a:9a:70:3e:62 2412 -57 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] PHONE-WIFI
00:3a:9a:70:3e:61 2412 -52 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-INTERNAL
00:3a:9a:70:3e:65 2412 -53 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-WIFI3
00:3a:9a:70:3e:63 2412 -53 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] PHONE-WIFI2
bc:96:80:35:3d:51 2412 -69 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] Baidu8375
0c:72:2c:1e:9e:b7 2457 -71 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][WPS][ESS] NXP
00:3a:99:68:be:f2 2462 -69 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] PHONE-WIFI
00:3a:9a:70:39:75 2462 -71 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-WIFI3
bc:96:80:35:41:b9 2412 -80 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] TCL9527
00:3a:9a:70:3e:64 2412 -53 [ESS] TCL-GUEST
00:3a:9a:70:39:71 2462 -70 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-INTERNAL
00:3a:99:68:be:f3 2462 -69 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] PHONE-WIFI2
00:3a:9a:70:39:73 2462 -71 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] PHONE-WIFI2
00:3a:99:68:be:f1 2462 -69 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-INTERNAL
bc:96:80:35:3d:4f 2412 -73 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] gybaidu
bc:96:80:35:40:b5 2412 -84 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] zeus
0c:82:68:49:e7:f5 2457 -88 [WPA2-PSK-CCMP][ESS] U3_49E7F5
00:3a:99:68:be:f4 2462 -70 [ESS] TCL-GUEST
00:3a:99:68:be:f5 2462 -69 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-WIFI3
00:3a:9a:70:3c:65 2412 -85 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS] TCL-WIFI3
8c:21:0a:d9:cc:28 2412 -85 [WPA-PSK-CCMP][WPA2-PSK-CCMP][WPS][ESS] APP3
bc:d1:77:07:c5:b5 2447 -88 [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][WPS][ESS] TP-LINK_07C5B5
06:34:cb:10:48:f2 2437 -67 [ESS] ChinaUnicom
>
------ok现在成功的执行!!!
最后
以上就是追寻白开水为你收集整理的Mtk WIFI常用调试命令的全部内容,希望文章能够帮你解决Mtk WIFI常用调试命令所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复