espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.87k stars 7.08k forks source link

Support for WiFi direct (P2P) (IDFGH-4715) #6522

Open DavidJRobertson opened 3 years ago

DavidJRobertson commented 3 years ago

There have been mentions a few years ago that wifi direct was on the to-do list, but it is still not implemented.

This is surprising because there are very clear reasons why developers would want to use wifi direct in an IOT project. Specifically, it would greatly improve the user experience of using wifi to connect to the ESP32 device from an Android phone without the need for network infrastructure or provisioning.

Right now the alternative is to either use bluetooth (which is low-bandwidth and has licensing/certification cost issues) or to use soft AP on the ESP32, which provides poor user experience due to the requirement for the smartphone wifi connection to be manually switched, interrupting the phone's normal network connection. At least on some Android devices, it is supported to connect to a normal AP and a wifi direct group at the same time.

I note that the upstream wpa_supplicant project includes support for wifi direct/p2p so I presume this could be made to work on the ESP32.

tanguy-penfen commented 3 years ago

Permit me to agree with what is said in this feature request. If application is mobile and range not short enough for bluetooth, the only way to share data with a device is creating soft AP. That means users will loose internet connectivity on their devices which is not acceptable... Unless there are other ways I don't know about. Please consider implementing this.

sagb2015 commented 3 years ago

@DavidJRobertson - Yes, this is on our TODO list, but it may not be available any time soon since our focus is currently on the protocols that are more important from security perspective (WPA3, PMF, DPP) or that cover more IoT/wireless scenarios (FTM, 11kv, 11r etc). However, depending on the demand we may consider to increase the priority of implementing this feature as well.

kaedros commented 3 years ago

We have also been waiting for this feature for many years and it would bring a huge improvement in the experience already described very well by @DavidJRobertson.

We cannot imagine that this demand is not important for everyone who develops for IoT.

wagner-rebello commented 3 years ago

This feature can help a lot for IoT usage. The network configuration using a smartphone app would be very simple as the network do not need to change. Changing networks on Android or iOS is painful. There are many factors that implies in the network refuses to change. Using wifi direct "kills" all that factors.

mauriciofarina commented 3 years ago

@DavidJRobertson and @sagb2015 We are also on standby for this feature for a log time!

itamardv commented 3 years ago

It would be great

jensolsson commented 3 years ago

Need this too. Now we are looking for another chip for our project but the ESP32 would be perfect if it only supported WiFi Direct / P2P

TeschRenan commented 2 years ago

I agree that it's not extremely important, but I support inclusion.

FlynnMa commented 2 years ago

Need this too. Now we are looking for another chip for our project but the ESP32 would be perfect if it only supported WiFi Direct / P2P

What is the another chip are you talking about? ...I would be happy to use an alternative if if provides both BT and wifi with wifi-direct.

wuujiann commented 2 years ago

I too am looking for this feature. Hopefully, this feature can be impelmented soon.

palpopite commented 2 years ago

This feature would be decisive in our IoT products! As @wagner-rebello pointed out, developing an App that can connect via Wifi to an device without Wifi-Direct is really hard, and even if you manage to do that, the end result is not user friendly as @DavidJRobertson said. Looking forward to see this implemented in ESP-IDF!

writetosumeet commented 2 years ago

Any timeline for Wifi Direct for ESP32? We are considering using ESP32 for a new product but inability to provide WIFI direct is a big hinderance!

maleiter commented 2 years ago

We'd need WiFi Direct too. The lack of WiFi Direct support forces us to use another chip with the next version of our product.

jack0c commented 2 years ago

Does anyone try to use DPP, which is more official for IOT device provisioning. There are already some Android phones support this feature, and I think new Android phones is likely to support this feature, just like Android support WPS and P2P.

ZantsuRocks commented 2 years ago

Does anyone try to use DPP, which is more official for IOT device provisioning. There are already some Android phones support this feature, and I think new Android phones is likely to support this feature, just like Android support WPS and P2P.

As iOS don't support this technology and the same for old android phones (the majority in Brazil where our product is sold) i can't even try to lose time testing this.

DavidJRobertson commented 2 years ago

Does anyone try to use DPP, which is more official for IOT device provisioning. There are already some Android phones support this feature, and I think new Android phones is likely to support this feature, just like Android support WPS and P2P.

As iOS don't support this technology and the same for old android phones (the majority in Brazil where our product is sold) i can't even try to lose time testing this.

Yeah, nice thing about WiFi direct is that it is backwards compatible with WiFi devices that don't support it 'directly' (just appears as access point, so much the same as existing soft-AP provisioning approaches).

adamoskaranikas commented 2 years ago

Hi, are there any updates regarding WiFi Direct support for ESP32 ? Is there a way to maybe adapt ESP-NOW to allow for communication with Wifi-Direct enabled devices other than ESP32's (i.e. ESP32 to Android mobile device). This would be a game changer for us, otherwise we will have to look at other MCU options supporting this feature

benjamin-shapiro commented 2 years ago

+1 on this -- current soft-AP implementation with Android is highly undesirable. The ability to directly send a video stream to a mobile device on the ESP32 platform would be transformational for our product.

ArnyminerZ commented 2 years ago

Hope this gets added ASAP. I agree that it's not more important than security, but platform-wise I think it would help users and developers quite a lot.

AxelLin commented 2 years ago

Does anyone try to use DPP, which is more official for IOT device provisioning. There are already some Android phones support this feature, and I think new Android phones is likely to support this feature, just like Android support WPS and P2P.

@jack0c Just want to clarify that to use DPP the Access Point needs to support WPA3, right? That is a problem because may users are still using access point without WPA3 support.

AxelLin commented 2 years ago

@DavidJRobertson - Yes, this is on our TODO list, but it may not be available any time soon since our focus is currently on the protocols that are more important from security perspective (WPA3, PMF, DPP) or that cover more IoT/wireless scenarios (FTM, 11kv, 11r etc). However, depending on the demand we may consider to increase the priority of implementing this feature as well.

@sagb2015 It has been a year since your reply. Is there any update for WiFi direct? (Many users are asking this feature). Can we expect v5.0 to include wifi direct support?

romatetemadze commented 2 years ago

Any news on the WIFI-Direct?

sagb2015 commented 2 years ago

Hi All, No we do not have support for WiFi-Direct yet, neither we are considering it for IDF 5.0. However, given the demand we would like to evaluate which chips you would like this features to be on. Given the memory size implication we may target limited subset of the features. WiFi-Direct is a very big feature to support.

AxelLin commented 2 years ago

@sagb2015 Do you have a rough estimated number of the memory that will be taken by WiFi-Direct?

jensolsson commented 2 years ago

@sagb2015 any of the esp chips would work for us.

Kind regards Jens

jensolsson commented 2 years ago

@sagb2015 I started playing with WiFi Direct a while ago, the goal was to make the ESP32 appear as a wifi direct device on an Android phone so I hand crafted a vendor IE with P2P info and used esp_wifi_set_vendor_ie to enable it. I finally got it to work so my esp32 device would show up under WiFi Direct in my Android phone. But it was of course not possible to connect to it yet.

I think the next steps would be to enable WPS and do some kind of p2p handshake in order to determine which of the devices will be master. But as it is possible to set a hint on Android to force it to be either master or not, i do not really know if this handshake is necessary or if it would just work if WPS would be enabled?

Is it really that complicated to get a basic WiFi Direct up and running?

Kind regards Jens

nicklasb commented 1 year ago

This would be very valuable. As it stands now, the only implemented and broadly used peer to-peer connectivity is BLE with all its complexities. WiFi Direct would enable not only peer-to-peer communication with normal PC:s, and possibly with some other MCU:s and devices.

I really like ESP-NOW, but it is currently only possible to run on espressif hardware and it seems as if it requires driver-level changes on PC:s which just won't happen on a broader scale. Especially when WiFi Direct exists.

I think that it would be in Espressifs interests to open up this avenue of communication, there are so many use cases where you don't want to have to depend on some wonky WiFi router, hassle with passwords and expose yourself to the very well-developed WiFi hacking world to do some communication.

(And as BLE is implemented, the cat is sort of out of the vendor-lock-in bag anyway. )

andresbrocco commented 1 year ago

+1 Up! Great Feature request! Would be really useful

Lucas-Heitele commented 1 year ago

+1

johnnyb commented 1 year ago

Would love to have Wifi Direct on an ESP32. Would have been a game-changer for my current project. Still might be for the future of the project. Right now we are having to do a full Linux Single-board computer to get a worthwhile Wifi Direct.

nicklasb commented 1 year ago

Would love to have Wifi Direct on an ESP32. Would have been a game-changer for my current project. Still might be for the future of the project. Right now we are having to do a full Linux Single-board computer to get a worthwhile Wifi Direct.

Exactly! There are a huge number of possible solutions that could benefit from this being implemented.

jasta commented 11 months ago

I think the real issue here is that wpa_supplicant would need to be updated, then new APIs added to use the features it exposes. There appear to be a great many reasons why this would be desirable, such as possibly fixing #10615. Unfortunately there are a lot of patches on top of esp-idf's fork of wpa_supplicant so unmerging those forks and rebasing on top of the latest will probably not be realistic, at least not without potential breakage. I wonder if perhaps espressif is open to a strategy in which we experimentally bring in another version of wpa_supplicant and try to just get things building and let the community tinker with the unstable support to collect bug reports.

nicklasb commented 11 months ago

Unfortunately there are a lot of patches on top of esp-idf's fork of wpa_supplicant so unmerging those forks and rebasing on top of the latest will probably not be realistic, at least not without potential breakage.

If there's already a lot of patches and those patches aren't moving upstream, then i would rather try and be inspired by, rather than try to merge, the upstream code. There is always that point where you have to make that decision.

So If I were Espressif, I would rather just try to port it into their fork. The business case would be quite uniquely interoperable hardware. It would probably pays to use those extra resources for maintaining their own supplicant. Or maybe I am just schrewdly trying to remind Espressif of the hidden costs of non-reuse. :-)

jasta commented 11 months ago

If there's already a lot of patches and those patches aren't moving upstream, then i would rather try and be inspired by, rather than try to merge, the upstream code. There is always that point where you have to make that decision.

Certainly an option, but still a good amount of work. Given the age of this p2p support request, I'm guessing espressif isn't going to suddenly prioritize deepening their fork just for p2p support.

So If I were Espressif, I would rather just try to port it into their fork. The business case would be quite uniquely interoperable hardware. It would probably pays to use those extra resources for maintaining their own supplicant. Or maybe I am just schrewdly trying to remind Espressif of the hidden costs of non-reuse. :-)

I mean, they're spending a lot of time fixing issues I'd bet money upstream has already fixed, so I think they're probably already aware of the costs: https://github.com/espressif/esp-idf/commits/master/components/wpa_supplicant/src

It's a hard spot for them to be in though, I empathize. I do think though that forking wpa_supplicant and leaving the ability to merge with upstream was probably the wrong call given how much Wi-Fi is still actively developing by the Wi-Fi Alliance. They're getting very far behind very fast...

Thothore commented 8 months ago

Hello, I would love to have this feature for my project (android auto wireless adapter), the chip I have is a wemos lolin32 v1

blaueente commented 8 months ago

Might Wifi Aware / NAN be a suitable replacement? https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_nan.html

wagner-rebello commented 8 months ago

Might Wifi Aware / NAN be a suitable replacement? https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_nan.html

No it's not, many OS do not have this functionality (AKA iOS)

blaueente commented 8 months ago

Might Wifi Aware / NAN be a suitable replacement? https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_nan.html

No it's not, many OS do not have this functionality (AKA iOS)

True, but iOS also never actually supported WiFi direct.

nicklasb commented 8 months ago

Might Wifi Aware / NAN be a suitable replacement? https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_nan.html

No it's not, many OS do not have this functionality (AKA iOS)

True, but iOS also never actually supported WiFi direct.

Hm. TBH, this weakens the case for Wi-Fi Direct significantly. The usual Apple-for-purely-Apple-reasons wielding their proprietary lock-in sword as much as they possibly can. :-(

johnnyb commented 7 months ago

Wifi direct is native compatible with Android. Thus, making devices that would auto-connect to Android and use IP-based protocols would be greatly simplified with Wifi Direct support.

nicklasb commented 7 months ago

Wifi direct is native compatible with Android. Thus, making devices that would auto-connect to Android and use IP-based protocols would be greatly simplified with Wifi Direct support.

Agreed. And I just realized that I have an Android phone now. :-) Seriously though, it would be actually be quite helpful. Bluetooth is a bit cumbersome and overengineered, so a more straightforward protocol would be nice.

johnnyb commented 7 months ago

I think if an ecosystem for Wifi Direct were built up inside enough secondary devices, it would force Apple to either go along with the crowd to participate in the ecosystem, or publish their spec openly.

AxelLin commented 6 months ago

Hi All, No we do not have support for WiFi-Direct yet, neither we are considering it for IDF 5.0. However, given the demand we would like to evaluate which chips you would like this features to be on. Given the memory size implication we may target limited subset of the features. WiFi-Direct is a very big feature to support.

@sagb2015 It has been a long time, do you have any progress to share?

nachiketkukade commented 5 months ago

@AxelLin , we're prioritising some other features and improvements over P2P at this moment ( e.g. - WiFi Aware). So there is no major update on this from our side.

artem-pdus commented 2 months ago

Support of wifi-direct would be really great step towards improving user experiences with diy/embedded devices, looking forward to it.

manosmic commented 2 months ago

+1

Liesegang commented 1 month ago

+1