Interactive commands for WPA_CLI and wpa_supplicant

Source: Internet
Author: User

1) through the ADB command line, you can open the supplicant directly, thus running WPA_CLI, can solve the customer does not have the display and unable to operate the WiFi problem, but also to avoid the problem of the UI to driver. Further, it can be used in many Android terminal products without keyboard input and LCD output.

The wpa_supplicant contains two main executable tools: Wpa_supplicant and WPA_CLI. Wpa_supplicant is the core program, and its relationship with WPA_CLI is the relationship between service and client: Run Wpa_supplicant in the background, use WPA_CLI to search, set up, and connect to the network.

(2) A number of commands can be executed in WPA_CLI interactive mode, with the following list:

Full command

Short command

Description

Status

Stat

Displays the current connection status

Disconnect

Disc

Prevents Wpa_supplicant from connecting to an access point

Quit

Q

Exits WPA_CLI

Terminate

Term

Kills Wpa_supplicant

Reconfigure

Recon

Reloads wpa_supplicant with the configuration file supplied (-c parameter)

Scan

Scan

Scans for available access points (only scans it, doesn ' t display anything)

Scan_result

Scan_r

Displays the results of the last scan

List_networks

List_n

Displays a list of configured networks and their status (active or not, enabled or disabled)

Select_network

Select_n

Select a network among those defined to initiate a connection (ie Select_network 0)

Enable_network

Enable_n

Makes a configured network available for selection (ie enable_network 0)

Disable_network

Disable_n

Makes a configured network unavailable for selection (ie disable_network 0)

Remove_network

Remove_n

Removes a network and its configuration from the list (ie Remove_network 0)

Add_network

Add_n

Adds a new network to the list. Its ID'll be created automatically

Set_network

Set_n

Shows a very short list of available options to configure a network when supplied with no parameters.

See next sections for a list of extremely useful parameters to is used with Set_network and get_network.

Get_network

Get_n

Displays the required parameter for the specified network. See next sections for a list of parameters

Save_config

Save_c

Saves the configuration

(3) Platform Operation Example (MTK platform and root permission only)

A, first ensure that the ADB is connected, and can run ADB remount, so as to avoid system files read-only. Then set WPA_CLI and Wpa_supplicant to have strong permissions.

B, run echo 1 >/dev/wmtwifi to start the WiFi drive. But this can not be shown on the Android interface, the default is to start the WiFi module on Android, that is, the setting of WiFi in the default on.

C, enter the/system/bin directory, first run the service-side wpa_supplicant.

./wpa_supplicant-iwlan0-dnl80211-c/system/etc/wifi/wpa_supplicant.conf

The echo after normal startup is as follows:

A non-revenue state indicates that the server is already running (or possibly an input state, as long as the Wpa_cali can be connected on the line). The parameter meaning of-i-d-C can be queried directly in Help, some parameters may differ depending on the platform.

D, open an adb SHELL and run Wpa_cali on the client side. As follows:

Cd/system/bin

Wpa_cli-p/data/misc/wpa_supplicant

echo the following instructions are normal and in interactive mode:

E, execute a series of commands to see

Scan

Scan_results

F, even the WiFi command line, there are the following:

For APs that doesn ' t has encryption
>add_network (It would display a network ID for you, assume it returns 0)
>set_network 0 SSID "666"
>set_network 0 Key_mgmt NONE
>enable_network 0
>quit


For APS that have WEP
>add_network (assume returns 1)
>set_network 1 SSID "666"
>set_network 1 Key_mgmt NONE
>set_network 1 Wep_key0 "Your AP Passwork" (If usting ASCII, it need
Double quotation marks, if using hex, then don ' t need the double quotation
Marks
>set_network 1 Wep_tx_keyidx 0
>select_network 1 (optional, remember, if you is connecting with another
AP, should select it to disable the another)
>enable_network 1

For APS that have WPA-PSK/WPA2-PSK
>add_network (assume returns 2)
>set_network 2 SSID "666"
>set_network 2 PSK "Your pre-shared Key"
>select_network 2 (optional, remember, if you is connecting with another
AP, should select it to disable the another)
>enable_network 2

My own experimental diagram is as follows:

The above process shows that networking OK, you can surf the Internet.

Reference Original: http://cache.baiducontent.com/c?m= 9f65cb4a8c8507ed4fece7631046893b4c4380146d96864968d4e414c42246100024b8ed7a66471980853a3c50f11e41bca770216c5d61aa9bc98b4ad db9922b3bcd7a742613d51742c419de8a1c729f7e875a98ea42b3e1&p=8b2a975bcd8711a052eedb2f4a4c&newp= 8b2a971f81822dec08e29e7d495d92695c02dc3051dcd14f2895ff0b&user=baidu&fm=sc&query=adb+shell+wifi &qid=&p1=4

Reference Original: http://blog.sina.com.cn/s/blog_55465b470100l73l.html

Interactive commands for WPA_CLI and wpa_supplicant

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.