8.7 Running in the ATWILC P2P Mode
A P2P group includes two devices: One device acts as a P2P Group Owner (GO) and the other device acts as a P2P Client. The ATWILC devices support both P2P GO and P2P Client modes. The following is the procedure to test P2P mode on ATWILC.
There are two scenarios in which the P2P mode can be tested. The following section describes each scenario:
Scenario 1 - WILC device as a group owner and mobile phone as a P2P client
Configuring the WILC device as a group owner:
- Load both the WILC modules, using the
following
command:
where, mode = 1 for P2P GO and mode = 0 for P2P Client.modprobe wilc-sdio echo <mode> > /sys/wilc/p2p_mode
- Add the p2p0 virtual
interface:
iw phy0 interface add p2p0 type station
- Start the WPA supplicant service and open the P2P device, using the following
command:
wpa_supplicant -Dnl80211 -ip2p0 -c/etc/wilc_p2p_supplicant.conf &
- Configure the IP address of the P2P
GO and start the DHCP server, using the following
command:
ifconfig p2p0 192.168.0.1 /etc/init.d/S80dhcp-server start
- On the terminal, enter into wpa_cli interactive mode, using the following
command:
wpa_cli -ip2p0
- Scan for neighbouring P2P devices for specified duration, using the following
command:
p2p_find <scan_duration_in_seconds>
- After scan is complete, list the
available P2P peers using the following
command:
p2p_peers
This command lists the BSSID of the P2P peer.
- Connect to the P2P Client using the
BSSID of the P2P peer, using the following
command:
p2p_connect <MAC_ADDRESS> pbc
Configuring a mobile phone as a P2P client:
In the Wi-Fi settings menu on the phone, enter into Wi-Fi Direct® mode and perform the following to establish the connection.
- Trigger connection from WILC:
- Enter
p2p_find
command without timeout value on the WILC.The SSID of the P2P peer appears on the phone.
- Enter the
p2p_connect
command as shown above in the WILC. A pop-up window appears on the phone. - Click the Accept button or prompt to connect.
- Enter
- Trigger connection from phone:
- Click the SSID displayed on the phone and send a P2P invite.
- Enter the
p2p_connect <MAC_ADDRESS> pbc
command in the WILC to form a P2P group.
Scenario 2 - WILC device as a P2P client and mobile phone as a group owner
Configuring WILC device as a P2P client:
- Load both the WILC modules, using the
following command:
modprobe wilc-sdio
- Add the p2p0 virtual
interface:
iw phy0 interface add p2p0 type station
- Start the WPA supplicant service and open the P2P device, using the following
command:
wpa_supplicant -Dnl80211 -ip2p0 -c/etc/wilc_p2p_supplicant.conf &
- On the terminal, enter into wpa_cli interactive mode, using the following
command:
wpa_cli -ip2p0
- Scan for neighbouring P2P devices for specified duration, using the following
command:
p2p_find <scan_duration_in_seconds>
- After the scan is complete, list the
available P2P peers, using the following
command:
p2p_peers
This command lists the BSSID of the P2P peer.
- Connect to the P2P Go using the BSSID
of the P2P peer, using the following
command:
p2p_connect <MAC_ADDRESS> pbc go_intent=1
- Press Ctrl+c to exit the interactive mode.
- Run the DHCP client on the WILC to
obtain IP address.
dhcpcd p2p0 &
Configuring a mobile phone as a group owner:
In the Wi-Fi settings menu on the phone, enter into Wi-Fi Direct mode and perform the following to establish the connection.
- Trigger connection from WILC:
- Enter the
p2p_find
command without time-out value on the WILC.The SSID of the P2P peer appears on the phone.
- Enter the
p2p_connect
command as shown above in the WILC. A pop-up window appears on the phone. - Click the Accept button or prompt to connect.
- Enter the
- Trigger connection from phone:
- Click the SSID displayed on the phone and send a P2P invite.
- Enter the
p2p_connect <MAC_ADDRESS> pbc
command in the WILC to form a P2P group.