Wi-Fi Direct
Wi-Fi Direct is a wireless standard that allows devices to connect with each other without requiring a wireless access point. Wi-Fi Direct negotiates the link with a Wi-Fi Protected Setup (WPS) system that assigns each device a limited wireless access point.
Establishing a peer-to-peer (P2P) link has the following phases:
- 
P2P discovery, which allows to search for P2P devices in the vicinity
 - 
P2P group formation, a P2P group is formed with the identification of one of the devices as group owner. A device can either become group owner (GO) autonomously if configured to do so or it can be negotiated between devices with the exchange of GO intents.
 - 
P2P provisioning, which authenticates the link by using either Push Button Configuration (PBC) or PIN authentication.
 - 
P2P connection, when the connection between a Group Owner (GO) and a Group Client (GC) is actually established.
 
The QCA6574 driver on load creates a p2p0 interface that is used by the wpa supplicant for P2P group formation. Once a group is formed, virtual {wifi-p2p-interface}N interfaces are created, where N is an index starting at 0. These virtual interfaces are then used for provisioning.
- 
Group additions, find and connect operations happen on the p2p0 interface.
 - 
Provisioning occurs on the virtual {wifi-p2p-interface}N interfaces.
 - 
This configuration requires MAC addresses to be different and unique. Configure the virtual interfaces before attempting to connect more than one device.
 
By default, Digi Embedded Yocto configures the Wi-Fi Direct functionality by adding a p2p0 interface in /etc/network/interfaces. The interface is not automatically brought up.
The following instructions show how to configure the device to use Wi-Fi Direct.
- 
Delete the wlan1 interface to make sure we can assign a virtual MAC address to the interface {wifi-p2p-interface}0 that will be created. To delete the wlan1 interface, use the following command:
~# iw dev wlan1 del
 - 
Bring up the p2p0 interface:
~# ifup p2p0
 
The following examples will use two ConnectCore 6 Plus devices to establish P2P connections. For more information about the wpa-supplicant P2P specific commands, see the wpa_supplicant and Wi-Fi P2P README.
Autonomous GO creation
| In kernel v4.9, peer-to-peer Autonomous Group Owner (Autonomous GO) configuration fails due to an incompatibility in the wireless driver. Digi recommends you use the Negotiated Group Owner (Negotiated GO) method. | 
Create Autonomous Group Owner (GO) and join using PBC method
Peer (GO) ---- PBC --- Peer (GC)
| Steps | Peer CC6PLUS1 | Peer CC6PLUS2 | 
|---|---|---|
1  | 
wpa_cli -ip2p0  | 
wpa_cli -ip2p0  | 
2  | 
p2p_group_add  | 
  | 
3  | 
  | 
p2p_find  | 
4  | 
  | 
p2p_connect <CC6PLUS1_go_mac_addr> pbc join  | 
5  | 
Ctrl-c to exit  | 
Ctrl-c to exit  | 
6  | 
wpa_cli -i {wifi-p2p-interface}0 wps_pbc  | 
  | 
7  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS1_ip_addr>  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS2_ip_addr>  | 
8  | 
ping <CC6PLUS2_ip_addr>  | 
ping <CC6PLUS1_ip_addr>  | 
Create Autonomous GO and join using PIN from GO
Peer (GO) ---- PIN --- Peer (GC)
| Steps | Peer CC6PLUS1 | Peer CC6PLUS2 | 
|---|---|---|
1  | 
wpa_cli -ip2p0  | 
wpa_cli -ip2p0  | 
2  | 
p2p_group_add  | 
  | 
3  | 
  | 
p2p_find  | 
4  | 
Ctrl-c to exit  | 
  | 
5  | 
wpa_cli -i{wifi-p2p-interface}0 wps_pin any (shows <pin>)  | 
  | 
6  | 
  | 
p2p_connect <CC6PLUS1_go_mac_addr> <pin> join  | 
7  | 
  | 
Ctrl-c to exit  | 
8  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS1_ip_addr>  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS2_ip_addr>  | 
9  | 
ping <CC6PLUS2_ip_addr>  | 
ping <CC6PLUS1_ip_addr>  | 
Create Autonomous GO and join using PIN from GC
Peer (GO) ---- PIN --- Peer (GC)
| Steps | Peer CC6PLUS1 | Peer CC6PLUS2 | 
|---|---|---|
1  | 
wpa_cli -ip2p0  | 
wpa_cli -ip2p0  | 
2  | 
p2p_group_add  | 
  | 
3  | 
  | 
p2p_find  | 
4  | 
  | 
p2p_connect <CC6PLUS1_go_mac_addr> pin join (shows <pin>)  | 
5  | 
Ctrl-c to exit  | 
Ctrl-c to exit  | 
6  | 
wpa_cli -i{wifi-p2p-interface}0 wps_pin any <pin>  | 
  | 
7  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS1_ip_addr>  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS2_ip_addr>  | 
8  | 
ping <CC6PLUS2_ip_addr>  | 
ping <CC6PLUS1_ip_addr>  | 
Create Autonomous GO and invite GC using PBC
Peer (GO) ---- PBC --- Peer (GC)
| Steps | Peer CC6PLUS1 | Peer CC6PLUS2 | 
|---|---|---|
1  | 
wpa_cli -ip2p0  | 
wpa_cli -ip2p0  | 
2  | 
p2p_group_add  | 
  | 
3  | 
  | 
p2p_find  | 
4  | 
p2p_invite group={wifi-p2p-interface}0 peer=<CC6PLUS2_mac_addr>  | 
  | 
5  | 
  | 
p2p_connect <CC6PLUS1_go_mac_addr> pbc join  | 
6  | 
Ctrl-c to exit  | 
Ctrl-c to exit  | 
7  | 
wpa_cli -i {wifi-p2p-interface}0 wps_pbc  | 
  | 
8  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS1_ip_addr>  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS2_ip_addr>  | 
9  | 
ping <CC6PLUS2_ip_addr>  | 
ping <CC6PLUS1_ip_addr>  | 
| For any of these methods, if you want to use the 5GHz frequency, issue p2p_group_add freq=5180 in step two. | 
Negotiated GO
Negotiate GO and join using PIN
Peer (GO | GC) ---- PIN --- Peer (GO | GC)
| Steps | Peer CC6PLUS1 | Peer CC6PLUS2 | 
|---|---|---|
1  | 
wpa_cli -ip2p0  | 
wpa_cli -ip2p0  | 
2  | 
p2p_find  | 
  | 
3  | 
  | 
p2p_find  | 
4  | 
p2p_connect <CC6PLUS2_go_mac_addr> pin go_intent=1  | 
  | 
5  | 
  | 
p2p_connect <CC6PLUS1_go_mac_addr> <pin> go_intent=15  | 
6  | 
Ctrl-c to exit  | 
Ctrl-c to exit  | 
7  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS1_ip_addr>  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS2_ip_addr>  | 
8  | 
ping <CC6PLUS2_ip_addr>  | 
ping <CC6PLUS1_ip_addr>  | 
Negotiate GO and join using PBC
Peer (GO | GC) ---- PBC --- Peer (GO | GC)
| Steps | Peer CC6PLUS1 | Peer CC6PLUS2 | 
|---|---|---|
1  | 
wpa_cli -ip2p0  | 
wpa_cli -ip2p0  | 
2  | 
p2p_find  | 
  | 
3  | 
  | 
p2p_find  | 
4  | 
p2p_connect <CC6PLUS2_go_mac_addr> pbc go_intent=1  | 
  | 
5  | 
  | 
p2p_connect <CC6PLUS1_go_mac_addr> pbc go_intent=14  | 
6  | 
Ctrl-c to exit  | 
Ctrl-c to exit  | 
7  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS1_ip_addr>  | 
ifconfig {wifi-p2p-interface}0 <CC6PLUS2_ip_addr>  | 
8  | 
ping <CC6PLUS2_ip_addr>  | 
ping <CC6PLUS1_ip_addr>  |