Closed chenlijun99 closed 2 years ago
Workaround to receive beacon vendor ie when connected: continuously scan using esp_wifi_scan_start()
.
Basically it seems that beacons are taken into considered by the WiFi stack only when scanning (in fact esp_wifi_connect()
under the hood also perform a scan, an all-channel scan).
However, it seems that if I keep doing passive single-channel scans, the WiFi stack is no more able to detect disconnection from the AP. I.e. the beacon timeout doesn't fire anymore. Apparently, the beacons that are received due to the passive scanning are treated as beacons from the AP. Thus, even if the AP is no more sending beacons, the beacon timeout is never triggered.
Hi @chenlijun99 Thanks for your feture request reporting, but this is a big modify for us, since this esp_wifi_set_vendor_ie_cb will be triggered only when sta receive beacon or probe response, so you need to connect to ap or scanning ap for the probe response. As for the first issue, we suggest you enable sniffer mode to sniffer beacon pkt and parse related vendor IE in your app. While the scan and lost beacon timeout issue, we will confirm this issue and fix it. Thanks.
Hi @MaxwellAlan Thanks for the quick reply. I understand that it may be a big change for you and I think the workaround described in https://github.com/espressif/esp-idf/issues/9064#issuecomment-1141970873 is enough for my use case. Looking forward to your news concerning the beacon timeout issue. Thanks
Hi @chenlijun99 The timer used for beacon timeout will be reset during the scanning process. It means that the scan process will affect the triggering of the event WIFI_EVENT_STA_BEACON_TIMEOUT.
Hi @mhdong. Thanks for confirming the issue!
Fix on master branch is available at https://github.com/espressif/esp-idf/commit/8078092fae77eccc075496bdc566cc1a92b1f055 and on release/4.4 is available at https://github.com/espressif/esp-idf/commit/c9119cbcef3db0798547fbb01acde40ca4b4df5c. Feel free to reopen.
Is your feature request related to a problem? Please describe.
In my WiFi STA I'm trying to receive vendor IE contained inside beacons, regardless of the connection status of the STA. From my tests, it appears that the callback registered via
esp_wifi_set_vendor_ie_cb
is only called when my STA is connecting usingesp_wifi_connect()
. Ifesp_wifi_connect()
is not called, no beacon vendor IE is received (or at least, the vendor ie callback is not called). The same for when the STA is already connected.Describe the solution you'd like
The registered callback is called regardless of the connection status of the STA.
This limitation has also been raised in this forum thread: https://www.esp32.com/viewtopic.php?f=13&t=22259