unexpected wlan.scan() results #10931
Replies: 2 comments
-
Hi, kinda new to this but I have been playing around with this same issue. The document lists 5 values for security: BUT I found in my testing, the numbers didn't match the description so I made a dictionary (It is not truely acurate, I was only able to confirm 0 (Open) and 5(WPA/WPA2) from my router wifi available settings: wifi_scan_security_dict = { I was going to find another router and see if the various Authentication methods were detected but reported incorrectly(or in a way I am not reading them correctly). I went online to find all the current Authentication levels and was going to try and match them up in my dictionary. Wifi Authentication Types: Again, I am very new to python, raspberry pi, pico in general, and I have been scouring the documents and seeing basically all the same code and not really drilled down info...yet. I also had the same issue with Wifi Connection Status codes. I ended up making a dictionary to test them out as I want to make a proper Wifi connect function with error trapping/reporting and restart/sleep try again. Hopefully some documentation will come out with updated information. I hope something I said here helps. If not, please correct me. I'm only 1 month old in Pi land :) |
Beta Was this translation helpful? Give feedback.
-
Thank you for taking the time to share your experience and approach on the
topic. Not considering myself to be an expert on MP, I played around with
settings, variables in order to get the results matching the documentation
but as you too seem to conclude, the data returned may in itself be valid,
however is not correlating to the current state of the documentation.
I'll play with it some more and if the conclusions persist, I will report
it (what I believe it is) as a bug.
Wbr,
Op di 14 mrt 2023 om 20:36 schreef Cobracomm5Pi ***@***.***>:
… Hi, kinda new to this but I have been playing around with this same issue.
I was seeing weird results when I would set the AP on my wifi router to
either OPEN or WPA/WPA2 etc.
I used my guest network and made an access point to connect to and
monitored the values and I find the listed values don't match up with the
WLAN documentation (from my general research).
The document lists 5 values for security:
0 – open
1 – WEP
2 – WPA-PSK
3 – WPA2-PSK
4 – WPA/WPA2-PSK
BUT I found in my testing, the numbers didn't match the description so I
made a dictionary (It is not truely acurate, I was only able to confirm 0
(Open) and 5(WPA/WPA2) from my router wifi available settings:
wifi_scan_security_dict = {
"0": "OPEN",
"2": "WEP",
"3": "WPA-PSK",
"4": "WPA2-PSK",
"5": "WPA/WPA2-PSK"
I created a variable to store the retrieved status : secure =
wifi_scan_security_dict.get(str(w[4]))
and printed to shell :
print(i,w[0].decode(),binascii.hexlify(w[1]).decode(),w[2],w[3],secure,w[5])
I was going to find another router and see if the various Authentication
methods were detected but reported incorrectly(or in a way I am not reading
them correctly). I went online to find all the current Authentication
levels and was going to try and match them up in my dictionary.
I found this so far. My guess is that these are represented possibly in
the WLAN security type values?
Wifi Authentication Types:
Open
WEP 64
WEP 128
WPA-PSK (TKIP)
WPA-PSK (AES)
WPA2-PSK (TKIP)
WPA2-PSK (AES)
WPA/WPA2-PSK (TKIP/AES)
Again, I am very new to python, raspberry pi, pico in general, and I have
been scouring the documents and seeing basically all the same code and not
really drilled down info...yet.
I also had the same issue with Wifi Connection Status codes. I ended up
making a dictionary to test them out as I want to make a proper Wifi
connect function with error trapping/reporting and restart/sleep try again.
#Wlan.status Error Codes Dictionary
wifi_err_status_dict = {
"-3": "STAT_WRONG_PASSWORD – failed due to incorrect password",
"-2": "STAT_NO_AP_FOUND – failed because no access point replied",
"-1": "STAT_CONNECT_FAIL – failed due to other problems",
"0": "STAT_IDLE – no connection and no activity",
"1": "STAT_CONNECTING – connecting in progress",
"3": "STAT_GOT_IP – connection successful",
"00": "STAT_BEACON_TIMEOUT", #unknown
"01": "STAT_HANDSHAKE_TIMEOUT" #unknown
}
You've seen this code above in the general Wifi connectivity code, I added
the dictionary for better results in understanding what happened. I have
tested with incorrect AP names -2 , wrong password -3, and status 0,1,3.
I do not know how to test the STAT_BEACON_TIMEOUT or HANDSHAKE.
Hopefully some documentation will come out with updated information.
I hope something I said here helps. If not, please correct me. I'm only 1
month old in Pi land :)
I uploaded my scripts to my github, how did I do?
https://github.com/Cobracomm5Pi/PicoW/blob/main/PicoW%20-%20Scan%20Wifi%20Networks%20logger2.py
https://github.com/Cobracomm5Pi/PicoW/blob/main/PicoW%20Wifi%20Connect%20with%20Error%20Messages.py
—
Reply to this email directly, view it on GitHub
<#10931 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3CU4JJVPHYNDBEAFRLPZQ3W4DCDTANCNFSM6AAAAAAVQFZGLQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Using: MicroPython v1.19.1-915-g2bcd88d55 on 2023-03-02; Raspberry Pi Pico W with RP2040:
While scanning for WLANs, data is returned as follows:
item (0, (b'', b'\xb6\xa7\xb9l\xa0\x06', 4, -76, 5, 1))
item (1, (b'xx', b'\xb0\xa7\xb9l\xa0\x06', 4, -77, 5, 3))
item (2, (b'xx', b"\x10'\xf5TI\x9a", 4, -90, 5, 2))
item (3, (b'xx_Guest', b'\xba\xa7\xb9l\xa0\x06', 4, -78, 5, 3))
item (4, (b'xx_Guest', b"\x16'\xf5TI\x9a", 4, -92, 5, 1))
Where the docs refer to possible security values in range 0..4 here 5 is returned. Equally surprising is the indicator whether the ssid is hidden or not, with possible values 0 / 1. Here also other values are returned and not in a consistent way.
Am I missing something ?
Script:
import network
station = network.WLAN(network.STA_IF)
station.active(True)
active_ssid = station.scan()
for item in enumerate(active_ssid):
print("item", item)
station.disconnect()
Beta Was this translation helpful? Give feedback.
All reactions