1

There is Raspberry pi and windows communication working with wifi direct. In my scenario, Raspberry pi is the GO.

Auto-connect mins: I'm not setting its connection method as PBC(push button control). I'm using it's connection method as set config_methods virtual_display

Steps that I do follow for auto-connect between android(GO) and Windows(client).

(1) I'm using a connection method as provide pin.

(2) start wifi direct on android.

(3) found discovered device on windows

(4) connect from windows and Enter PIN on the windows side. both devices connected successfully. Android as GO and windows as client.

(5) disconnect from android device.

(6) Restart wifi interface on android and windows

(7) now start wifi direct again on android and windows.

(8) found discovered device on windows

(9) connect from windows. (AT this time it will not ask for a password and connect with android without asking for a password).

I want to implement behavior like auto-connecting so I do not have to enter a pin every time. I want to make Raspberry PI as GO and windows as a client.

Please help me to understand the following questions with respect to Raspberry PI as GO

(1) How auto-connecting works in the p2p connection?

(2) Where the wpa_supplicant store information of the previously connected device?

(3) What change I have to make in the configuration file for auto-connecting.

My P2P configuration file

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
device_name=Direct-Pi-100
device_type=1-0050F204-1

I can connect Raspberry PI with windows successfully with the above config file. But the problem is only that I have to enter the PIN every time.

Please let me know in a comment if I miss anything. Thank you for your time !!

EDIT1: Auto-paring is not the correct word It's an auto-connect.

bhvn
  • 15
  • 5

2 Answers2

2

What do you mean with auto-pairing? You have to take into account that WiFi-Direct is made to have secure connections with authentication and encryption. For authentication it uses WPS (Wi-Fi Protected Setup). Mandatory and default authentication is the pin-entry method. It is not intended to "break" authentication so there is never an auto-pairing with WiFi-Direct. That's by design. If you want an unprotected connection then just use an open access point.

Fortunately WPS offers an optional authentication method push-button that is most used because you only have to push a (maybe virtual) button instead of entering a pin.

Now coming to your points:

  • (1) How auto-pairing works in the p2p connection?
    There is no auto-pairing available by design. Use the push-button method.
  • (2) Where the wpa_supplicant store information of the previously connected device?
    This information is stored in /etc/wpa_supplicant/wpa_supplicant.conf as long as option update_config=1 is set in it. If it is set to update_config=0 then wpa_supplicant will not store previous connections.
  • (3) What change I have to make in the configuration file for auto-pairing
    How to use the different authentication methods including recommended push-button you can look at Connect Android smartphone with Wi-Fi Direct to a Raspberry Pi.
Ingo
  • 40,606
  • 15
  • 76
  • 189
  • I have an edit question again auto paring word is not the correct word. Change it to Auto connect. Thank you for your time – bhvn Jan 11 '21 at 05:27
  • @bhvn If this answer your question, it would be nice if you would accept the answer. Only accepting an answer will finish the question. You can mark the answer as the accepted one with a click on the tick on its left side. That prevents your Question from being shown as an unsolved Post to the community and saves them/us a lot of work. – Ingo Jan 11 '21 at 13:53
  • Thank you for your time. I do really respect the time of a community contributor like you. Currently, I'm not getting the expected answer. That's why I'm working on the issue and have not found any success in it. So I have not accepted the answer. – bhvn Jan 13 '21 at 06:19
  • I think I have to set the default configuration file of wpa_supplicant like android in Raspbery PI. And then I have to try the behavior of the auto-connect between Raspberry PI and windows. What's your thought ? I'm trying auto connect behaviour with file [link](https://android.googlesource.com/platform/external/wpa_supplicant_8/+/0716c12e57090ce9904fb5948da1285fc36c1fe4/wpa_supplicant/wpa_supplicant.conf) – bhvn Jan 13 '21 at 06:27
1

(1) How auto-connecting works in the p2p connection? If you mean auto paring mins auto connect second time then you have to create group as a persistence group.

(2) Where the wpa_supplicant store information of the previously connected device? wpa_supplicant store information in wpa_supplicant.conf file.

(3) What change I have to make in the configuration file for auto-connecting.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
device_name="Direct-Test"
device_type=1-0050F204-1
persistent_reconnect=1
country=US

Add group as a persistence group then wpa_supplicant.conf file store information of created group then your connected device store into this file. When you connect second time use this created group after that your device will connect with out asking of password every time.