Wifi P2P while maintaining a Wifi connection on rasperry pi 3 Raspbian using wpa_supplicant

I am pretty naive to this topic, so please excuse any dumb reply from my side. I want to connect my raspberry pi 3 to my android phone through Wifi Direct(or P2P), while maintaining its normal wifi connection. Whenever i run wpa_cli command, it disconnects from the normal wifi connection, while P2P commands work fine. I know for the fact that this is possible as all recent android have this feature. I tried searching the internet a lot for this, but no one seems to discuss this. My wpa_supplicant.conf is -

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


After a cold start, i generally start using wpa_cli without any prior wpa_supplicant command, so maybe thats problem. You might have already judged how little knowledge i have, so please explain it in simple terms why this happening.

1 answer

  • answered 2017-07-29 22:59 C. Nitschke

    This happens because Wi-Fi Direct means that your phone is creating a separate Wi-Fi network (see Wi-Fi Direct on Wikipedia) when opening a Wi-Fi Direct connection, which is different from the Wi-Fi network you are already connected to (normally created by you router). However, the Wi-Fi interface on the Raspberry Pi can only connect to one network at a time.

    So when you are connecting to you phone via Wi-Fi Direct, the Raspberry Pi first leaves the network created by the router to connect to the Wi-Fi network created by the phone.

    If you want to connect to different Wi-Fi networks at the same time, you can add another Wi-Fi interface to the Raspberry Pi, for example, using a Wi-Fi USB stick. With two interfaces, you could connect to the two different networks without switching the connection to one of the networks off.