SNS connection display error in 32-bit pups [SOLVED]

Post here if you feel others can duplicate your so discovered "bug"

Moderator: Forum moderators

Post Reply
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

SNS connection display error in 32-bit pups [SOLVED]

Post by greengeek »

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:

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
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.
.
FaultyOrder.jpg
FaultyOrder.jpg (80.23 KiB) Viewed 905 times
.

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.
.
CorrectOrder.jpg
CorrectOrder.jpg (76.03 KiB) Viewed 905 times
.

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
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:)

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
- 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
Last edited by greengeek on Mon Oct 19, 2020 12:23 am, edited 1 time in total.
User avatar
Jafadmin
Posts: 385
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: SNS connection display - intermittent error

Post by Jafadmin »

This line of code should give you the raw output from iwlist. See if you can get it to replicate your output.

Code: Select all

iwlist wlan0 s | grep -A5 -i cell
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: SNS connection display - intermittent error

Post by greengeek »

Jafadmin wrote: Thu Sep 24, 2020 12:15 am This line of code should give you the raw output from iwlist. See if you can get it to replicate your output.

Code: Select all

iwlist wlan0 s | grep -A5 -i cell
Thanks jafadmin - yes that syntax does give the required information for my networks - although unfortunately i can't graft that code into sns as i can't follow much of the way sns builds it's "oneline" list from the parameters returned from the wifi adapter . Most of the code (and the /tmp files it produces) are a bit of a mystery to me.

However - i am now certain that the issue of my home network being dropped to the bottom of the network list is caused bythe fact that my laptop is close to the router and returns a positive "dBm" value - and the sns code is based on the assumption that this figure will always be negative.

At the end of my post above i wrote a modified code for listing the networks in order of strength - based on the original sns "SRLINES" code - but swapping from the "Signal strength" parameter to the "Quality" parameter.

I don't know how "Quality" is generated but it is also available as part of the output of the iwlist code you offered, so it must be consistently returned by the wifi adapter so seems valid as a useable measure of which network is closest (and therefore likely to be the one the user wishes to connect to...)

I have used the above mod for a few days now and so far it's 100% reliable.
User avatar
Jafadmin
Posts: 385
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: SNS connection display - intermittent error

Post by Jafadmin »

greengeek wrote: Thu Sep 24, 2020 11:19 pm However - i am now certain that the issue of my home network being dropped to the bottom of the network list is caused bythe fact that my laptop is close to the router and returns a positive "dBm" value - and the sns code is based on the assumption that this figure will always be negative.
The reason I posted the iwlist code for testing is that the the dBn value should always be negative. Use it to double check the output from the other tool.
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: SNS connection display - intermittent error

Post by greengeek »

Jafadmin wrote: Fri Sep 25, 2020 3:13 am The reason I posted the iwlist code for testing is that the the dBn value should always be negative. Use it to double check the output from the other tool.
Hi jafadmin,

I am definitely seeing positive values for the dBm when i am in the same room as my router

Here is an excerpt from the /tmp/snsrawoneline file:

Code: Select all

08 - Address: 88:D7:F6:81:3E:A8| Channel:11| Frequency:2.462 GHz (Channel 11)| Quality=70/70 Signal level=3 dBm | Encryption key:on| ESSID:"MonitoredAccess"|
and here is a portion of the output of your scan code:

Code: Select all

          Cell 01 - Address: 88:D7:F6:81:3E:A8
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=70/70  Signal level=2 dBm  
                    Encryption key:on
                    ESSID:"MonitoredAccess"
--
The "rawoneline" info is returned before the interface is up whereas your code has to be run after the interface is active - so the two signal strength values are not exactly the same.

I have no idea why this network interface returns such values - but i am sure that i have seen the issue with variations in the display order on multiple machines.
I have tested a number of the more recent 32bit pups and believe they are all subject to this error within sns.

Here is a comparison of Quality and Signal strength for all of the networks my adapter sees:
.
dBm_comparison.jpg
dBm_comparison.jpg (55.13 KiB) Viewed 801 times
.
I am thinking of roasting a turkey on my router. 8-)
User avatar
bigpup
Moderator
Posts: 6993
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 911 times
Been thanked: 1528 times

Re: SNS connection display - intermittent error

Post by bigpup »

rerwin is keeping up with any issues with any of the network connection programs in Puppy.
He has a topic here:
viewtopic.php?f=89&t=445
I suggest you post there about your problem or give him a link to this topic.
If anyone can help you. That would be the person to ask.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
Jafadmin
Posts: 385
Joined: Tue Aug 04, 2020 4:51 pm
Has thanked: 68 times
Been thanked: 85 times

Re: SNS connection display - intermittent error

Post by Jafadmin »

@greengeek

Wow! I learn something new every day. I have never seen that before. Thanks for posting the results of your testing. Very revealing. :thumbup:
User avatar
bigpup
Moderator
Posts: 6993
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 911 times
Been thanked: 1528 times

Re: SNS connection display - intermittent error

Post by bigpup »

With all those different WIFI signals in your area.

Consider seeing what channels they are using as compared to the channel you are using.

It is best if you set your WIFI transmitter router to use a channel someone else is not using.

Your WIFI router should have settings to change the channel it uses.

Selecting the proper WiFi channel can significantly improve your WiFi coverage and performance. In the 2.4 GHz band, 1, 6, and 11 are the only non-overlapping channels. Selecting one or more of these channels is an important part of setting up your network correctly.

Each channel on the 2.4 GHz spectrum is 20 MHz wide. The channel centers are separated by 5 MHz, and the entire spectrum is only 100 MHz wide. This means the 11 channels have to squeeze into the 100 MHz available, and in the end, overlap.

However, there are three channels that don’t overlap: 1, 6 and 11. Co-channel interference is where devices take turns talking, so the more devices on one channel, the longer it takes for a device to talk since it has to wait for its turn.


Channel 11 seems to be used a lot, as the default channel, set by the manufactures. At least, all the wifi routers I have used, were preset to channel 11.
The 5GHz wifi devices are a big improvement for several reasons.
5 GHz
24 non-overlapping channels.
Little WiFi congestion
Very little non-WiFi interference
Note:
Network Wizard.
When you select scan to see what wifi signals are available.
A list of what is found in area is made.
The list is the names of the wifi routers found and if encryption on/off.
To see info about the channel used.
Hover over the router name and more info will show.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

superchook
Posts: 48
Joined: Mon Dec 23, 2019 9:57 pm
Location: Sydney, Australia
Has thanked: 15 times
Been thanked: 3 times

Re: SNS connection display - intermittent error

Post by superchook »

Hi greengeek,
There can, rarely, be too much of a good thing. The WiFi receiver on the computer in question may be being overloaded by receiving too strong a signal. Can you place it somewhere further from your router and see if you can get it to show a signal consistently below zero.
( -20dBm say)

cheers,
Ken
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: SNS connection display - intermittent error

Post by greengeek »

superchook wrote: Sun Sep 27, 2020 12:17 am Hi greengeek,
There can, rarely, be too much of a good thing. The WiFi receiver on the computer in question may be being overloaded by receiving too strong a signal. Can you place it somewhere further from your router and see if you can get it to show a signal consistently below zero.
( -20dBm say)

cheers,
Ken
Hi Ken, yes if i move to the far end of the house i can get the wifi interface to report negative values - but i don't experience any problems when the signal shows positive dBm - its just a problem during display of the network order when using sns.

There are no problems once connected - so i don't want to go to the back bedroom just to avoid the connection issue.

I think my mod using the "Quality" parameter rather than the "Signal quality" parameter is the answer. All good for the last few days. And "Quality" never appears as a negative value. It's a good consistent measurement. I have no idea how the wifi interface calculates quality tho' - i am just happy to use that parameter and it seems to do the trick.
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: SNS connection display - intermittent error

Post by greengeek »

bigpup wrote: Sat Sep 26, 2020 7:29 pm It is best if you set your WIFI transmitter router to use a channel someone else is not using.
Selecting the proper WiFi channel can significantly improve your WiFi coverage and performance. In the 2.4 GHz band, 1, 6, and 11 are the only non-overlapping channels. Selecting one or more of these channels is an important part of setting up your network correctly.

Each channel on the 2.4 GHz spectrum is 20 MHz wide. The channel centers are separated by 5 MHz, and the entire spectrum is only 100 MHz wide. This means the 11 channels have to squeeze into the 100 MHz available, and in the end, overlap.

However, there are three channels that don’t overlap: 1, 6 and 11. Co-channel interference is where devices take turns talking, so the more devices on one channel, the longer it takes for a device to talk since it has to wait for its turn.
Hi Bigpup - can you translate this a bit for me? Is it saying that channels 1,6 and 11 should be the go-to channels or the ones to avoid?
cheers!
User avatar
bigpup
Moderator
Posts: 6993
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 911 times
Been thanked: 1528 times

Re: SNS connection display - intermittent error in 32-bit pups

Post by bigpup »

Yes.
Try to use 1, 6, 11 channels.

However, look at what channels are being used by the other WIFI transmitters in your area that you can scan and see.

Try to pick a channel others are not using.
Even if it has to be something besides 1, 6, and 11.
However, say only one other on channel 1, but other channels have several people.
channel 1 may be best to use.

In a multiple wifi transmitters area.
it can be, try and see what channel just works best.

The thing about overlapping channels.
If you can, pick one that is not overlapping one someone else is using.
Even though there are 11 channels available in 2.4GHz, only 3 of them do not “overlap” or interfere with one other: 1, 6, and 11. Channels 2-5 interfere with 1 and 6, while 7-10 interfere with 6 and 11. Without getting too deep on how wireless communication happens, when a station (Access Point, client device, etc.) has something to transmit, it must wait for the channel to be clear. Put simply, only one device can transmit at a time. When overlapping channels are used (2-5, 7-10 in 2.4GHz), any stations (STAs) on those channels will transmit independent of what is happening on the other channels, causing a degradation of performance. This type of interference is called Adjacent Channel Interference (ACI).

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: SNS connection display - intermittent error in 32-bit pups

Post by greengeek »

bigpup wrote: Mon Sep 28, 2020 7:12 am Yes.
Try to use 1, 6, 11 channels...
Try to pick a channel others are not using.
Thanks Bigpup - channel 1 looks tasty. Less cluttered than the others.
Cheers!
User avatar
rerwin
Posts: 156
Joined: Fri Jul 17, 2020 4:35 pm
Location: Maine, USA
Has thanked: 1 time
Been thanked: 82 times

Re: SNS connection display - intermittent error in 32-bit pups

Post by rerwin »

greengeek,

Sorry to be so silent about this issue. I just now found this thread. Thank you for your analysis of the problem.

I am working on a new version of SNS that avoids using ifconfig, iwconfig and iwlist, because they are deprecated. The replacement for iwlist (iw dev wlan0 scan) does not return the Quality value, so I will need to rely on the Signal value. I will code for the sort so that it handles positive dBm values even though they are bogus.

BTW, the "bar" determination uses the Quality value, so will need to be converted to use Signal. Does anyone have advice as to the dBm values for determining the five bars? I understand that they are logarithmic but have forgotten how that works. I need to approximate five steps of intensity. EDIT: I found the information I need for creating the bars.

EDIT:
You can fix the problem by editing the line that begins "SRLINES=" by changing:
\(-[0-9][0-9]*\)

to:
\([0-9-]\+\)

in 2 places.

Richard
Last edited by rerwin on Sat Oct 03, 2020 3:12 pm, edited 1 time in total.
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: SNS connection display - intermittent error in 32-bit pups

Post by greengeek »

rerwin wrote: Tue Sep 29, 2020 3:29 pm EDIT:
You can fix the problem by editing the line that begins "SRLINES=" by changing:
\(-[0-9][0-9]*\)

to:
\([0-9-]\+\)

in 2 places.
Many thanks Rerwin!
Confirmed as working. I just put my laptop right next to the router and was seeing signal strength of 11dBm being detected by sns - but with your mod it correctly displays my network at the top of the list now.

I guess this is the code for the Quality bars calculation:

Code: Select all

   IMG_QUALITY=quality_0
   QTY=$(echo "100"'*'"$CELL_QUALITY" | bc)
   if   [ $QTY -gt 80 ]; then IMG_QUALITY=quality_5
   elif [ $QTY -gt 60 ]; then IMG_QUALITY=quality_4
   elif [ $QTY -gt 40 ]; then IMG_QUALITY=quality_3
   elif [ $QTY -gt 20 ]; then IMG_QUALITY=quality_2
   elif [ $QTY -gt 5 ] ; then IMG_QUALITY=quality_1
   fi
I guess maybe the same thing could be done with dBm but assuming a range from say +15 to -90dBm and probably even ignoring the logarithmic steps?

I would think that the main importance of the bars would be as a guide to relativity between networks (ie which looks strongest) rather than actual magnitude of strength?

Thanks for the help - that has given me what i was looking for.
Cheers!
Post Reply

Return to “Bug Reports”