wpa_cli 与wpa_supplicant交互的命令行客户端。
wpa_cli [-p<path to ctrl sockets>][-i<ifname>] [-hvB] [-a<action file>] \
[-P<pid file>] [-g<global ctrl>] [-G<pinginterval>] [command..]
-h =help (show this usage text)
-v =shown version information
-a =run in daemon mode executing the action file based on events from
wpa_supplicant
-B =run a daemon in the background
default path: /data/system/wpa_supplicant
default interface: first interface found in socket path
wpa_cli 默认的启动命令 wpa_cli -iwlan0-p/data/system/wpa_supplicant
在mstar上的启动命令:
1. wpa_cli –iwlan0 –g wlan0
2. wpa_cli –iwlan0 –p/data/misc/wifi/sockets/wpa_ctrl_ 用此命令可以打开EVENT打印
(word表格弄不上来,后面怎么用这些指令的一栏没了,显示不出来~~~)
命令 | 命令缩写 | 描述 |
status | stat | 显示当前连接的状态信息 |
ping |
| 测试指令,看service端是否有响应 |
mib |
| Request a list of MIB variables (dot1x, dot11). |
interface |
| 显示当前可用的interface,wpa_supplicant 支持多interface |
set |
| 设置环境变量,如果不带参数,显示当前环境变量 |
logon |
| IEEE 802.1X EAPOL state machine logon |
logoff |
| IEEE 802.1X EAPOL state machine logff |
reassociate | reas | 设置连接标签,开启扫描,查找可用的AP进行连接,如果当前是连接状态,只会扫描一次。 |
preauthenticate | pr | 针对一个AP进行预认证 |
identity | id | 设置identity |
password |
| 设置密码 |
disconnect | disc | 断开连接,并且会告知wpa_supplicant 不在连接其他AP |
reconnect | reconn | 重新连接,在运行上面的过程后,运行此命令 |
quit | q | exits wpa_cli |
terminate | term | kills wpa_supplicant |
reconfigure | recon | 重新导入配置文件,可以在调试时,修改配置文件后运行此命令,使配置文件生效 |
scan | scan | 扫描 |
scan_result | scan_r | 显示扫描结果 |
bss |
| 获取扫描结果 某一个热点的具体信息 |
list_networks | list_n | 已经保存配置文件中的AP |
bssid |
| 配置ssid的bssid |
add_network | add_n | 添加一个AP配置,在framework还没调通之前,可以用此命令进行配置 |
set_network | set_n | 设置ap的属性,用set_network 不接参数,可以看到所有可用信息。 |
select_network | select_n | 选择一个已经配置的AP进行连接,这个命令用的比较多。上面set_n 命令进行配置后,可以用这命令进行连接 |
enable_network | enable_n | 将network 的标志位 disable 置0,该位为1时,wifi在断开连接状态,不会去主动连接该热点。如果wifi不主动连接任何热点,可以查看配置文件。 |
disable_network | disable_n | 对应上面 disable_network network_id |
remove_network | remove_n | 忘记网络 remove_network id 会删除对应network配置 |
get_network | get_n | 获取network的属性 对应之前的set_network |
wps_pbc |
| wps push button功能 |
wps_pin |
| Wps pin 功能 |
save_config | save_c | 保存信息到配置文件中,每次修改配置后记得用 |
|
wpa_cli命令如下表:
上面都是wpa_supplicant的一些基本命令,另外还有很多其他偏门命令需要继续研究。
另外还有启动p2p的调试命令:
p2p_find[timeout] [type=*] = find P2P Devices for up-to timeout seconds
p2p_stop_find = stop P2P Devices search
p2p_connect <addr> <"pbc"|PIN> = connect to a P2PDevices
p2p_listen [timeout] = listen for P2P Devices for up-to timeout seconds
p2p_group_remove <ifname> = remove P2P group interface (terminategroup if GO)
p2p_group_add = add a new P2P group (local end as GO)
p2p_prov_disc <addr> <method> = request provisioningdiscovery
p2p_get_passphrase = get the passphrase for a group (GO only)
p2p_serv_disc_req <addr> <TLVs> = schedule service discoveryrequest
p2p_serv_disc_cancel_req <id> = cancel pending service discoveryrequest
p2p_serv_disc_resp <freq> <addr> <dialog token><TLVs> = service discovery response
p2p_service_update = indicate change in local services
p2p_serv_disc_external <external> = set external processing ofservice discovery
p2p_service_flush = remove all stored service entries
p2p_service_add <bonjour|upnp> <query|version><response|service> = add a local service
p2p_service_del <bonjour|upnp> <query|version> [|service] =remove a local service
p2p_reject <addr> = reject connection attempts from a specificpeer
p2p_invite<cmd> [peer=addr] = invite peer
p2p_peers[discovered] = list known (optionally, only fully discovered) P2P peers
p2p_peer<address> = show information about known P2P peer
p2p_set<field> <value> = set a P2P parameter
p2p_flush= flush P2P state
p2p_cancel = cancel P2P group formation