wpa_supplicant, wpa_cli用法

        Android系统中对于WIFI的设置集成到了“设置”中,其实跟手动设置差不多。这里介绍下如何手动连接WIFI,以方便以后调试WIFI。

        第一步要做的就是要加载WIFI模块驱动了。当然如果你的WIFI是编译到内核里面的,就不需要的。我们的WIFI芯片用的是BCM4330,编译为模块。

insmod /system/lib/modules/kernel/drivers/net/wireless/bcm4330/bcm4330.ko firmware_path=/system/vendor/firmware/bcm4330.bin \ nvram_path=/system/vendor/firmware/nvram.txt

       这样驱动模块加载后,需要启动wpa_supplicant

root@android:/ # wpa_supplicant -Dwext -iwlan0 -C/data/system/wpa_supplicant -c/data/misc/wifi/wpa_supplicant.conf &  

然后ps|grep wpa看看有没有起来,在wifi工作过程中,这个进程要始终都在的。

        接着启动客户端wpa_cli进行配置并连接wifi热点

130|root@android:/ # wpa_cli -p/data/system/wpa_supplicant -iwlan0
wpa_cli v0.8.x
Copyright (c) 2004-2011, Jouni Malinen <j@w1.fi> and contributors


This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.


Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.






Interactive mode



其中/data/system/wpa_supplicant 是刚刚启动wpa_supplicant的时候创建的一个套接字

接着进行搜索wifi

> scan
OK
<3>CTRL-EVENT-SCAN-RESULTS 

查看搜到的有哪些热点

> scan_result
bssid / frequency / signal level / flags / ssid
40:16:9f:67:0f:00       2462    -42     [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][WPS][ESS]       HHCN-NET
b0:48:7a:49:44:68       2437    -58     [WPA2-PSK-CCMP][WPS][ESS]       HHTech.Arch
e0:05:c5:97:d8:5a       241

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值