I would like to create a Wifi-Direct access point where the board needs to act as the GO. I am using the following configuration file for wpa_supplicant (wpa_supplicant.conf
):
ctrl_interface=/var/run/wpa_supplicant
update_config=0
device_name=DIRECT-MYDEV
p2p_go_ht40=1
country=IT
network={
ssid="DIRECT-MY"
psk="12345678"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
mode=3
disabled=2
}
I'm starting the service with the following commands in a init.d file:
wpa_cli -iwlan0 p2p_group_add persistent=0
wpa_cli -ip2p-wlan0-0 wps_pin any 87654321
As you can see, I'm using the PIN authentication method. Since I would like that multiple devices can connect to the network using always the same PIN (the option "any" is one-shot, it works only the first time), I created a cron job which repeats each minute the second command above (I know that using always the same pin is not safe, but for now it's ok to me). In this way any device can connect to the Wifi-Direct after entering the correct PIN code (87654321
); the following times, the devices can access the network without specifying any PIN code, since it seems they store some sort of PSK-key in their memory (correct me if I'm wrong).
Problems start when I try to modify the network password in the wpa_supplicant.conf
file: after the change, the devices that were previously authenticated cannot connect anymore to the Wifi-Direct.
The wpa_cli
shows the following error:
AP-STA-POSSIBLE-PSK-MISMATCH
Since the network password changed, I would have expected that each device had to insert the PIN again, but it's not happening: the devices send the request but no response is received.
Do you know why? Is there a way to solve this problem?
UPDATE with info from comments:
On my smartphone I have two options to connect to the board: 1) using the "traditional" WLAN with the name DIRECT-MY with 12345678 password; 2) using the WiFi-Direct menu and selecting DIRECT-MYDEV, which needs the 87654321 PIN. If I change at run time the password stored in the network block and reboot the system, I can still connect to DIRECT-MY using the new password, but I can't connect anymore to the DIRECT-MYDEV, as mentioned in the post. Connecting directly to DIRECT-MYDEV is useful since the smartphone can maintain access to the internet using the traditional WiFi.
I have decided to use only the persistent group owner mode, but I can see that from the WiFi-Direct list of my smartphone there is still the DIRECT-MYDEV device to which I can try to connect. Is it normal? Is there a way to remove it from that particular list?