← index #10017Issue #11048
Duplicate · high · value 1.649
QUERY · ISSUE

network.WLAN(...).scan() on Pico W returns out of range security and hidden parameters

openby mrmabsopened 2022-11-19updated 2025-07-17
bug

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.

CANDIDATE · ISSUE

RP2040: wlan.scan results disconnected from documentation and faulty

openby Flipje1955opened 2023-03-16updated 2023-09-09
bugport-rp2

When running wlan.scan on a Pico_w (MicroPython v1.19.1-966-g05bb26010 on 2023-03-13; Raspberry Pi Pico W with RP2040, also on earlier nightly builds), the output is disconnect from the documentation. Examples:

  1. "security": value 5 is returned (whereas doc offers only values 0..4);
  2. "hidden": values 2, 3 sometimes 5 is returned - on a non_hidden network - whereas doc offers only value 0,1;

script used:
import network
station = network.WLAN(network.STA_IF)
station.active(True)
active_ssid = station.scan()
for item in enumerate(active_ssid):
print(item)
station.disconnect()

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied