SNS connection display error in 32-bit pups [SOLVED]
Posted: Tue Sep 22, 2020 7:58 am
I am experiencing a problem with the sns wifi connection utility in any 32bit puppy released over the last few years. At this stage I have not investigated if 64bit pups exhibit the same issue - because I am trying to develop a stable and functional 32bit Pup for a specific 32bit machine. (I suspect the same issue will be present with 64bit puppies but maybe 64bit is immune. I just don't know yet...)
Summary:
I am sometimes seeing unstable behaviour from sns when I try to connect to my wifi router.
But this is not a 'connection' issue - the actual connection is good, and totally stable once established.
The only problem is with the display of the wifi networks during the network detection and connection phase.
The versions of sns in modern 32bit pups contain the following line which has the function of displaying networks in order of wifi signal strength:
The #170619 comment at the end of the line suggests that this mod was adopted in June 2017. The script comments do not note who wrote this code but i think rerwin was active then?
Symptom:
Most of the time the sns utility works correctly and displays the available wifi networks in order of signal strength - and for each network displays a bar graph showing the signal strength.
However, occasionally sns gets it wrong and drops my home network to the bottom of the list - even though it has the strongest signal.
This image shows the sns window during one of the "bad" phases. You can see that my home network ("Monitored Access") is at the bottom of the list, despite the bar graph showing that my network is stronger than the "ARLO" network at the top.
. .
This image shows the sns window during one of the "good" phases. You can see that my home network ("Monitored Access") is at the top of the list - where it should be - as it clearly has more bars showing on the signal strength meter.
. .
Here is a view of the file /tmp/sns_scan_oneline which is a kind of shorthand of the critical information returned to sns from the wifi search - and supposedly showing the networks in order of decreasing strength:
This result occurred during one of the "bad" phases and you can see that my network is dropped to the bottom of the list despite having a signal strength of 70/70.
So why is this happening?
The information in /tmp/sns_scan_oneline information seems to be derived from the more detailed information that appears in the file /tmp/sns_scan_rawoneline:
(truncated version of the file shown:)
I tried to compare what might be different between the sns files generated during the good and bad states - and i think there is a potential issue with regard to the parameter "signal level"
The key point that I noticed is that during the faulty phase - my network is listed as having a "Signal level" of 11 (NOTE that this is a positive number) whereas during the "good" phase my network showed a value of -3 or less (NOTE the negative number).
All of the other networks show a signal level that is very negative - for example -50dBm or less.
I suspect that the sns utility is assuming that signal level will always be negative and that this is leading to incorrect ordering of wifi networks when my network returns a positive value.
Now - i have no idea if the value of "11" (or even "-3") is a valid value as they seem extraordinarily high - when all other networks are showing much much lower signal strengths. So it may be that this particular wifi adapter is faulty, or has faulty firmware, or is getting confused etc etc - all i know is that when the signal level shows up as a positive number the sns utility displays my network in the wrong order - even though the signal strength bars show that my network is clearly the strongest and should be at the top of the list.
I suspect that this problem could be corrected by modification of the "SRLINES" code I posted above. (regardless of whether this is an sns bug or a wifi adapter parameter reporting bug...)
Maybe it would be more consistent for sns to order the networks according to the "quality" parameter instead of trying to calculate positive versus negative db? i don't really know what is easier programatically.
Is this something that could be looked at by rerwin or the other devs please? On most of my laptops and wifi adapters sns works perfectly but on some of my systems i see this random failure and I would love to see consistent results across the board.
Cheers!
EDIT : I feel i have had some success by changing the "SRLINES" line as follows:
- it certainly seems to display the networks now in order of "Quality" rather than "Signal level" - but i do not feel confident of the way i changed the sed parameters in the sort phase. I would really like an expert to verify the best way to read in the Quality parameter rather than the signal level parameter
Summary:
I am sometimes seeing unstable behaviour from sns when I try to connect to my wifi router.
But this is not a 'connection' issue - the actual connection is good, and totally stable once established.
The only problem is with the display of the wifi networks during the network detection and connection phase.
The versions of sns in modern 32bit pups contain the following line which has the function of displaying networks in order of wifi signal strength:
Code: Select all
SRLINES="`echo "$SCANRESULT" | grep -v 'Scan completed' | tr '|' ' ' | tr '\n' '|' | sed -e 's% Cell %\n%g' | tr -s ' ' | sed -e 's%\(Signal level=\)\(-[0-9][0-9]*\)%\1@\2@%' | sort -g -r -t @ -k 2 | sed -e 's%\(Signal level=\)@\(-[0-9][0-9]*\)@%\1\2%'`" #170619
Symptom:
Most of the time the sns utility works correctly and displays the available wifi networks in order of signal strength - and for each network displays a bar graph showing the signal strength.
However, occasionally sns gets it wrong and drops my home network to the bottom of the list - even though it has the strongest signal.
This image shows the sns window during one of the "bad" phases. You can see that my home network ("Monitored Access") is at the bottom of the list, despite the bar graph showing that my network is stronger than the "ARLO" network at the top.
. .
This image shows the sns window during one of the "good" phases. You can see that my home network ("Monitored Access") is at the top of the list - where it should be - as it clearly has more bars showing on the signal strength meter.
. .
Here is a view of the file /tmp/sns_scan_oneline which is a kind of shorthand of the critical information returned to sns from the wifi search - and supposedly showing the networks in order of decreasing strength:
Code: Select all
04|A4:11:62:33:47:69|6|47/70|on|ARLO_VMB_2661234568
07|18:F1:45:47:D0:90|6|39/70|on|Trustpower_2.4GHz_2861
03|A4:11:62:17:2C:2C|6|33/70|on|ARLO_VMB_6198157448
02|A4:CA:A0:E8:ED:44|3|33/70|on|vodafoneED3E
10|2C:30:33:3F:8C:AE|11|31/70|on|NETGEAR83
09|10:DA:43:BF:5C:FA|9|30/70|on|NTGR_VMB_1406851360
06|28:80:88:63:6B:56|6|30/70|on|Trustpower_2.4GHz_2861_2GEXT
01|38:10:D5:A6:EE:99|1|26/70|on|2degrees Broadband - EE97
05|7A:8A:20:81:F9:35|6|20/70|on|(hidden ESSID)
08|88:D7:F6:81:3E:A8|11|70/70|on|MonitoredAccess
So why is this happening?
The information in /tmp/sns_scan_oneline information seems to be derived from the more detailed information that appears in the file /tmp/sns_scan_rawoneline:
(truncated version of the file shown:)
Code: Select all
04 - Address: A4:11:62:33:47:69| Channel:6| Frequency:2.437 GHz (Channel 6)| Quality=47/70 Signal level=-63 dBm | Encryption key:on| ESSID:"ARLO_VMB_2661234568"
07 - Address: 18:F1:45:47:D0:90| Channel:6| Frequency:2.437 GHz (Channel 6)| Quality=39/70 Signal level=-71 dBm | Encryption key:on| ESSID:"Trustpower_2.4GHz_2861"
03 - Address: A4:11:62:17:2C:2C| Channel:6| Frequency:2.437 GHz (Channel 6)| Quality=33/70 Signal level=-77 dBm | Encryption key:on| ESSID:"ARLO_VMB_6198157448"
02 - Address: A4:CA:A0:E8:ED:44| Channel:3| Frequency:2.422 GHz (Channel 3)| Quality=33/70 Signal level=-77 dBm | Encryption key:on| ESSID:"vodafoneED3E"
10 - Address: 2C:30:33:3F:8C:AE| Channel:11| Frequency:2.462 GHz (Channel 11)| Quality=31/70 Signal level=-79 dBm | Encryption key:on| ESSID:"NETGEAR83"
09 - Address: 10:DA:43:BF:5C:FA| Channel:9| Frequency:2.452 GHz (Channel 9)| Quality=30/70 Signal level=-80 dBm | Encryption key:on| ESSID:"NTGR_VMB_1406851360"
06 - Address: 28:80:88:63:6B:56| Channel:6| Frequency:2.437 GHz (Channel 6)| Quality=30/70 Signal level=-80 dBm | Encryption key:on| ESSID:"Trustpower_2.4GHz_2861_2GEXT"
01 - Address: 38:10:D5:A6:EE:99| Channel:1| Frequency:2.412 GHz (Channel 1)| Quality=26/70 Signal level=-84 dBm | Encryption key:on| ESSID:"2degrees Broadband - EE97"
05 - Address: 7A:8A:20:81:F9:35| Channel:6| Frequency:2.437 GHz (Channel 6)| Quality=20/70 Signal level=-90 dBm | Encryption key:on| ESSID:""
08 - Address: 88:D7:F6:81:3E:A8| Channel:11| Frequency:2.462 GHz (Channel 11)| Quality=70/70 Signal level=11 dBm | Encryption key:on| ESSID:"MonitoredAccess"
I tried to compare what might be different between the sns files generated during the good and bad states - and i think there is a potential issue with regard to the parameter "signal level"
The key point that I noticed is that during the faulty phase - my network is listed as having a "Signal level" of 11 (NOTE that this is a positive number) whereas during the "good" phase my network showed a value of -3 or less (NOTE the negative number).
All of the other networks show a signal level that is very negative - for example -50dBm or less.
I suspect that the sns utility is assuming that signal level will always be negative and that this is leading to incorrect ordering of wifi networks when my network returns a positive value.
Now - i have no idea if the value of "11" (or even "-3") is a valid value as they seem extraordinarily high - when all other networks are showing much much lower signal strengths. So it may be that this particular wifi adapter is faulty, or has faulty firmware, or is getting confused etc etc - all i know is that when the signal level shows up as a positive number the sns utility displays my network in the wrong order - even though the signal strength bars show that my network is clearly the strongest and should be at the top of the list.
I suspect that this problem could be corrected by modification of the "SRLINES" code I posted above. (regardless of whether this is an sns bug or a wifi adapter parameter reporting bug...)
Maybe it would be more consistent for sns to order the networks according to the "quality" parameter instead of trying to calculate positive versus negative db? i don't really know what is easier programatically.
Is this something that could be looked at by rerwin or the other devs please? On most of my laptops and wifi adapters sns works perfectly but on some of my systems i see this random failure and I would love to see consistent results across the board.
Cheers!
EDIT : I feel i have had some success by changing the "SRLINES" line as follows:
Code: Select all
SRLINES="`echo "$SCANRESULT" | grep -v 'Scan completed' | tr '|' ' ' | tr '\n' '|' | sed -e 's% Cell %\n%g' | tr -s ' ' | sed -e 's%\(Quality=\)\([0-9][0-9]*\)%\1@\2@%' | sort -g -r -t @ -k 2 | sed -e 's%\(Quality=\)@\([0-9][0-9]*\)@%\1\2%'`" #170619