Created
May 19, 2015 09:25
-
-
Save gohilbhagirath90/f763afe9491c0f500e07 to your computer and use it in GitHub Desktop.
How to test WLAN function via command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When a PCB back from product line without LCD, how to test WIFI basic function? | |
We can usually use below commands in adb shell with root permission | |
//Check if wlan.ko was loaded | |
lsmod | |
//If not, please install it | |
insmod /system/lib/modules/wlan.ko | |
//Check if it correctly installed | |
lsmod | |
// For example, the message below indicates wlan driver is loaded successsfully | |
wlan 3820391 0 - Live 0x00000000 (O) | |
// copy wpa_supplicant.conf to /data/misc/wifi for testing purpose and change ownership of wpa_supplicant.conf to allow wpa_supplicant to read | |
cp /system/etc/wifi/wpa_supplicant.conf /data/misc/wifi/ | |
chown system:wifi /data/misc/wifi/wpa_supplicant.conf | |
//Enable wpa_supplicant | |
wpa_supplicant -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -O/data/misc/wifi/sockets -ddd & | |
//Use 'ps' command to check if wpa_supplicant is enabled successfully | |
ps wpa_supplicant | |
// For example, the message below indicates wpa_supplicant is enabled successfully | |
ps wpa_supplicant | |
USER PID PPID VSIZE RSS WCHAN PC NAME | |
wifi 3321 1 3436 1916 c0263cac b6ed3824 S wpa_supplicant | |
// Any failure, please check logcat for the reason | |
//Execute wpa_cli for scan and connection testing in adb shell | |
wpa_cli -i wlan0 -p /data/misc/wifi/sockets | |
//Scan the available APs nearby, use scan command in wpa_cli | |
> scan | |
//following message indicates scan is done | |
<3>CTRL-EVENT-SCAN-RESULTS | |
//Check scan results | |
> scan_results | |
//adb pull /data/misc/wifi/wpa_supplicant.conf and add the AP profile for association testing | |
//change ctrl_interface parameter to /data/misc/wifi | |
ctrl_interface=/data/misc/wifi/sockets | |
// For AP without security, add | |
network={ | |
# The ssid of the AP is AP_WITHOUT_SECURITY | |
ssid="AP_WITHOUT_SECURITY" | |
key_mgmt=NONE | |
} | |
// For AP using WEP security with passphrase 1234567890 and key index 1, add | |
network={ | |
ssid="AP_WEP_SECURITY" | |
key_mgmt=NONE | |
auth_alg=OPEN SHARED | |
wep_key0=1234567890 | |
} | |
//For AP using WPA-PSK/WPA2-PSK mixed mode, add | |
network={ | |
ssid="CH5_OPEN_TEST" | |
key_mgmt=WPA-PSK | |
psk="1234567890" | |
} | |
// adb push wpa_supplicant.conf back to /data/misc/wifi with new settings and enforce wpa_supplicant to read new configuration setting by executing "reconfigure" command in wpa_cli | |
> reconfigure | |
// wpa_supplicant would trigger auto connection to the APs set in wpa_supplicant.conf | |
//Following message indicates association is successfully made | |
<3>CTRL-EVENT-CONNECTED - Connection to ec:1a:59:8c:5d:88 completed (auth) [id=0 id_str=] | |
//Suppose the AP's IP address is 192.168.0.1, set the DUT's IP address to same network like 192.168.0.100 | |
ifconfig wlan0 192.168.0.100 | |
//Ping AP's address | |
ping 192.168.0.1 | |
//When test is done, remove temporarily created /data/misc/wifi/wpa_supplicant.conf | |
rm /data/misc/wifi/wpa_supplicant.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment