zephyr-cp/wifi: subscribe to NET_EVENT_WIFI_SCAN_RESULT - #11223
Open
mikeysklar wants to merge 1 commit into
Open
zephyr-cp/wifi: subscribe to NET_EVENT_WIFI_SCAN_RESULT#11223mikeysklar wants to merge 1 commit into
mikeysklar wants to merge 1 commit into
Conversation
This was referenced Aug 21, 2026
tannewt
requested changes
Aug 21, 2026
tannewt
left a comment
Member
There was a problem hiding this comment.
One request to remove a PR-specific comment
Comment on lines
+281
to
+286
| // SCAN_RESULT delivers the parsed per-AP entries. Without it the | ||
| // handler's NET_EVENT_WIFI_SCAN_RESULT case never runs and scans | ||
| // always return zero networks. RAW_SCAN_RESULT is not a substitute: | ||
| // it carries raw beacon frames and only fires when | ||
| // CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS is enabled, which it is not by | ||
| // default. |
Member
There was a problem hiding this comment.
No need for this. The addition is self explanatory.
Suggested change
| // SCAN_RESULT delivers the parsed per-AP entries. Without it the | |
| // handler's NET_EVENT_WIFI_SCAN_RESULT case never runs and scans | |
| // always return zero networks. RAW_SCAN_RESULT is not a substitute: | |
| // it carries raw beacon frames and only fires when | |
| // CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS is enabled, which it is not by | |
| // default. |
The event handler has a NET_EVENT_WIFI_SCAN_RESULT case that queues each AP as it arrives, but that event was never in the subscription mask, so the case never ran and scans always returned zero networks. RAW_SCAN_RESULT is in the mask but is not a substitute. It carries raw beacon frames and only fires when CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS is enabled, which it is not by default. Measured on a Raspberry Pi Pico 2 W running raspberrypi_rpi_pico2_w_zephyr, built from 069144c and flashed over SWD with pyOCD: len([1 for n in wifi.radio.start_scanning_networks()]) before 0 after 204 Same board, same probe, same script, with only this change reverted for the before run.
mikeysklar
force-pushed
the
fix/zephyr-wifi-scan-result-event
branch
from
August 21, 2026 21:13
3878bb9 to
edff1a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wi-Fi scanning on zephyr-cp returns zero networks on every board.
_event_handlerinports/zephyr-cp/common-hal/wifi/__init__.chas aNET_EVENT_WIFI_SCAN_RESULTcase that queues each AP as it arrives, but that event is not in the mask passed tonet_mgmt_init_event_callback. The case has never run, so nothing is ever queued and every scan comes back empty.NET_EVENT_WIFI_RAW_SCAN_RESULTis in the mask, which is probably how this went unnoticed, but it is not a substitute. It carries raw beacon frames and only fires whenCONFIG_WIFI_MGMT_RAW_SCAN_RESULTSis enabled, which it is not by default.Testing
Raspberry Pi Pico 2 W, in-tree board
raspberrypi_rpi_pico2_w_zephyr, built from 069144c on Linux and flashed over SWD with pyOCD via a CMSIS-DAP Debug Probe.Same board, same probe, same script. The before run is this commit reverted and rebuilt, nothing else changed. Both returned promptly to the prompt.
Anyone with a Pico 2 W can reproduce this, no vendor hardware needed.
Notes
This is the root cause behind #11214, which I opened earlier and have closed. That one bounded the scan wait instead of fixing why no results arrive, and @tannewt was right to push back on it.
AI assistance was used to draft this change. I ran the hardware testing above myself and confirmed the before and after numbers on my own board.