Skip to content

Comments

Fix for Quality/Signal level output variations#199

Open
darryllee wants to merge 2 commits intoKanoComputing:jessiefrom
darryllee:patch-3
Open

Fix for Quality/Signal level output variations#199
darryllee wants to merge 2 commits intoKanoComputing:jessiefrom
darryllee:patch-3

Conversation

@darryllee
Copy link

As mentioned in #198, the format of Quality and Signal level changes when iwlist cannot get a range for some Access Points (or perhaps it's related to the wireless driver). At any rate, I've observed a 2Wire/AT&T U-verse router showing:

Quality:40 Signal level:0 Noise level:0

The original parser only accounts for Quality/Signal level in this format:

Quality=72/100 Signal level=65/100

This change accommodates the possibility of for a colon in addition to an equals sign, and also can handle an integer value for Quality as opposed to a fraction.

As mentioned in KanoComputing#198, the format of Quality and Signal level changes when iwlist cannot get a range for some Access Points (or perhaps it's related to the wireless driver). At any rate, I've observed a 2Wire/AT&T U-verse router showing:

`Quality:40  Signal level:0  Noise level:0`

The original parser only accounts for Quality/Signal level in this format:

`Quality=72/100  Signal level=65/100`

This change accommodates the possibility of for a colon in addition to an equals sign, and also can handle an integer value for Quality as opposed to a fraction.
kano/network.py Outdated
x, z = adict['quality'].split('/')
factor = int(x) / float(z)
else:
factor = int(adict['quality']) / 100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you need to either float(adict['quality']) or use 100., else the factor will be an integer and almost certainly always be 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I'm not familiar with the intricacies of float v integer operations in Python (old Perl hacker). Adding a decimal point is an elegant fix, but since I'm a noob I'll use the float() to make it more obvious. Thanks!

@tombettany
Copy link
Member

Other than the small comment above - it looks good. After the above is fixed, I will test it.

Let's make sure factor doesn't just result in 0 or 1.
@darryllee
Copy link
Author

So uh, hey, my son wanted to mess around with Kano after some time away, and I didn't know where the right card was, so I downloaded the latest Beta, 3.15.0. Unfortunately we ran into the same bug that I filed 2 years ago. And my changes fixed the problem (again). Can somebody please merge this? I'd be surprised that this hasn't stopped others from being able to get on wireless. :-{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants