mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
Determine valid wpa_supplicant drivers by parsing the list from wpa_supplicant, rather than comparing it's output to a static list of possible drivers.
This commit is contained in:
@@ -294,9 +294,7 @@ class PrefsDialog(urwid.WidgetWrap):
|
||||
|
||||
### Advanced settings
|
||||
# wpa_supplicant janx
|
||||
self.wpadrivers = ["wext", "hostap", "madwifi", "atmel",
|
||||
"ndiswrapper", "ipw"]
|
||||
self.wpadrivers = wireless.GetWpaSupplicantDrivers(self.wpadrivers)
|
||||
self.wpadrivers = wireless.GetWpaSupplicantDrivers()
|
||||
self.wpadrivers.append("ralink_legacy")
|
||||
# Same as above with the dbus.String
|
||||
self.thedrivers = [unicode(w) for w in self.wpadrivers]
|
||||
|
||||
@@ -31,7 +31,7 @@ class WirelessInterface() -- Control a wireless network interface.
|
||||
|
||||
from wicd.wnettools import GetDefaultGateway, GetWiredInterfaces, \
|
||||
GetWirelessInterfaces, IsValidWpaSuppDriver, BaseWirelessInterface, \
|
||||
BaseWiredInterface, BaseInterface
|
||||
BaseWiredInterface, BaseInterface, GetWpaSupplicantDrivers
|
||||
|
||||
NAME = "external"
|
||||
UPDATE_INTERVAL = 5
|
||||
|
||||
@@ -34,7 +34,8 @@ from wicd import misc
|
||||
from wicd import wpath
|
||||
from wicd.wnettools import GetDefaultGateway, GetWiredInterfaces, \
|
||||
GetWirelessInterfaces, IsValidWpaSuppDriver, BaseWirelessInterface, \
|
||||
BaseWiredInterface, BaseInterface, wep_pattern, signaldbm_pattern, neediface
|
||||
BaseWiredInterface, BaseInterface, GetWpaSupplicantDrivers, wep_pattern, \
|
||||
signaldbm_pattern, neediface
|
||||
|
||||
try:
|
||||
import iwscan
|
||||
|
||||
@@ -703,10 +703,9 @@ class Wireless(Controller):
|
||||
""" Get the out of iwconfig. """
|
||||
return self.wiface.GetIwconfig()
|
||||
|
||||
def GetWpaSupplicantDrivers(self, drivers):
|
||||
""" Returns all valid wpa_supplicant drivers in a list. """
|
||||
return [driver for driver in drivers if
|
||||
BACKEND.IsValidWpaSuppDriver(driver)]
|
||||
def GetWpaSupplicantDrivers(self):
|
||||
""" Returns all valid wpa_supplicant drivers on the system. """
|
||||
return BACKEND.GetWpaSupplicantDrivers()
|
||||
|
||||
def StopWPA(self):
|
||||
return self.wiface.StopWPA()
|
||||
|
||||
@@ -375,9 +375,7 @@ class PreferencesDialog(object):
|
||||
|
||||
# Replacement for the combo box hack
|
||||
self.wpadrivercombo = build_combobox("pref_wpa_combobox")
|
||||
self.wpadrivers = ["wext", "hostap", "madwifi", "atmel",
|
||||
"ndiswrapper", "ipw"]
|
||||
self.wpadrivers = wireless.GetWpaSupplicantDrivers(self.wpadrivers)
|
||||
self.wpadrivers = wireless.GetWpaSupplicantDrivers()
|
||||
self.wpadrivers.append("ralink_legacy")
|
||||
|
||||
for x in self.wpadrivers:
|
||||
|
||||
@@ -1269,9 +1269,9 @@ class WirelessDaemon(dbus.service.Object):
|
||||
self.config.remove_section(essid_key)
|
||||
|
||||
@dbus.service.method('org.wicd.daemon.wireless')
|
||||
def GetWpaSupplicantDrivers(self, drivers):
|
||||
""" Returns all valid wpa_supplicant drivers in a given list. """
|
||||
return self.wifi.GetWpaSupplicantDrivers(drivers)
|
||||
def GetWpaSupplicantDrivers(self):
|
||||
""" Returns all valid wpa_supplicant drivers. """
|
||||
return self.wifi.GetWpaSupplicantDrivers()
|
||||
|
||||
@dbus.service.method('org.wicd.daemon.wireless')
|
||||
def ReloadConfig(self):
|
||||
|
||||
@@ -155,6 +155,17 @@ def NeedsExternalCalls():
|
||||
""" Returns True if the backend needs to use an external program. """
|
||||
raise NotImplementedError
|
||||
|
||||
def GetWpaSupplicantDrivers():
|
||||
""" Returns a list of all valid wpa_supplicant drivers. """
|
||||
output = misc.Run(["wpa_supplicant", "-h"])
|
||||
try:
|
||||
output = output.split("drivers:")[1].split("options:")[0].strip()
|
||||
except:
|
||||
print "Warning: Couldn't get list of valid wpa_supplicant drivers"
|
||||
return [""]
|
||||
patt = re.compile("(\S+)\s+=.*")
|
||||
return patt.findall(output) or [""]
|
||||
|
||||
def IsValidWpaSuppDriver(driver):
|
||||
""" Returns True if given string is a valid wpa_supplicant driver. """
|
||||
output = misc.Run(["wpa_supplicant", "-D%s" % driver, "-iolan19",
|
||||
|
||||
Reference in New Issue
Block a user