network.WLAN(...).scan() on Pico W returns out of range security and hidden parameters
Hi all,
When doing wifi scans, the returned values regularly have values 5 of 7 in security, and values varying from 0 to 8 in hidden; the documentation states security should be 0-4 and hidden should be 0 or 1.
I've tried to go through the source from micropython to the cyw43 pico driver, but I'm not able to identify the issue (as I don't believe I understand the code enough to make a definitive statement). My [poorly informed] assumption is the security values aren't being translated from the CYW43 driver (CYW43_AUTH_), and maybe the hidden variable is getting overrun because it only ever appears to be set to 1 (network_cyw43_scan_cb() in extmod/network_cyw43.c), which would be hidden and should probably be 0 for visible. But neither of those assumptions completely make sense.
I have used two different firmware releases:
- pimoroni-picow-v1.19.10-micropython
- rp2-pico-w-20221118-unstable-v1.19.1-705-gac5934c96
I initially followed the scanning code from this website, and quoting from the website where you can see the example output shows out of range values:
import network #import required module
wlan = network.WLAN(network.STA_IF) #initialize the wlan object
wlan.active(True) #activates the wlan interface
accessPoints = wlan.scan() #perform a WiFi Access Points scan
for ap in accessPoints: #this loop prints each AP found in a single row on shell
print(ap)
'>>> %Run -c $EDITOR_CONTENT
(b'****er-1', b'\xac\x9e\x17k\xd6@', 2, -47, 5, 5)
(b'*********G3P4', b'\xc8Z\x9f\xdc\xa47', 11, -81, 5, 3)
(b'*********TWEB', b'\xcaZ\x9f\xdc\xa47', 11, -80, 5, 2)
And this blog post also mentions unusual output values:
https://dev.webonomic.nl/scanning-network-with-the-raspberry-pi-pico-w
My end goal is to get reliable values to generate logs for wardriving.
WLAN config parameter 'hidden' unknown
Port, board and/or hardware
Raspberry Pico W
MicroPython version
MicroPython v1.25.0 on 2025-04-15; Raspberry Pi Pico W with RP2040
Reproduction
- Try to set parameter 'hidden' via WLAN.config()
- Parameter unknown error
Expected behaviour
An AP with hidden SSID
Observed behaviour
Parameter unknown
Additional Information
According to the docs there should be a config parameter 'hidden' for the WLAN class, which supposingly hides the SSID when running in IF_AP mode.
However, in reality this doesn't seem to exist, and results in an error 'unknown config param'.
The Gibhub repo also doesn't show it in code (as far as I can tell).
Neither could I see a param with a different name meant for this purpose.
Perhaps this was overlooked..?
Thanks for following this up! :D
Code of Conduct
Yes, I agree