diff options
| author | acid-burn <acid-burn@opendreambox.org> | 2010-07-24 23:14:58 +0200 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2010-07-27 00:28:35 +0200 |
| commit | 6be1855d457d28e25917a29f710f2401519d7160 (patch) | |
| tree | 98594882fb891c9e2d5ebae7f6260f34354976d7 /lib/python/Components | |
| parent | a4dbb3a4ca8e0926250cbe7be76291448e5e1f56 (diff) | |
| download | enigma2-6be1855d457d28e25917a29f710f2401519d7160.tar.gz enigma2-6be1855d457d28e25917a29f710f2401519d7160.zip | |
Enigma2-Network: update Wlan plugin to support new python-wifi.
some fixes and cleanups.
refs #558
Diffstat (limited to 'lib/python/Components')
| -rwxr-xr-x[-rw-r--r--] | lib/python/Components/About.py | 11 | ||||
| -rwxr-xr-x | lib/python/Components/Network.py | 54 |
2 files changed, 47 insertions, 18 deletions
diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py index 8e332e33..6b322c9d 100644..100755 --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -1,5 +1,6 @@ from Tools.Directories import resolveFilename, SCOPE_SYSETC from enigma import getEnigmaVersionString +from os import popen class About: def __init__(self): @@ -43,4 +44,14 @@ class About: def getEnigmaVersionString(self): return getEnigmaVersionString() + def getKernelVersionString(self): + try: + result = popen("uname -r","r").read().strip("\n").split('-') + kernel_version = result[0] + return kernel_version + except: + pass + + return "unknown" + about = About() diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index e8a3d459..e980cb8c 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -4,6 +4,7 @@ from socket import * from enigma import eConsoleAppContainer from Components.Console import Console from Components.PluginComponent import plugins +from Components.About import about from Plugins.Plugin import PluginDescriptor class Network: @@ -349,8 +350,10 @@ class Network: return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") elif os_path.realpath(driverdir).endswith('rt73'): return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73usb'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") else: - return _("Unknown network adapter.") + return str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") else: return _("Unknown network adapter.") @@ -606,24 +609,39 @@ class Network: if callback is not None: callback(True) - def detectWlanModule(self): + def detectWlanModule(self, iface = None): self.wlanmodule = None - rt73_dir = "/sys/bus/usb/drivers/rt73/" - zd1211b_dir = "/sys/bus/usb/drivers/zd1211b/" - madwifi_dir = "/sys/bus/pci/drivers/ath_pci/" - if os_path.exists(madwifi_dir): - files = listdir(madwifi_dir) - if len(files) >= 1: - self.wlanmodule = 'madwifi' - if os_path.exists(rt73_dir): - rtfiles = listdir(rt73_dir) - if len(rtfiles) == 2 or len(rtfiles) == 5: - self.wlanmodule = 'ralink' - if os_path.exists(zd1211b_dir): - zdfiles = listdir(zd1211b_dir) - if len(zdfiles) == 1 or len(zdfiles) == 5: - self.wlanmodule = 'zydas' - return self.wlanmodule + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + classfiles = listdir(classdir) + driver_found = False + nl80211_found = False + for x in classfiles: + if x == 'driver': + driver_found = True + if x.startswith('ieee80211:'): + nl80211_found = True + + if driver_found and nl80211_found: + #print about.getKernelVersionString() + self.wlanmodule = "nl80211" + else: + if driver_found and not nl80211_found: + driverfiles = listdir(driverdir) + if os_path.realpath(driverdir).endswith('ath_pci'): + if len(driverfiles) >= 1: + self.wlanmodule = 'madwifi' + if os_path.realpath(driverdir).endswith('rt73'): + if len(driverfiles) == 2 or len(driverfiles) == 5: + self.wlanmodule = 'ralink' + if os_path.realpath(driverdir).endswith('zd1211b'): + if len(driverfiles) == 1 or len(driverfiles) == 5: + self.wlanmodule = 'zydas' + if self.wlanmodule is None: + self.wlanmodule = "wext" + print 'Using "%s" as wpa-supplicant driver' % (self.wlanmodule) + return self.wlanmodule def calc_netmask(self,nmask): from struct import pack, unpack |
