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.
docs: WLAN.scan() results on RP2/PICO_W with 1.24.1
Documentation URL
https://docs.micropython.org/en/latest/library/network.WLAN.html
Description
The documentation report the following
There are five values for security:
0 – open
1 – WEP
2 – WPA-PSK
3 – WPA2-PSK
4 – WPA/WPA2-PSK
and two for hidden:
0 – visible
1 – hidden
While using the WLAN.scan() function, I got the following results:
Most of the networks in my neighbourhood are reporting
security = 5
and hidden:
1 - Most of them, and by the way, the networks are visible (so, they should be 0)
2 - seems hidden
5 - visible (homekit device)
7 - One of my home Wi-Fi (made by an old D-Link router)
9 - My main home Wi-Fi (made by a TP-Link router)
Any thoughts ?
Code of Conduct
Yes, I agree