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.

WiFi Direct Configuration Scripts

From Texas Instruments Wiki
Jump to: navigation, search

THIS PAGE IS UNDER CONSTRUCTION

Glossary[edit]


WiFi direct P2P Group.png

  • A P2P Group is a Wi-Fi P2P network that may include two types of devices:
  • P2P Device –Wi-Fi CERTIFIED™ device that is compliant with the Wi-Fi P2P specification
  • Legacy device –Wi-Fi CERTIFIED™ device that is not compliant with the Wi-Fi P2P specification


  • P2P devices must be capable of two different roles in a P2P Group:
  • P2P Group Owner : An “AP-like” capability that controls a Wi-Fi P2P Group and enables P2P Device connectivity
  • P2P Client : A Wi-Fi P2P-compliant device that may connect to a P2P Group Owner
  • Legacy devices may only function as client in a P2P Group.


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)




P2P usecases[edit]


Wiki P2PGroup.jpg

Three scripts are provided for p2p use cases. These scripts are located in: "/usr/share/wl18xx/".
The scripts are:

p2p_start.sh : Start the p2p interface
p2p_stop.sh  : Stop the p2p interface
p2p_cli.sh  : Enter the p2p command line interface

The detailed steps are as described below:

1. Change directory to "/usr/share/wl18xx/"

cd /usr/share/wl18xx/

2. Run the p2p_start script. You should see a result like:

root@am335x-evm:/usr/share/wl18xx# ./p2p_start.sh
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
wlcore: PHY firmware version: Rev 8.2.0.0.232
wlcore: firmware booted (Rev 8.9.0.0.48)
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
cfg80211: Calling CRDA for country: US
cfg80211: Regulatory domain changed to country: US
cfg80211:  DFS Master region: FCC
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
wlcore: down
rfkill: Cannot open RFKILL control device
Could not read interface p2p-dev-wlan0 flags: No such device
wlcore: PHY firmware version: Rev 8.2.0.0.232
wlcore: firmware booted (Rev 8.9.0.0.48)
p2p-dev-wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=US

3. Run the p2p_cli script. You should see a result like:

root@am335x-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

>

NoteNote: Make sure that all the EVMS that participate in the WiFi Direct network has unique MAC Address, and that all has IP Address that is in the same Subnet.
NoteNote: P2P uses the 5G band by default. So if one of the EVMs (BeagleBone for example) does not support 5G, use the additional parameter "freq=2412" to the p2p connect commands.


Connect in pbc (Push button Control)[edit]

Step # EVM #1 EVM #2 Comments
1 p2p_find p2p_find
2 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
3 p2p_connect EVM#2_MAC_ADDRESS pbc go_intent=7 go_intent=7 means that there a same chance for both EVMs to become GO
go_intent= 15 means that EVM will become GO
go_intent= 0 means that EVM will become Client
4 p2p_connect EVM#1_MAC_ADDRESS pbc


Connect in pbc (Push button Control) where EVM #1 is defined as the group owner[edit]

Step # EVM #1 EVM #2 Comments
1 p2p_find p2p_find
2 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
3 p2p_group_add Define EVM #1 as GO
4 Exit and re-enter wpa_cli using the newly created p2p-wlan0-0 interface type: quit
wpa_cli -ip2p-wlan0-0
5 wps_pbc
6 p2p_connect EVM#1_MAC_ADDRESS pbc join


Connect in Pin (PIN Number) where EVM #1 is defined as the group owner[edit]

Step # EVM #1 EVM #2 Comments
1 p2p_find p2p_find
2 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
3 p2p_group_add Define EVM #1 as GO
4 Exit and re-enter wpa_cli using the newly created p2p-wlan0-0 interface type: quit
wpa_cli -ip2p-wlan0-0
5 wps_pin any verify the EVM#1_PIN_NUMBER, will appear on the terminal
6 p2p_connect EVM#1_MAC_ADDRESS EVM#1_PIN_NUMBER join


Connection using PIN code[edit]

Step # EVM #1 EVM #2 Comments
1 p2p_find p2p_find
2 p2p_peers p2p_peers verify p2p candidates MAC ADDRESS
3 p2p_connect EVM#2_MAC_ADDRESS pin auth That command will print EVM#1 pin code in the follwoing line
4 p2p_connect EVM#1_MAC_ADDRESS EVM#1_PIN_CODE getting EVM#1_PIN_CODE from previous EVM#1 command




P2P Demo usecases[edit]

Following are several WiFi Direct Demos.

Create 1:2 P2P Group - Connect in pbc (Push button Control)[edit]


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_connect EVM#2_MAC_ADDRESS pbc auth go_intent=7 go_intent=7 means that there a same chance for both EVMs to become GO
go_intent= 15 means that EVM will become GO
go_intent= 0 means that EVM will become Client
6 p2p_connect EVM#1_MAC_ADDRESS pbc
7 Verify connection with Ping traffic
8 Run: p2p_stop.sh Run: p2p_stop.sh ./p2p_stop.sh

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

>

EVM #2

root@am335x-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

>

EVM #1

> p2p_find
OK
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<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

EVM #2

> p2p_find
OK
<3>CTRL-EVENT-SCAN-STARTED
<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
> p2p_peers
78:a5:04:26:97:3e

EVM #1

> p2p_peers
54:4a:16:3a:c6:29
> p2p_connect 54:4a:16:3a:c6:29 pbc auth go_intent=7
OK
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-STARTED
> P2P-FIND-STOPPED
<3>P2P-FIND-STOPPED
> P2P-GO-NEG-SUCCESS role=GO freq=5785 ht40=1 peer_dev=54:4a:16:3a:c6:29 peer_iface=56:4a:16:3a:c6:28 wps_method=PBC
<3>P2P-GO-NEG-SUCCESS role=GO freq=5785 ht40=1 peer_dev=54:4a:16:3a:c6:29 peer_iface=56:4a:16:3a:c6:28 wps_method=PBC
> rfkill: Cannot[  163.485189] IPv6: ADDRCONF(NETDEV_UP): p2p-wlan0-0: link is not ready
 open RFKILL control device
[  163.696518] 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-HS"
[  163.964447] 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=]
p2p-wlan0-0: WPS-PBC-ACTIVE
<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-HS" freq=5785 passphrase="hf3O0VFN" go_dev_addr=78:a5:04:26:97:3e
> P2P-GROUP-STARTED p2p-wlan0-0 GO ssid="DIRECT-HS" freq=5785 go_dev_addr=78:a5:04:26:97:3e
p2p-wlan0-0: WPS-PBC-DISABLE
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


EVM #2

> p2p_connect 78:a5:04:26:97:3e pbc
P2P-FIND-STOPPED
OK
<3>P2P-FIND-STOPPED
> P2P-GO-NEG-SUCCESS role=client freq=5785 ht40=1 peer_dev=78:a5:04:26:97:3e peer_iface=7a:a5:04:26:97:3d wps_method=PBC
<3>P2P-GO-NEG-SUCCESS role=client freq=5785 ht40=1 peer_dev=78:a5:04[  152.100796] IPv6: ADDRCONF(NETDEV_UP): p2p-wlan0-0: link is not ready
:26:97:3e peer_iface=7a:a5:04:26:97:3d wps_method=PBC
> rfkill: Cannot open RFKILL control device
p2p-wlan0-0: SME: Trying to authenticate with 7a:a5:04:26:97:3d [  153.031799] p2p-wlan0-0: authenticate with 7a:a5:04:26:97:3d
(SSID='DIRECT-HS' freq=5785 MHz)
[  153.048411] p2p-wlan0-0: send auth to 7a:a5:04:26:97:3d (try 1/3)
[  153.106117] p2p-wlan0-0: authenticated
p2p-wlan0-0: Trying to associate with 7a:a5:04:26:97:3d (SSID='D[  153.112919] p2p-wlan0-0: associate with 7a:a5:04:26:97:3d (try 1/3)
IRECT-HS' freq=5785 MHz)
[  153.137937] p2p-wlan0-0: RX AssocResp from 7a:a5:04:26:97:3d (capab=0x11 status=0 aid=1)
[  153.160889] IPv6: ADDRCONF(NETDEV_CHANGE): p2p-wlan0-0: link becomes ready
[  153.168129] 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[  153.587483] p2p-wlan0-0: deauthenticating from 7a:a5:04:26:97:3d by local choice (Reason: 3=DEAUTH_LEAVING)

[  153.641061] 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 [  153.662373] p2p-wlan0-0: authenticate with 7a:a5:04:26:97:3d
(SSID='DIRECT-HS' freq=5785 MHz)
[  153.693043] p2p-wlan0-0: send auth to 7a:a5:04:26:97:3d (try 1/3)
[  153.886367] p2p-wlan0-0: authenticated
p2p-wlan0-0: Trying to associate with 7a:a5:04:26:97:3d (SSID='D[  153.890652] cfg80211: World regulatory domain updated:
IRECT-HS' freq=5785 MHz)
[  153.901788] cfg80211:  DFS Master region: unset
[  153.908091] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  153.917925] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[  153.926348] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[  153.934436] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[  153.942746] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[  153.953124] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[  153.962716] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[  153.970848] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[  153.979253] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[  153.987494] cfg80211: Calling CRDA for country: US
p2p-wlan0-0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD[  154.002636] p2p-wlan0-0: associate with 7a:a5:04:26:97:3d (try 1/3)

[  154.122766] cfg80211: Regulatory domain changed to country: US
[  154.129005] p2p-wlan0-0: RX AssocResp from 7a:a5:04:26:97:3d (capab=0x11 status=0 aid=1)
[  154.137984] cfg80211:  DFS Master region: FCC
[  154.142205] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  154.153611] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[  154.161787] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[  154.172011] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[  154.181774] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[  154.191168] 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
[  154.212782] 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:[  154.291945] 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-HS" freq=5785 psk=08dd88ac41f0a0d4321fd33de19e35d7a54fb827e8a5359193d8487880e15704 go_dev_addr=78:a5:04:26:97:3e
> P2P-GROUP-STARTED p2p-wlan0-0 client ssid="DIRECT-HS" freq=5785 go_dev_addr=78:a5:04:26:97:3e

Exit the wpa supplicant CLI by hitting "q" on both EVMs.

> 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:33 errors:0 dropped:2 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2919 (2.8 KiB)  TX bytes:4457 (4.3 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# 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:26 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3023 (2.9 KiB)  TX bytes:4041 (3.9 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)

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=193.529 ms
64 bytes from 192.168.3.4: seq=1 ttl=64 time=1032.839 ms
64 bytes from 192.168.3.4: seq=2 ttl=64 time=32.006 ms
64 bytes from 192.168.3.4: seq=3 ttl=64 time=54.723 ms
64 bytes from 192.168.3.4: seq=4 ttl=64 time=77.625 ms
64 bytes from 192.168.3.4: seq=5 ttl=64 time=306.206 ms
64 bytes from 192.168.3.4: seq=6 ttl=64 time=125.311 ms
64 bytes from 192.168.3.4: seq=7 ttl=64 time=148.801 ms

--- 192.168.3.4 ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max = 32.006/246.380/1032.839 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=229.453 ms
64 bytes from 192.168.3.3: seq=1 ttl=64 time=9.430 ms
64 bytes from 192.168.3.3: seq=2 ttl=64 time=10.999 ms
64 bytes from 192.168.3.3: seq=3 ttl=64 time=9.187 ms
64 bytes from 192.168.3.3: seq=4 ttl=64 time=10.008 ms
64 bytes from 192.168.3.3: seq=5 ttl=64 time=9.076 ms
64 bytes from 192.168.3.3: seq=6 ttl=64 time=115.450 ms

--- 192.168.3.3 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 9.076/56.229/229.453 ms

Exit the p2p tests on both EVMs

EVM #1

root@am437x-evm:/usr/share/wl18xx# ./p2p_stop.sh
P2P-GROUP-REMOVED p2p-wlan0-0 GO reason=REQUESTED
p2p-wlan0-0: interface state ENABLED->DISABLED
p2p-wlan0-0: AP-STA-DISCONNECTED 56:4a:16:3a:c6:28 p2p_dev_addr=54:4a:16:3a:c6:29
AP-STA-DISCONNECTED 56:4a:16:3a:c6:28 p2p_dev_addr=54:4a:16:3a:c6:29
p2p-wlan0-0: AP-DISABLED
p2p-wlan0-0: CTRL-EVENT-DISCONNECTED bssid=7a:a5:04:26:97:3d reason=3 locally_generated=1
nl80211: deinit ifname=p2p-wlan0-0 disabled_11b_rates=1
[ 1135.058889] wlcore: down
P2P-DEVICE-LOST p2p_dev_addr=54:4a:16:3a:c6:29
nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
OK
root@am437x-evm:/usr/share/wl18xx# [ 1135.173022] wlcore: down
p2p-dev-wlan0: CTRL-EVENT-TERMINATING
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
wlan0: CTRL-EVENT-TERMINATING

EVM #2

root@am335x-evm:/usr/share/wl18xx# ./p2p_stop.sh
nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
OK
[ 1169.243405] wlcore: down
root@am335x-evm:/usr/share/wl18xx# p2p-dev-wlan0: CTRL-EVENT-TERMINATING
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
wlan0: CTRL-EVENT-TERMINATING



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 WiFi Direct Configuration Scripts 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 WiFi Direct Configuration Scripts here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article WiFi Direct Configuration Scripts here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article WiFi Direct Configuration Scripts here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article WiFi Direct Configuration Scripts here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WiFi Direct Configuration Scripts here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WiFi Direct Configuration Scripts here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article WiFi Direct Configuration Scripts here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article WiFi Direct Configuration Scripts 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