关于wpa_supplicant:
用到wpa_cli命令
wpa_cli -iwlan0
add_network // wlan0 是无线网络设备的名字,增加一个网络,会返回一个数字,假设为1
set_network 1 ssid'"……"' //这里ssid是要连接的网络名,注意 后面是单引号+双引号
set_network 1 psk'"……"' //这里psk是密码
enable_network 1
select_network 1
save_config
dhclient -r wlan0
dhclient wlan0
//注意可能wlan0是down的状态,有时需要 ifconfig wlan0 up
或者/etc/init.d/networking restart
wpa_cli -iwlan0 scan
wpa_cli -iwlan0 scan_result
wpa_cli -iwlan0 status
sudo ifconfig wlan0 up
sudo ifconfig wlan0 192.168.1.126
应该能ping通局域网
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
wpa_supplicant.conf 可以在wpa_supplicant源码目录中找到:如下
ca wpa_supplicant
find -name *.conf ,不同的conf对用不同的加密方式
ps -aux |grep "wpa_supplicant"后会看到
/sbin/wpa_supplicant -B -P /run/sendsigs.omit.d/wpasupplicant.pid-u -s -O /var/run/wpa_supplicant
//wpa_wpa2.conf文件
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="网络名"
psk = "密码"
}
重启网络:/etc/init.d/networking restart
添加路由:route add default gw 192.168.1.1
添加DNS :/etc/resolv.confnameserver 192.168.1.1
sudo killall wpa_supplicant
会提示
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not usedanymore
执行sudo rm /ver/run/wpa_supplicant
就可以成功执行sudo wpa_supplicant -Dwext -iwlan0-c/wpa_wpa2.conf -B
不加 -B 会打印如下内容
<3>Trying to associate with bc:d1:77:f6:9f:26(SSID='xiaofengche' freq=2437 MHz)
<3>Associated with 00:00:00:00:00:00
<3>CTRL-EVENT-DISCONNECTED bssid=bc:d1:77:f6:9f:26reason=0
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>Trying to associate with bc:d1:77:f6:9f:26(SSID='xiaofengche' freq=2437 MHz)
<3>Associated with 00:00:00:00:00:00
<3>CTRL-EVENT-DISCONNECTED bssid=bc:d1:77:f6:9f:26reason=0
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE //
写错用户名 的反应 (fengche)
ioctl[SIOCSIWSCAN]: Device or resource busy
wlan0: Failed to initiate AP scan
ioctl[SIOCSIWSCAN]: Device or resource busy
wlan0: Failed to initiate AP scan
编译并安装无线驱动 //参考http://omappedia.com/wiki/Android_Mac80211
①WLAN Driver build instruction
cd $MYDROID/hardware/ti/wlan/mac80211/compat_wl18xx
export KLIB=/path/to/kernel
export KLIB_BUILD=/path/to/kernel
export ARCH=arm
exportCROSS_COMPILE=arm-none-linux-gnueabi-
make
②Target file system setup
cd $MYDROID/hardware/ti/wlan/mac80211/compat_wl12xx
cp ./compat/compat.ko $OUT/system/lib/modules/
cp ./net/wireless/cfg80211.ko $OUT/system/lib/modules/
cp ./net/mac80211/mac80211.ko $OUT/system/lib/modules/
cp ./drivers/net/wireless/wl12xx/wl12xx.ko$OUT/system/lib/modules/
cp ./drivers/net/wireless/wl12xx/wl12xx_sdio.ko$OUT/system/lib/modules/
③WLAN firmware
Firmware files go to following location on target filesystem.
/system/etc/firmware/ti-connectivity/
④WLAN Calibration Instruction
copy wl1271-nvs.bin from file system forback-up 底下会删除它
Follow the procedure below on target device tocalibrate Wi-Fi
mount -o remount rw /system
2) Remove old NVS file
rm/system/etc/firmware/ti-connectivity/wl1271-nvs.bin
3) Set the following parameters:
exportTARGET_FW_DIR=/system/etc/firmware/ti-connectivity
exportTARGET_NVS_FILE=$TARGET_FW_DIR/wl1271-nvs.bin
exportWL12xx_MODULE=/system/lib/modules/wl12xx_sdio.ko
exportTARGET_INI_FILE=/system/etc/wifi/TQS_S_2.6.ini
4) Execute Calibrator command
# calibrator plt autocalibrate []
# dev: Device name. i.e. wlan0
# module path: Full path to wl12xx_sdio.ko kernelmodule
# ini file: Full path to Radio param ini filei.e. TQS_S_2.6.ini in this case
# nvs file: Full path of nvs file. i.e.wl1271-nvs.bin. Must be the real path as wl12xx will load it
# mac addr: MAC address to program into the NVSfile [optional]
calibrator plt autocalibrate wlan0 $WL12xx_MODULE$TARGET_INI_FILE $TARGET_NVS_FILE
or
calibrator plt autocalibrate wlan0 $WL12xx_MODULE$TARGET_INI_FILE $TARGET_NVS_FILE 08:00:12:34:56:78
# su
# wilink7.sh