mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 04:48:00 +01:00
Applied pach in https://bugs.launchpad.net/wicd/+bug/175104 to fix signal strength issues, thanks Philip
This commit is contained in:
@@ -333,7 +333,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
if fresh:
|
if fresh:
|
||||||
self.Scan()
|
self.Scan()
|
||||||
#self.AutoConnectScan() # Also scans for hidden networks
|
#self.AutoConnectScan() # Also scans for hidden networks
|
||||||
if self.CheckPluggedIn() == True:
|
if self.CheckPluggedIn() == True and self.:
|
||||||
if self.GetWiredAutoConnectMethod() == 2:
|
if self.GetWiredAutoConnectMethod() == 2:
|
||||||
self.LaunchChooser()
|
self.LaunchChooser()
|
||||||
else:
|
else:
|
||||||
@@ -385,7 +385,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetCurrentInterface(self, iface):
|
def SetCurrentInterface(self, iface):
|
||||||
self.current_interface = iface
|
self.current_interface = str(iface)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetNeedWiredProfileChooser(self,val):
|
def SetNeedWiredProfileChooser(self,val):
|
||||||
@@ -394,7 +394,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetNeedWiredProfileChooser(self):
|
def GetNeedWiredProfileChooser(self):
|
||||||
return self.need_profile_chooser
|
return bool(self.need_profile_chooser)
|
||||||
#end function GetNeedWiredProfileChooser
|
#end function GetNeedWiredProfileChooser
|
||||||
|
|
||||||
@dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
|
@dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
|
||||||
|
|||||||
28
wnettools.py
28
wnettools.py
@@ -39,7 +39,7 @@ import wpath
|
|||||||
essid_pattern = re.compile('.*ESSID:"(.*?)"\n', re.DOTALL | re.I | re.M | re.S)
|
essid_pattern = re.compile('.*ESSID:"(.*?)"\n', re.DOTALL | re.I | re.M | re.S)
|
||||||
ap_mac_pattern = re.compile('.*Address: (.*?)\n',re.DOTALL | re.I | re.M | re.S)
|
ap_mac_pattern = re.compile('.*Address: (.*?)\n',re.DOTALL | re.I | re.M | re.S)
|
||||||
channel_pattern = re.compile('.*Channel:? ?(\d\d?)',re.DOTALL | re.I | re.M | re.S)
|
channel_pattern = re.compile('.*Channel:? ?(\d\d?)',re.DOTALL | re.I | re.M | re.S)
|
||||||
strength_pattern = re.compile('.*Quality:?=? ?(\d\d*)',re.DOTALL | re.I | re.M | re.S)
|
strength_pattern = re.compile('.*Quality:?=? ?(\d+)\s*/?\s*(\d*)',re.DOTALL | re.I | re.M | re.S)
|
||||||
# These next two look a lot a like, altstrength is for Signal level = xx/100,
|
# These next two look a lot a like, altstrength is for Signal level = xx/100,
|
||||||
# which is just an alternate way of displaying link quality, signaldbm is
|
# which is just an alternate way of displaying link quality, signaldbm is
|
||||||
# for displaying actual signal strength (-xx dBm).
|
# for displaying actual signal strength (-xx dBm).
|
||||||
@@ -261,6 +261,8 @@ class WirelessInterface(Interface):
|
|||||||
|
|
||||||
# Split the networks apart, using Cell as our split point
|
# Split the networks apart, using Cell as our split point
|
||||||
# this way we can look at only one network at a time.
|
# this way we can look at only one network at a time.
|
||||||
|
# the spaces around ' Cell ' are to minimize the chance that someone
|
||||||
|
# has an essid named Cell...
|
||||||
networks = results.split( ' Cell ' )
|
networks = results.split( ' Cell ' )
|
||||||
|
|
||||||
# Get available network info from iwpriv get_site_survey
|
# Get available network info from iwpriv get_site_survey
|
||||||
@@ -390,8 +392,15 @@ class WirelessInterface(Interface):
|
|||||||
|
|
||||||
# Link Quality
|
# Link Quality
|
||||||
# Set strength to -1 if the quality is not found
|
# Set strength to -1 if the quality is not found
|
||||||
if misc.RunRegex(strength_pattern,cell):
|
|
||||||
ap['quality'] = misc.RunRegex(strength_pattern,cell)
|
# more of the patch from
|
||||||
|
# https://bugs.launchpad.net/wicd/+bug/175104
|
||||||
|
if (strength_pattern.match(cell)):
|
||||||
|
[(strength, max_strength)] = strength_pattern.findall(cell)
|
||||||
|
if max_strength:
|
||||||
|
CurrentNetwork["quality"] = 100 * int(strength) // int(max_strength)
|
||||||
|
else:
|
||||||
|
CurrentNetwork["quality"] = int(strength)
|
||||||
elif misc.RunRegex(altstrength_pattern,cell):
|
elif misc.RunRegex(altstrength_pattern,cell):
|
||||||
ap['quality'] = misc.RunRegex(altstrength_pattern,cell)
|
ap['quality'] = misc.RunRegex(altstrength_pattern,cell)
|
||||||
else:
|
else:
|
||||||
@@ -588,10 +597,19 @@ class WirelessInterface(Interface):
|
|||||||
cmd = 'iwconfig ' + self.iface
|
cmd = 'iwconfig ' + self.iface
|
||||||
# if self.verbose: print cmd
|
# if self.verbose: print cmd
|
||||||
output = misc.Run(cmd)
|
output = misc.Run(cmd)
|
||||||
strength = misc.RunRegex(strength_pattern,output)
|
# implemented the patch provided in
|
||||||
|
# https://bugs.launchpad.net/wicd/+bug/175104
|
||||||
|
# it was for the stable version, so I've improvised here
|
||||||
|
# should work though
|
||||||
|
|
||||||
|
#strength = misc.RunRegex(strength_pattern,output)
|
||||||
|
|
||||||
|
[(strength, max_strength)] = strength_pattern.findall(output)
|
||||||
|
if max_strength and strength:
|
||||||
|
return 100 * int(strength) // int(max_strength)
|
||||||
|
|
||||||
if strength == None:
|
if strength == None:
|
||||||
strength = misc.RunRegex(altstrength_pattern,output)
|
strength = misc.RunRegex(altstrength_pattern,output)
|
||||||
|
|
||||||
return strength
|
return strength
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user