1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-24 15:12:31 +01:00

return 101 as the signal strength if altstrenth_pattern fails to find the strength

This commit is contained in:
Adam Blackburn
2009-06-20 13:42:21 -05:00
parent 086ba48486
commit 96a7d07bca

View File

@@ -1366,7 +1366,14 @@ class BaseWirelessInterface(BaseInterface):
(strength, max_strength) = (None, None)
if strength in ['', None]:
[(strength, max_strength)] = altstrength_pattern.findall(output)
try:
[(strength, max_strength)] = altstrength_pattern.findall(output)
except ValueError:
# if the pattern was unable to match anything
# we'll return 101, which will allow us to stay
# connected even though we don't know the strength
# it also allows us to tell if
return 101
if strength not in ['', None] and max_strength:
return (100 * int(strength) // int(max_strength))
elif strength not in ["", None]: