I am using this configuration for wifi direct connection in Raspberry PI 2 B+
ctrl_interface=DIR=/var/run/wpa_supplicant
driver_param=use_p2p_group_interface=1
update_config=1
device_name=Raspberry_pi
device_type=1-0050F204-1
p2p_go_intent=1
p2p_go_ht40=1
country=IN
and then started wpa supplicant using
sudo wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant/p2p.conf -B
and then add new group using
sudo wpa_cli -iwlan0 p2p_group_add
and then set an IP using
ifconfig p2p-wlan0-0 192.168.1.20
and then set the pin using
sudo wpa_cli -ip2p-wlan0-0 wps_pin any 0000
up to this, everything is working fine and I am able to connect to the Raspberry Pi over wifi direct from an Android device. Now I am facing two problems,
- The connection automatically gets disconnected after a few seconds
- When I tried to reconnect the Android device, it shows invited forever (but disconnecting and connecting n times between 2 Android devices works fine and the connections are not getting disconnected). I am able to connect to the Raspberry Pi only after terminating wpa supplicant and starts the process again. What is wrong with this configuration? What changes should be made to make the connection persistent?
Edit 1:
When I restart the wpa supplicant and connects for the first time, this is what I get in the log
CTRL-EVENT-EAP-STARTED 2a:3f:69:1d:ed:c5
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
<3>WPS-REG-SUCCESS 2a:3f:69:1d:ed:c5 884efa75-0a98-52c6-85aa-07527f4a9c35
<3>WPS-SUCCESS
<3>CTRL-EVENT-EAP-FAILURE 2a:3f:69:1d:ed:c5
<3>AP-STA-CONNECTED 2a:3f:69:1d:ed:c5 p2p_dev_addr=2a:3f:69:1d:ed:c5
and after the automatic disconnection
AP-STA-DISCONNECTED 2a:3f:69:1d:ed:c5 p2p_dev_addr=2a:3f:69:1d:ed:c5
if I try to reconnect without restarting this is printed in the console
CTRL-EVENT-EAP-STARTED 2a:3f:69:1d:ed:c5
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
<3>WPS-PIN-NEEDED 884efa75-0a98-52c6-85aa-07527f4a9c35 2a:3f:69:1d:ed:c5 [Xperia XA |MediaTek Inc.|MTK Wireless Model|1.0|2.0|10-0050F204-5]
<3>CTRL-EVENT-EAP-FAILURE 2a:3f:69:1d:ed:c5