I would like to connect my Raspberry Pi 3B to a WiFi Direct group created on my Android phone. After enabling WiFi with raspi-config
, I started wpa_supplicant
with the following command:
sudo wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant/p2p.conf -B
The file used in the above command is as follows:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
device_name=Raspberry-Pi
device_type=1-0050F204-1
driver_param=use_p2p_group_interface=1
After starting wpa_supplicant
, I started wpa_cli
:
Selected interface 'p2p-dev-wlan0'
Interactive mode
>
Next, I was able to discover my phone as a peer with p2p_find
:
> p2p_find
OK
<3>CTRL-EVENT-SCAN-STARTED
...
<3>P2P-DEVICE-FOUND 82:58:f8:c7:e2:81 p2p_dev_addr=82:58:f8:c7:e2:81 pri_dev_type=10-0050F204-5 name='XT1635-01_9d83' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1
However, when I attempt to connect with the push button option using p2p_connect
, the result is always immediately FAIL
:
> p2p_connect 82:58:f8:c7:e2:8 pbc join
FAIL
Before attempting to connect, I made sure the Android phone is listed as a P2P peer.
According to this documentation:
"join" indicates that this is a command to join an existing group as a client. It skips the GO Negotiation part. This will send a Provision Discovery Request message to the target GO before associating for WPS provisioning.
Since I want the Raspberry Pi to be a client (i.e. not the group owner), this seems like the correct option to me. Before executing the p2p_connect
command above, I selected "Start PBC" on my Android device under the WiFi Direct settings.
Am I following the correct procedure to connect? If possible, I would like to connect by sending an invitation that can then be accepted on the Android device.