NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

WiLink8 WLAN Advanced Demos: Linux

From Texas Instruments Wiki
Jump to: navigation, search

Contents

Station Mode (alternative method, with iw commands, explained)[edit]

Connect to AP procedure - using IW commands
First of all, let's enable the wlan0 interface using ifconfig command:

ifconfig wlan0 up

You should see a result like:

wlcore: PHY firmware version: Rev 8.2.0.0.232
wlcore: firmware booted (Rev 8.9.0.0.48)

which means that the firmware is up and running.

Now let's scan the AP's around in order to connect the desired one. This is done by the iw command:

iw wlan0 scan | grep SSID

The expected results are a list of all available Access Points in ranges:

root@am335x-evm:~# iw wlan0 scan | grep SSID
        SSID: IOP_035
        SSID: Demo_24
        SSID: externalhotspot84
        SSID: algranati
        SSID: externalhotspot84
        SSID: mobilenet84
        SSID: uri
        SSID: CiscoZiv
        SSID: shlomiLinksys
        SSID: Harif

In order to connect to AP use the command "iw wlan0 connect <AP SSID>" In the example the SSID is algranati.

iw wlan0 connect algranati

In few (around 1-3) seconds, we should see the following print:

wlan0: authenticate with b8:a3:86:20:93:32
wlcore: is_sta: 1 old:0 new:1
wlan0: send auth to b8:a3:86:20:93:32 (try 1/3)
wlan0: authenticated
wlcore: is_sta: 1 old:1 new:2
wlan0: associate with b8:a3:86:20:93:32 (try 1/3)
wlan0: RX AssocResp from b8:a3:86:20:93:32 (capab=0xc01 status=0 aid=1)
wlcore: is_sta: 1 old:2 new:3
wlcore: is_sta: 1 old:3 new:4
wlcore: Association completed.
wlan0: associated
cfg80211: Calling CRDA for country: RU
cfg80211: Regulatory domain changed to country: RU
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 20000 KHz), (N/A, 3000 mBm)

We can check the connection by invoking:

iw wlan0 link

The expected result is something like:

Connected to b8:a3:86:20:93:32 (on wlan0)
        SSID: algranati
        freq: 2437
        RX: 1360 bytes (12 packets)
        TX: 122 bytes (2 packets)
        signal: -60 dBm
        tx bitrate: 1.0 MBit/s

        bss flags:      short-slot-time
        dtim period:    1
        beacon int:     100

which indicates that we are connected to the AP (algranati in the example).

Next step is to request IP address from the AP (using DHCP request)

udhcpc -i wlan0

The result of the above command would be:

udhcpc (v1.23.1) started
Sending discover...
Sending select for 192.168.1.4...
Lease of 192.168.1.4 obtained, lease time 172800
/etc/udhcpc.d/50default: Adding DNS 192.168.1.1

We can see that the obtained IP address above is 192.168.1.4.
Also the AP IP address is 192.168.1.1 (from "adding dns" line).


In order to verify the obtained IP address, use the command ifconfig and look at the inet addr field of wlan0 interface.

root@am335x-evm:~# ifconfig
eth0      Link encap:Ethernet  HWaddr C4:BE:84:CC:AC:A4
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:168

eth1      Link encap:Ethernet  HWaddr C4:BE:84:CC:AC:A6
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:120 errors:0 dropped:0 overruns:0 frame:0
          TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:191527 (187.0 KiB)  TX bytes:191527 (187.0 KiB)

wlan0     Link encap:Ethernet  HWaddr 78:A5:04:26:97:3D
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1240 (1.2 KiB)  TX bytes:1552 (1.5 KiB)


In order to verify the connection use the ping command
For example, the AP IP address is 192.168.1.1, we will invoke the following command on the EVM:

ping 192.168.1.1

We should see the an output like:

PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=1003.369 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=2.526 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=7.931 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=7.925 ms
64 bytes from 192.168.1.1: seq=4 ttl=64 time=7.968 ms
64 bytes from 192.168.1.1: seq=5 ttl=64 time=8.105 ms

AP configuration with WPA_Supplicant[edit]

WLAN Station Configuration Scenario[edit]

The following sections describe specific steps to configure station to connect to a WiFi network that supports arbitrary security modes.
The configuration commands can be executed using serial communication program connected to the platform's serial port.

Hardware Configuration[edit]

Wiki SecureAP.jpg


wpa_supplicant.conf[edit]

To be able to connect to a remote AP, wpa_supplicant daemon must run to provide WPA key negotiation with a WPA Authenticator and EAP authentication with Authentication Server.

root@am37x-evm:/usr/sbin# wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B

wpa_supplicant is daemon and only one instance of it may run on a machine, all other modifications of security settings are made with frontend application wpa_cli.

wpa_cli[edit]

wpa_cli is a text-based frontend program for interacting with wpa_supplicant. It is used to query current status, change configuration, trigger events, and request interactive user input.

Usage[edit]

wpa_cli < -i ifname > [ -hv ] [ command ... ]


-h prints help information
-v verbose output
-i ifname - interface name, which is usually wlan0
In all commands used in the above scripts first argument is the interface that is being configured (-iwlan0).

wpa_cli Commands[edit]

  • wpa_cli -iwlan0 disconnect
puts the interface into a disconnected state and waits for a reassociate command before connecting.
  • wpa_cli -iwlan0 add_network
adds and assigns an index number to a new network for the specified interface. All necessary configuration of the newly added network is done with set_network command.
  • wpa_cli -iwlan0 set_network 0 auth_alg OPEN
configures network with index 0: set OPEN authentication algorithm
  • wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
network #0 configuration: sets authenticated key management protocol for the network. WPA-EAP is WPA using EAP authentication (this can use an external program, e.g., Xsupplicant, for IEEE 802.1X EAP Authentication)
  • wpa_cli -iwlan0 set_network 0 psk '"12345678"'
network #0 configuration: sets WPA passphrase or pre-shared key to be used with the network
  • wpa_cli -iwlan0 set_network 0 wep_key0 ABCdef1234567890abcDEF3333
network #0 configuration: sets WEP key passphrase to be used by the network. WEP key is a security code which allows group of devices on a local network to exchange encoded messages with each other while hiding the contents of the messages from easy viewing by outsiders
  • wpa_cli -iwlan0 set_network 0 pairwise CCMP
network #0 configuration: sets CCMP algorithm as pairwise (unicast) cipher for WPA
  • wpa_cli -iwlan0 set_network 0 group CCMP
network #0 configuration: sets CCMP algorithm as group (broadcast/multicast) cipher for WPA
  • wpa_cli -iwlan0 set_network 0 proto WPA2
network #0 configuration: sets security protocol as WPA2
  • wpa_cli -iwlan0 set_network 0 eap PEAP
network #0 configuration: sets PEAP as extensible authentication protocol's (EAP) method
  • wpa_cli -iwlan0 set_network 0 identity '"test"'
network #0 configuration: sets identity string for EAP
  • wpa_cli -iwlan0 set_network 0 password '"test"'
network #0 configuration: sets password string for EAP
  • wpa_cli -iwlan0 set_network 0 phase1 '"peapver=0"'
network #0 configuration: sets outer authentication method version as PEAPv0
  • wpa_cli -iwlan0 set_network 0 phase2 '"MSCHAPV2"'
network #0 configuration: sets inner authentication method as EAP-MSCHAPv2
  • wpa_cli -iwlan0 set_network 0 mode 0
network #0 configuration: sets IEEE 802.11 operation mode as infrastructure (Managed) mode, i.e., associate with an AP
  • wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
network #0 configuration: sets network name
  • wpa_cli -iwlan0 select_network 0
selects network with index 0 and disables others
  • wpa_cli -iwlan0 enable_network 0
enables network with index 0
  • wpa_cli -iwlan0 reassociate
forces reassociation
  • wpa_cli -iwlan0 status
gets current WPA/EAPOL/EAP status
  • wpa_cli -iwlan0 list_networks
lists configured networks for the specified interface
  • wpa_cli -iwlan0 remove_network <ssid>
removes network with the specified SSID from the list of configured networks

Connect to non secured network[edit]

  • replace ssid value (i.e.

'"Bandipur"' ) with the SSID of a real wireless network you want to connect to.

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt NONE
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"Bandipur"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate

to verify connection status with the WPA supplicant command:

wpa_cli -iwlan0 status

or with the IW command:

iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.


Connect to secured network - WPA[edit]

  • make sure WPA supplicant is running -- that is "wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B" was called before (should be called only once)
  • replace “ssid” value with the SSID of a real wireless network you want to connect to.
  • replace pre-shared key argument (psk) with more appropriate one.
wpa_cli -iwlan0 disconnect
for i in `wpa_cli list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -iwlan0 set_network 0 psk '"12345678"'
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link


to verify connection status with the WPA supplicant command:

wpa_cli -iwlan0 status

or with the IW command:

iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.


Connect to secured network - WPA2[edit]

  • make sure WPA supplicant is running that is "wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B" was called before (should be called only once)
  • replace “ssid” value with the SSID of a real wireless network you want to connect to.
  • replace pre-shared key argument (psk) with more appropriate one.
wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -iwlan0 set_network 0 psk '"12345678"'
wpa_cli -iwlan0 set_network 0 proto RSN
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"Matterhorn"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link


to verify connection status with the WPA supplicant command:

wpa_cli -iwlan0 status

or with the IW command:

iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Connect to secured network - any WPA PSK[edit]

  • make sure WPA supplicant is running that is "wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B" was called before (should be called only once)
  • replace “ssid” value with the SSID of a real wireless network you want to connect to.
  • replace pre-shared key argument (psk) with more appropriate one.
wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -iwlan0 set_network 0 psk '"12345678"'
wpa_cli -iwlan0 set_network 0 pairwise CCMP TKIP
wpa_cli -iwlan0 set_network 0 group CCMP TKIP
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status


to verify connection status with the WPA supplicant command:

wpa_cli -iwlan0 status

or with the IW command:

iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Connect to secured network - WEP 40 Open[edit]

  • make sure WPA supplicant is running that is "wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B" was called before (should be called only once)
  • replace “ssid” value with the SSID of a real wireless network you want to connect to.
  • replace wep_key0 key argument value with the more appropriate one.
wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 wep_key0 1234567890
wpa_cli -iwlan0 set_network 0 key_mgmt NONE
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link


to verify connection status with the WPA supplicant command:

wpa_cli -iwlan0 status

or with the IW command:

iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Connect to secured network - WEP 128 Open[edit]

  • make sure WPA supplicant is running that is "wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B" was called before (should be called only once)
  • replace “ssid” value with the SSID of a real wireless network you want to connect to.
  • replace wep_key0 key argument value with the more appropriate one.
wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 wep_key0 ABCdef1234567890abcDEF3333
wpa_cli -iwlan0 set_network 0 key_mgmt NONE
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link


to verify connection status with the WPA supplicant command:

wpa_cli -iwlan0 status

or with the IW command:

iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Enterprise environment: connect to WPA EAP TLS[edit]

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
wpa_cli -iwlan0 set_network 0 pairwise TKIP
wpa_cli -iwlan0 set_network 0 group TKIP
wpa_cli -iwlan0 set_network 0 proto WPA
wpa_cli -iwlan0 set_network 0 eap TLS
wpa_cli -iwlan0 set_network 0 identity '"test"'
wpa_cli -iwlan0 set_network 0 client_cert '"/etc/certs/cert.pem"'
wpa_cli -iwlan0 set_network 0 private_key '"/etc/certs/key.pem"'
wpa_cli -iwlan0 set_network 0 private_key_passwd '"test"'
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Enterprise environment: connect to WPA EAP PEAP0[edit]

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
wpa_cli -iwlan0 set_network 0 pairwise TKIP
wpa_cli -iwlan0 set_network 0 group TKIP
wpa_cli -iwlan0 set_network 0 proto WPA
wpa_cli -iwlan0 set_network 0 eap PEAP
wpa_cli -iwlan0 set_network 0 identity "test"
wpa_cli -iwlan0 set_network 0 password "test"
wpa_cli -iwlan0 set_network 0 phase1 "peapver=0"
wpa_cli -iwlan0 set_network 0 phase2 "MSCHAPV2"
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Enterprise environment: connect to WPA2 EAP TLS[edit]

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 proactive_key_caching 1
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
wpa_cli -iwlan0 set_network 0 pairwise CCMP
wpa_cli -iwlan0 set_network 0 group CCMP
wpa_cli -iwlan0 set_network 0 proto WPA2
wpa_cli -iwlan0 set_network 0 eap TLS
wpa_cli -iwlan0 set_network 0 identity '"test"'
wpa_cli -iwlan0 set_network 0 client_cert '"/etc/certs/cert.pem"'
wpa_cli -iwlan0 set_network 0 private_key '"/etc/certs/key.pem"'
wpa_cli -iwlan0 set_network 0 private_key_passwd '"test"'
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Enterprise environment: connect to WPA EAP PEAP0[edit]

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
wpa_cli -iwlan0 set_network 0 pairwise CCMP
wpa_cli -iwlan0 set_network 0 group CCMP
wpa_cli -iwlan0 set_network 0 proto WPA2
wpa_cli -iwlan0 set_network 0 eap PEAP
wpa_cli -iwlan0 set_network 0 identity '"test"'
wpa_cli -iwlan0 set_network 0 password '"test"'
wpa_cli -iwlan0 set_network 0 phase1 '"peapver=0"'
wpa_cli -iwlan0 set_network 0 phase2 '"MSCHAPV2"'
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

Enterprise environment: connect to any WPA EAP TLS[edit]

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
#wpa_cli -iwlan0 set_network 0 pairwise CCMP TKIP
#wpa_cli -iwlan0 set_network 0 group CCMP TKIP
wpa_cli -iwlan0 set_network 0 proto WPA2
wpa_cli -iwlan0 set_network 0 eap TLS
wpa_cli -iwlan0 set_network 0 identity '"test"'
wpa_cli -iwlan0 set_network 0 client_cert '"/etc/certs/cert.pem"'
wpa_cli -iwlan0 set_network 0 private_key '"/etc/certs/key.pem"'
wpa_cli -iwlan0 set_network 0 private_key_passwd '"test"'
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link

NoteNote: For detailed information about each command, please refer to wpa_cli commands section.

2P advanced[edit]

P2P commands[edit]

The basics commands: Discovery, connection etc.

Command Description
p2p_find [timeout (seconds)] [type <social \ progressive>] Enables discovery – start sending probe request frames
p2p_stop_find Stops discovery, or whatever you are doing (listen mode, connection process etc.)
p2p_connect <device address> <PBC \ PIN> [GO_intent=<0-15> \ auth \ join] GO_intent – initiate connection to another device (using entered group intent)
Auth – WPS authorize incoming connection
Join – connect to an existing GO
No input – initiate connection using default GO intent
p2p_listen [timeout (seconds)] Enable listen mode
p2p_group_remove <interface> Remove device from group, return to device mode if acting as GO or autonomous GO
p2p_group_add Become an autonomous GO


Managing discovered peers: Using the discovered peers list

Command Description
p2p_peers [discovered] Shows list of discovered peers (with ‘discovered’ – shows only fully discovered peers)
p2p_peer <address> Show detailed information about discovered peers
p2p_flush Flush p2p_state, and clears the discovered peer list


GO WPS authorizations:When devices try to connect to GOUT

Command Description
wps_pbc pushbutton to accept incoming connections
wps_pin <PIN> <UUID> Enable WPS enrollee PIN


Others

Command Description
p2p_prov_disc <address> <method> Request provision discovery
p2p_serv_disc_req <addr> <TLVs> Send service discovery request
p2p_serv_disc_cancel_req <id> Cancel service discovery request
p2p_serv_disc_resp <freq> <addr> <dialog token> <TLVs> Service discovery response
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_invite <cmd> [address] Send invitation to device
Reconfigure Wpa_supplicant will re-read configuration file
Ping Ping wpa_supplicant (only)




Create Autonomous 1:2 P2P Group (Push button Control)[edit]

Autonomous P2P Group is a group were the Group Owners may be determined
Wiki P2PGroup.jpg

The Flow of commands in that usecase is as follows:

Step # EVM #1 EVM #2 Comments
1 Run: p2p_start.sh Run: p2p_start.sh cd /usr/share/wl18xx/
./p2p_start.sh
2 Run: p2p_cli.sh Run: p2p_cli.sh ./p2p_cli.sh
3 p2p_find p2p_find
4 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
5 p2p_group_add define EVM#1 as Group Owner (GO)
6 Exit wpa_cli on EVM#1 type: quit
7 Re-enter wpa_cli using the newly created 'p2p-wlan0-0' interface wpa_cli -ip2p-wlan0-0
8 wps_pbc Work in Push Button mode
9 p2p_connect EVM#1_MAC_ADDRESS pbc join
10 exit wpa_cli exit wpa_cli type: quit
11 Acquire IP address for p2p-wlan0-0 Acquire IP address for p2p-wlan0-0 EVM#1: ifconfig p2p-wlan0-0 192.168.3.3
EVM#2: ifconfig p2p-wlan0-0 192.168.3.4
12 Verify connection with ping EVM#1: ping 192.168.3.4
EVM#2: ping 192.168.3.3


In order to configure the IP address to the Group Owner (GO) and the Clients there are 2 methods:

  1. Static IP (Described above)
  2. Enable the DHCP server at the GO EVM, which will provide IP address to the clients using DHCP session (Explained below).


DHCP method[edit]

At the Group Owver EVM Run the following:

  • Configure the udhcpd configuration file
  • Run the dhcp server
  • Define the iptables to enable the NAT (Network Address Translation)


Configuring udhcpd.conf

First, we will back up the existing udhcpd.conf file by invoking:

mv /etc/udhcpd.conf /etc/udhcpd.conf.bak

Create a new udhcpd.conf with the following content:

# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 		192.168.0.20	#default: 192.168.0.20
end		192.168.0.254	#default: 192.168.0.254
# The interface that udhcpd will use
interface   p2p-wlan0-0		#default: eth0
#Examles
opt	dns	8.8.8.8  8.8.4.4 # public google dns servers
option	subnet	255.255.255.0
opt	router	192.168.0.1
option	lease	864000		# 10 days of

The editing above can be done by vi editor as follows:

  1. vi /etc/udhcpd.conf
  2. The editor will be opened. Type the character 'i' to switch to editing mode.
  3. Copy and paste the above content into the editor.
  4. Hit 'esc' button to stop editing.
  5. Type the sequence ":wq" in order to save and quit.


After establishing the connection, run the following

  • Enable IPv4 forwarding
  • Assign IP address
  • Start udhcpd to operate the DHCP Server
  • Define the iptables to enable the NAT (Network Address Translation)

The commands to do the above, are:

root@am335x-evm:~# echo 1 > /proc/sys/net/ipv4/ip_forward
root@am335x-evm:~# ifconfig p2p-wlan0-0 192.168.0.1
root@am335x-evm:~# udhcpd /etc/udhcpd.conf
root@am335x-evm:~#

Note:- The IP address assigned for 'p2p-wlan0-0' interface (ifconfig p2p-wlan0-0 192.168.0.1) should match the "router" field IP in the udhcpd.conf file we edited above.

At the Client side
To get IP address using DHCP procedure run the following:

root@am335x-evm:~# udhcpc -i p2p-wlan0-0
udhcpc (v1.20.2) started
Sending discover...
Sending select for 192.168.0.20...
Lease of 192.168.0.20 obtained, lease time 864000
/etc/udhcpc.d/50default: Adding DNS 8.8.8.8
/etc/udhcpc.d/50default: Adding DNS 8.8.4.4
root@am335x-evm:~#

The below table illustrates the use case.

Step # EVM #1 EVM #2 Comments
1 Run: p2p_start.sh Run: p2p_start.sh cd /usr/share/wl18xx/
./p2p_start.sh
2 Run: p2p_cli.sh Run: p2p_cli.sh ./p2p_cli.sh
3 p2p_find p2p_find
4 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
5 p2p_group_add define EVM#1 as Group Owner (GO)
6 Exit wpa_cli on EVM#1 type: quit
7 Re-enter wpa_cli using the newly created 'p2p-wlan0-0' interface wpa_cli -ip2p-wlan0-0
8 wps_pbc Work in Push Button mode
9 p2p_connect EVM#1_MAC_ADDRESS pbc join
10 Exit wpa_cli exit wpa_cli type: quit
11 echo 1 > /proc/sys/net/ipv4/ip_forward Enable IP Forwarding
12 ifconfig p2p-wlan0-0 192.168.0.1 Acquire IP for p2p-wlan0-0 on EVM#1 (Must be same as the router field in the DHCP Configuration file
13 udhcpd /etc/udhcpd.conf Start the DHCP Server
14 udhcpc -i p2p-wlan0-0 Start DHCP Client on EVM#2
15 Verify connection with ping



Create 1:2 P2P Group - Connect with PIN code[edit]


Wiki P2PGroup.jpg
The Flow of commands in that use case is as follows:
comment: in that case we call the commands with wpa_cli before, instead of entering the wpa_cli menu first.

Step # EVM #1 EVM #2 Comments
1 Run: p2p_start.sh Run: p2p_start.sh cd /usr/share/wl18xx/
./p2p_start.sh
2 Run: p2p_cli.sh Run: p2p_cli.sh ./p2p_cli.sh
3 p2p_find p2p_find use wpa_cli prefix to run wpa cli commands (instead of entering wpa_cli utility)
4 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
5 p2p_connect EVM#2_MAC_ADDRESS pin That command will print EVM#1 PIN-code in the follwoing line to that command
6 p2p_connect EVM#2_MAC_ADDRESS EVM#1_PIN_CODE getting EVM#1_PIN_CODE from previous EVM#1 command
7 Define IP Address Define IP Address EVM#1: ifconfig p2p-wlan0-0 192.168.3.3
EVM#2: ifconfig p2p-wlan0-0 192.168.3.4
8 Verify connection using ping EVM#1: ping 192.168.3.4
EVM#2: ping 192.168.3.3

EVM #1

root@am437x-evm:/usr/share/wl18xx# ./p2p_cli.sh
wpa_cli v2.5-devel
Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.



Interactive mode

> p2p_find
OK
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
> P2P-DEVICE-FOUND 54:4a:16:3a:c6:29 p2p_dev_addr=54:4a:16:3a:c6:29 pri_dev_type=0-00000000-0 name='Sitara' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1
<3>P2P-DEVICE-FOUND 54:4a:16:3a:c6:29 p2p_dev_addr=54:4a:16:3a:c6:29 pri_dev_type=0-00000000-0 name='Sitara' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
> p2p_stop_find
P2P-FIND-STOPPED
OK
<3>P2P-FIND-STOPPED

EVM #2

> p2p_find
OK
<3>CTRL-EVENT-SCAN-STARTED
> P2P-DEVICE-FOUND 78:a5:04:26:97:3e p2p_dev_addr=78:a5:04:26:97:3e pri_dev_type=0-00000000-0 name='Sitara' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1
<3>P2P-DEVICE-FOUND 78:a5:04:26:97:3e p2p_dev_addr=78:a5:04:26:97:3e pri_dev_type=0-00000000-0 name='Sitara' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
> p2p_stop_find
P2P-FIND-STOPPED
OK
<3>P2P-FIND-STOPPED
> p2p_peers
78:a5:04:26:97:3e

EVM #1

> p2p_peers
54:4a:16:3a:c6:29


EVM#1 defines the EVM#2 MAC Address in the connection commands, and as a response to that command we get the EVM#1 Pin-Code (in the below example it is 04194996)

> p2p_connect 54:4a:16:3a:c6:29 pin
04194996


EVM #2
EVM#2 attempt to connect EVM#1 with EVM#1 MAC Address and Pin-Code

> p2p_connect 78:a5:04:26:97:3e 04194996
OK
> P2P-GO-NEG-SUCCESS role=client freq=5745 ht40=1 peer_dev=78:a5:04:26:97:3e peer_iface=7a:a5:04:26:97:3d wps_method=Keypad
<3>P2P-GO-NEG-SUCCESS role=client freq=5745 ht40=1 peer_dev=78:a5[ 1954.766093] IPv6: ADDRCONF(NETDEV_UP): p2p-wlan0-0: link is not ready
:04:26:97:3e peer_iface=7a:a5:04:26:97:3d wps_method=Keypad
> rfkill: Cannot open RFKILL control device
<3>CTRL-EVENT-SCAN-RESULTS
<3>CTRL-EVENT-SCAN-RESULTS
> p2p-wlan0-0: SME: Trying to authenticate with 7a:a5:04:26:97:3d [ 1955.517183] p2p-wlan0-0: authenticate with 7a:a5:04:26:97:3d
(SSID='DIRECT-Ka' freq=5745 MHz)
[ 1955.534399] p2p-wlan0-0: send auth to 7a:a5:04:26:97:3d (try 1/3)
[ 1955.602583] p2p-wlan0-0: authenticated
p2p-wlan0-0: Trying to associate with 7a:a5:04:26:97:3d (SSID='DIRECT-Ka' freq=5745 MHz)
[ 1955.613139] p2p-wlan0-0: associate with 7a:a5:04:26:97:3d (try 1/3)
[ 1955.643432] p2p-wlan0-0: RX AssocResp from 7a:a5:04:26:97:3d (capab=0x11 status=0 aid=1)
[ 1955.665736] IPv6: ADDRCONF(NETDEV_CHANGE): p2p-wlan0-0: link becomes ready
[ 1955.672755] p2p-wlan0-0: associated
p2p-wlan0-0: Associated with 7a:a5:04:26:97:3d
p2p-wlan0-0: CTRL-EVENT-EAP-STARTED EAP authentication started
p2p-wlan0-0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=1
p2p-wlan0-0: CTRL-EVENT-EAP-METHOD EAP vendor 14122 method 1 (WSC) selected
p2p-wlan0-0: WPS-CRED-RECEIVED
p2p-wlan0-0: WPS-SUCCESS
P2P-GROUP-FORMATION-SUCCESS
<3>P2P-GROUP-FORMATION-SUCCESS
> p2p-wlan0-0: CTRL-EVENT-EAP-FAILURE EAP authentication failed[ 1956.259741] p2p-wlan0-0: deauthenticating from 7a:a5:04:26:97:3d by local choice (Reason: 3=DEAUTH_LEAVING)

[ 1956.314091] cfg80211: Calling CRDA to update world regulatory domain
p2p-wlan0-0: CTRL-EVENT-DISCONNECTED bssid=7a:a5:04:26:97:3d reason=3 locally_generated=1
p2p-wlan0-0: SME: Trying to authenticate with 7a:a5:04:26:97:3d [ 1956.338506] p2p-wlan0-0: authenticate with 7a:a5:04:26:97:3d
(SSID='DIRECT-Ka' freq=5745 MHz)
[ 1956.366373] p2p-wlan0-0: send auth to 7a:a5:04:26:97:3d (try 1/3)
[ 1956.523895] p2p-wlan0-0: authenticated
p2p-wlan0-0: Trying to associate with 7a:a5:04:26:97:3d (SSID='D[ 1956.528187] cfg80211: World regulatory domain updated:
IRECT-Ka' freq=5745 MHz)
[ 1956.539313] cfg80211:  DFS Master region: unset
[ 1956.545556] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 1956.555800] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 1956.564298] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 1956.572350] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 1956.580685] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 1956.590251] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 1956.600097] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 1956.608334] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 1956.616665] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 1956.624925] cfg80211: Calling CRDA for country: US
p2p-wlan0-0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
[ 1956.642652] p2p-wlan0-0: associate with 7a:a5:04:26:97:3d (try 1/3)
[ 1956.667467] p2p-wlan0-0: RX AssocResp from 7a:a5:04:26:97:3d (capab=0x11 status=0 aid=1)
[ 1956.768148] cfg80211: Regulatory domain changed to country: US
[ 1956.774906] cfg80211:  DFS Master region: FCC
[ 1956.779752] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 1956.790725] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[ 1956.800254] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[ 1956.810834] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[ 1956.821088] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[ 1956.830259] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
p2p-wlan0-0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=US
[ 1956.847737] p2p-wlan0-0: associated
p2p-wlan0-0: Associated with 7a:a5:04:26:97:3d
p2p-wlan0-0: WPA: Key negotiation completed with 7a:a5:04:26:97:[ 1956.867484] wlcore: Association completed.
3d [PTK=CCMP GTK=CCMP]
p2p-wlan0-0: CTRL-EVENT-CONNECTED - Connection to 7a:a5:04:26:97:3d completed [id=0 id_str=]
<3>P2P-GROUP-STARTED p2p-wlan0-0 client ssid="DIRECT-Ka" freq=5745 psk=b7e653e4fef3ddc385497ea2df892b3c520c438cc763e91064bc1d92b6fcf37c go_dev_addr=78:a5:04:26:97:3e
> P2P-GROUP-STARTED p2p-wlan0-0 client ssid="DIRECT-Ka" freq=5745 go_dev_addr=78:a5:04:26:97:3e

The EVM #1 will display the below:

> P2P-GO-NEG-SUCCESS role=GO freq=5745 ht40=1 peer_dev=54:4a:16:3a:c6:29 peer_iface=56:4a:16:3a:c6:28 wps_method=Display
<3>P2P-GO-NEG-SUCCESS role=GO freq=5745 ht40=1 peer_dev=54:4a:16:3a:c6:29 peer_iface=56:4a:16:3a:c6:28 wps_method=Display
> rfkill: Cannot open RFKILL control device
[ 1966.108421] IPv6: ADDRCONF(NETDEV_UP): p2p-wlan0-0: link is not ready
[ 1966.265558] wlcore: down
p2p-wlan0-0: interface state UNINITIALIZED->HT_SCAN
Using interface p2p-wlan0-0 with hwaddr 7a:a5:04:26:97:3d and ssid "DIRECT-Ka"
[ 1966.524889] IPv6: ADDRCONF(NETDEV_CHANGE): p2p-wlan0-0: link becomes ready
p2p-wlan0-0: interface state HT_SCAN->ENABLED
p2p-wlan0-0: AP-ENABLED
p2p-wlan0-0: CTRL-EVENT-CONNECTED - Connection to 7a:a5:04:26:97:3d completed [id=0 id_str=]
<3>CTRL-EVENT-SCAN-RESULTS
> p2p-wlan0-0: CTRL-EVENT-EAP-STARTED 56:4a:16:3a:c6:28
p2p-wlan0-0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
p2p-wlan0-0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
p2p-wlan0-0: WPS-REG-SUCCESS 56:4a:16:3a:c6:28 78efc791-3214-54b1-8c7e-5be0d1f274e2
P2P-GROUP-FORMATION-SUCCESS
<3>P2P-GROUP-FORMATION-SUCCESS
<3>P2P-GROUP-STARTED p2p-wlan0-0 GO ssid="DIRECT-Ka" freq=5745 passphrase="VRtsc4Nz" go_dev_addr=78:a5:04:26:97:3e
> P2P-GROUP-STARTED p2p-wlan0-0 GO ssid="DIRECT-Ka" freq=5745 go_dev_addr=78:a5:04:26:97:3e
p2p-wlan0-0: WPS-SUCCESS
p2p-wlan0-0: CTRL-EVENT-EAP-FAILURE 56:4a:16:3a:c6:28
p2p-wlan0-0: AP-STA-CONNECTED 56:4a:16:3a:c6:28 p2p_dev_addr=54:4a:16:3a:c6:29
AP-STA-CONNECTED 56:4a:16:3a:c6:28 p2p_dev_addr=54:4a:16:3a:c6:29
<3>AP-STA-CONNECTED 56:4a:16:3a:c6:28 p2p_dev_addr=54:4a:16:3a:c6:29

Exit the wpa supplicant CLI by hitting "q"

>
> q

Assign ip address to "p2p-wlan0-0" interface on both EVMs.

EVM #1

root@am437x-evm:/usr/share/wl18xx# ifconfig p2p-wlan0-0 192.168.3.3
root@am437x-evm:/usr/share/wl18xx# ifconfig -a
eth0      Link encap:Ethernet  HWaddr C4:BE:84:CC:AC:A4
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:168

eth1      Link encap:Ethernet  HWaddr C4:BE:84:CC:AC:A6
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:119 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:191475 (186.9 KiB)  TX bytes:191475 (186.9 KiB)

p2p-wlan0-0 Link encap:Ethernet  HWaddr 7A:A5:04:26:97:3D
          inet addr:192.168.3.3  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::78a5:4ff:fe26:973d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:2 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1253 (1.2 KiB)  TX bytes:2503 (2.4 KiB)

wlan0     Link encap:Ethernet  HWaddr 78:A5:04:26:97:3D
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

EVM #2

root@am335x-evm:/usr/share/wl18xx# ifconfig p2p-wlan0-0 192.168.3.4
root@am335x-evm:/usr/share/wl18xx#
root@am335x-evm:/usr/share/wl18xx# ifconfig -a
eth0      Link encap:Ethernet  HWaddr C8:A0:30:AD:12:B4
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:171

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:700 (700.0 B)  TX bytes:700 (700.0 B)

p2p-wlan0-0 Link encap:Ethernet  HWaddr 56:4A:16:3A:C6:28
          inet addr:192.168.3.4  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::544a:16ff:fe3a:c628/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1511 (1.4 KiB)  TX bytes:1903 (1.8 KiB)

wlan0     Link encap:Ethernet  HWaddr 54:4A:16:3A:C6:28
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

3. Use ping command to verify connection

EVM #1

root@am437x-evm:/usr/share/wl18xx# ping 192.168.3.4
PING 192.168.3.4 (192.168.3.4): 56 data bytes
64 bytes from 192.168.3.4: seq=0 ttl=64 time=1384.869 ms
64 bytes from 192.168.3.4: seq=1 ttl=64 time=383.960 ms
64 bytes from 192.168.3.4: seq=2 ttl=64 time=97.437 ms
64 bytes from 192.168.3.4: seq=3 ttl=64 time=122.172 ms
64 bytes from 192.168.3.4: seq=4 ttl=64 time=143.612 ms
64 bytes from 192.168.3.4: seq=5 ttl=64 time=167.164 ms
64 bytes from 192.168.3.4: seq=6 ttl=64 time=190.454 ms

--- 192.168.3.4 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 97.437/355.666/1384.869 ms

EVM #2

root@am335x-evm:/usr/share/wl18xx# ping 192.168.3.3
PING 192.168.3.3 (192.168.3.3): 56 data bytes
64 bytes from 192.168.3.3: seq=0 ttl=64 time=11.911 ms
64 bytes from 192.168.3.3: seq=1 ttl=64 time=1115.697 ms
64 bytes from 192.168.3.3: seq=2 ttl=64 time=115.208 ms
64 bytes from 192.168.3.3: seq=3 ttl=64 time=9.148 ms
64 bytes from 192.168.3.3: seq=4 ttl=64 time=9.084 ms
64 bytes from 192.168.3.3: seq=5 ttl=64 time=11.548 ms
64 bytes from 192.168.3.3: seq=6 ttl=64 time=9.405 ms

--- 192.168.3.3 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 9.084/183.143/1115.697 ms


P2P Invitation Procedure - Create Autonomous 1:2 P2P Group, (Push button Control)[edit]

  1. P2P Invitation Request frame is transmitted by a P2P Group Owner or a P2P Client in that P2P Group
  2. Upon receiving the P2P Invitation Request, a P2P Device that supports the P2P Invitation Procedure signaling mechanism transmits a P2P Invitation Response frame
  3. The decision to accept the invitation is left to the invited P2P Device


Wiki P2PGroup.jpg

The Flow of commands shows a case where the EVM#1 is the GO and invites EVM#2:

Step # EVM #1 EVM #2 Comments
1 Run: p2p_start.sh Run: p2p_start.sh cd /usr/share/wl18xx/
./p2p_start.sh
2 Run: p2p_cli.sh Run: p2p_cli.sh ./p2p_cli.sh
3 p2p_group_add freq=2412
4 exit wpa_cli ( on EVM#1) type: quit
5 Reenter wpa_cli using the newly created p2p-wlan0-0 interface on EVM#1 wpa_cli -ip2p-wlan0-0
6 wps_pbc
7 wait after the remote "p2p_find"
8 p2p_find
9 p2p_invite group=p2p-wlan0-0 peer=EVM#2_MAC_ADDRESS
10 p2p_connect EVM#1_MAC_ADDRESS pbc join
11 exit wpa_cli exit wpa_cli type: quit
12 Acquire IP address for p2p-wlan0-0 Acquire IP address for p2p-wlan0-0 EVM#1: ifconfig p2p-wlan0-0 192.168.3.3
EVM#2: ifconfig p2p-wlan0-0 192.168.3.4
13 Verify connection with ping EVM#1: ping 192.168.3.4
EVM#2: ping 192.168.3.3



Detailed information[edit]

p2p_find[edit]

Starts P2P device discovery. An optional parameter can be used to specify the duration for the discovery in seconds (e.g., "P2P_FIND 5"). If the duration is not specified, discovery will be started for an indefinite time, i.e., until it is terminated by P2P_STOP_FIND or P2P_CONNECT (to start group formation with a discovered peer). The default search type is to first run a full scan of all channels and then continue scanning only social channels (1, 6, 11). This behavior can be changed by specifying a different search type: social (e.g., "P2P_FIND 5 type=social") will skip the initial full scan and only search social channels; progressive (e.g., "P2P_FIND type=progressive") starts with a full scan and then searches progressively through all channels one channel at the time with the social channel scans. Progressive device discovery can be used to find new groups (and groups that were not found during the initial scan, e.g., due to the GO being asleep) over time without adding considerable extra delay for every Search state round.

p2p_connect[edit]

Starts P2P group formation with a discovered P2P peer. This includes group owner negotiation, group interface setup, provisioning, and establishing data connection.

P2P_CONNECT <peer device address> <pbc|pin|PIN#> [label|display|keypad] [persistent] [join|auth] [go_intent=<0..15>] [freq=<in MHz>]

  • The <pbc|pin|PIN#> parameter specifies the WPS provisioning method.
  • "pbc" string starts pushbutton method
  • "pin" string starts PIN method using an automatically generated PIN (which will be returned as the command return code)
  • "PIN#" means that a pre-selected PIN can be used (e.g., 12345670).
  • [label|display|keypad] is used with PIN method to specify which PIN is used
  • "label" = PIN from local label
  • "display" = dynamically generated random PIN from local display
  • "keypad" = PIN entered from peer device label or display).
  • "persistent" parameter can be used to request a persistent group to be formed.
  • "join" indicates that this is a command to join an existing group as a client. It skips the GO Negotiation part.
  • "auth" indicates that the WPS parameters are authorized for the peer device without actually starting GO Negotiation (i.e., the peer is expected to initiate GO Negotiation). This is mainly for testing purposes.
  • The optional "go_intent" parameter can be used to override the default GO Intent value.


p2p_listen[edit]

Start Listen-only state. An optional parameter can be used to specify the duration for the Listen operation in seconds. This command may not be of that much use during normal operations and is mainly used for testing. It can also be used to keep the device discoverable without having to maintain a group.

p2p_group_add[edit]

Set up a P2P group owner manually (i.e., without group owner negotiation with a specific peer). This is also known as autonomous GO.

P2P_GROUP_ADD [persistent] [freq=<in MHz>]

  • Optional "persistent" = <network id> can be used to specify restart of a persistent group.
  • Optional "freq" is channel frequency in MHz for the group.


p2p_group_remove[edit]

Terminate a P2P group. If a new virtual network interface was used for the group, it will also be removed. The network interface name of the group interface is used as a parameter for this command.

P2P_GROUP_REMOVE <ifname>

  • <ifname> is network interface name of the group interface or "*" to remove all.


p2p_peer[edit]

Fetch information about a discovered peer. Show information about known P2P peer(s).

P2P_PEER [addr] [FIRST] [NEXT-<P2P Device Address>]

This command takes in an argument specifying which peer to select: P2P Device Address of the peer, "FIRST" to indicate the first peer in the list, or "NEXT-<P2P Device Address>" to indicate the entry following the specified peer (to allow for iterating through the list).

p2p_invite[edit]

Invite a peer to join a group or to (re)start a persistent group. P2P_INVITE <cmd> [peer=addr]
<cmd> format is: <persistent=id> [peer=addr] to restart persistent group where id is a unique network identifier <group= > <peer=addr> [go_dev_addr=addr] to invite peer to join an active group

P2P EVENTS[edit]

Following events can be received from wpa_supplicant via control interface. The events are specified in hostap/src/common/wpa_ctrl.h

P2P_EVENT_DEVICE_FOUND[edit]

Indication of a discovered P2P device with information about that device. For example:
P2P-DEVICE-FOUND 02:b5:64:63:30:63 p2p_dev_addr=02:b5:64:63:30:63 pri_dev_type=1-0050f204-1 name='Wireless Client' config_methods=0x84 dev_capab=0x21 group_capab=0x0

P2P_EVENT_GO_NEG_REQUEST[edit]

A P2P device requested GO negotiation, but we were not ready to start the negotiation. For example:
P2P-GO-NEG-REQUEST 02:40:61:c2:f3:b7 dev_passwd_id=4

P2P_EVENT_GO_NEG_SUCCESS[edit]

Indication of successfully complete group owner negotiation. P2P-GO-NEG-SUCCESS

P2P_EVENT_GO_NEG_FAILURE[edit]

Indication of failed group owner negotiation. Additional parameter is status.
P2P-GO-NEG-FAILURE status=1

P2P_EVENT_GROUP_FORMATION_SUCCESS[edit]

Indication that P2P group formation has been completed successfully.
P2P-GROUP-FORMATION-SUCCESS

P2P_EVENT_GROUP_FORMATION_FAILURE[edit]

Indication that P2P group formation failed (e.g., due to provisioning failure or timeout).
P2P-GROUP-FORMATION-FAILURE

P2P_EVENT_GROUP_STARTED=[edit]

Indication of a new P2P group having been started. Additional parameters: network interface name for the group, role (GO/client), SSID, frequency. The passphrase used in the group is also indicated here if known (on GO) or PSK (on client). If the group is a persistent one, a flag indicating that is included. For example:
P2P-GROUP-STARTED p2p0-p2p-0 GO ssid="DIRECT-3F Testing" freq=2412 passphrase="12345678" go_dev_addr=02:40:61:c2:f3:b7 [PERSISTENT]

P2P_EVENT_GROUP_REMOVED[edit]

Indication of a P2P group having been removed. Additional parameters: network interface name for the group, role (GO/client). For example:
P2P-GROUP-REMOVED p2p0-p2p-0 GO

P2P_EVENT_CROSS_CONNECT_ENABLE[edit]

Indication of allowing of P2P cross connection with uplink network interface. Additional parameters: network interface name for the group, cross connect uplink network interface name. For example:
P2P-CROSS-CONNECT-ENABLE p2p0-p2p-0 wan0

P2P_EVENT_CROSS_CONNECT_DISABLE[edit]

Indication of disabling of P2P cross-connection with uplink network interface. Additional parameters: network interface name for the group, cross connect uplink network interface name. For example:
P2P-CROSS-CONNECT- DISABLE p2p0-p2p-0 wan0

P2P_EVENT_PROV_DISC_SHOW_PIN[edit]

Request from the peer for local p2p device to display a PIN that will be entered on the peer. The following parameters are included after the event prefix: peer_address, PIN. The PIN is a random PIN generated for this connection. P2P_CONNECT command can be used to accept the request with the same PIN configured for the connection. For example:
P2P-PROV-DISC-SHOW-PIN 02:40:61:c2:f3:b7 12345670 p2p_dev_addr=02:40:61:c2:f3:b7 pri_dev_type=1-0050F204-1 name='Test' config_methods=0x188 dev_capab=0x21 group_capab=0x0

P2P_EVENT_PROV_DISC_ENTER_PIN[edit]

Request from the peer for local p2p device to enter a PIN displayed on the peer. The following parameter is included after the event prefix: peer address, device type, name and capabilities. For example:
P2P-PROV-DISC-ENTER-PIN 02:40:61:c2:f3:b7 p2p_dev_addr=02:40:61:c2:f3:b7 pri_dev_type=1-0050F204-1 name='Test' config_methods=0x188 dev_capab=0x21 group_capab=0x0

P2P_EVENT_PROV_DISC_PBC_REQ[edit]

Request from the peer for local p2p device to connect using PBC. The following parameters are included after the event prefix: peer_address, device type, name and capabilities. P2P_CONNECT command can be used to accept the request.
For example:
P2P-PROV-DISC-PBC-REQ 02:40:61:c2:f3:b7 p2p_dev_addr=02:40:61:c2:f3:b7 pri_dev_type=1-0050F204-1 name='Test' config_methods=0x188 dev_capab=0x21 group_capab=0x0

P2P_EVENT_PROV_DISC_PBC_RESP[edit]

The peer accepted our provision discovery request to connect using PBC. The following parameters are included after the event prefix: peer_address. P2P_CONNECT command can be used to start GO Negotiation after this. For example:
P2P-PROV-DISC-PBC-RESP 02:40:61:c2:f3:b7

P2P_EVENT_SERV_DISC_REQ[edit]

Indicate reception of a P2P service discovery request. The following parameters are included after the event prefix: frequency in MHz, source address, dialog token, service update indicator, Service Query TLV(s) as hexdump. For example:
P2P-SERV-DISC-REQ 2412 02:40:61:c2:f3:b7 0 0 02000001

P2P_EVENT_SERV_DISC_RESP[edit]

Indicate reception of a P2P service discovery response. The following parameters are included after the event prefix: source address, dialog token, service update indicator, Service Responce TLV(s) as hexdump. For example:
P2P-SERV-DISC-RESP 02:40:61:c2:f3:b7 0 0 0300000101

P2P_EVENT_INVITATION_RECEIVED[edit]

Indicate reception of a P2P Invitation Request. For persistent groups, the parameter after the event prefix indicates which network block includes the persistent group data. For example:
P2P-INVITATION-RECEIVED sa=02:40:61:c2:f3:b7 persistent=0

P2P_EVENT_INVITATION_RESULT=[edit]

Indicate result of a P2P invitation that was requested with P2P_INVITE command. The parameter status=<value> shows the status code returned by the peer (or -1 on local failure or timeout). For example:
P2P-INVITATION-RESULT status=1


E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WiLink8 WLAN Advanced Demos: Linux here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WiLink8 WLAN Advanced Demos: Linux here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article WiLink8 WLAN Advanced Demos: Linux here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity