1
0
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:
Dan O'Reilly
2009-10-30 23:52:30 -04:00
parent 0872e1b329
commit a45beaeeaf
7 changed files with 22 additions and 15 deletions

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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:

View File

@@ -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):

View File

@@ -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",