Fix for Quality/Signal level output variations#199
Fix for Quality/Signal level output variations#199darryllee wants to merge 2 commits intoKanoComputing:jessiefrom
Conversation
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
|
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.
|
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. :-{ |
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:0The original parser only accounts for Quality/Signal level in this format:
Quality=72/100 Signal level=65/100This 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.