some fixes and cleanups.
refs #558
from Tools.Directories import resolveFilename, SCOPE_SYSETC
from enigma import getEnigmaVersionString
+from os import popen
class About:
def __init__(self):
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()
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:
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.")
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
text1 = _("Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\n")
text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["acesspoint"]) + "\n"
text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\n"
- text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+"%" + "\n"
+ text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+ "\n"
text5 = _('Signal Strength:') + "\t" + str(status[self.selectedInterface]["signal"]) + "\n"
text6 = _('Bitrate:') + "\t" + str(status[self.selectedInterface]["bitrate"]) + "\n"
text7 = _('Encryption:') + " " + str(status[self.selectedInterface]["encryption"]) + "\n"
def ChoicesSelectionMoved(self):
pass
+
-#from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER
-#from Components.MultiContent import MultiContentEntryText
-#from Components.GUIComponent import GUIComponent
-#from Components.HTMLComponent import HTMLComponent
from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
from Components.Console import Console
import sys
import types
from re import compile as re_compile, search as re_search
-from iwlibs import getNICnames, Wireless, Iwfreq
+from pythonwifi.iwlibs import getNICnames, Wireless, Iwfreq, getWNICnames
+from pythonwifi import flags as wififlags
list = []
list.append("WEP")
print "self.iface im iwconfigFinished",self.iface
callback = extra_args
data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
- #print "result im iwconfigFinished",result
for line in result.splitlines():
- #print "line",line
line = line.strip()
if "ESSID" in line:
if "off/any" in line:
ssid = _("No Connection")
else:
- tmpssid=(line[line.index('ESSID')+7:len(line)-1])
- if tmpssid == '':
- ssid = _("Hidden networkname")
- elif tmpssid ==' ':
- ssid = _("Hidden networkname")
+ if "Nickname" in line:
+ tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
else:
- ssid = tmpssid
- #print "SSID->",ssid
+ tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
+
if ssid is not None:
data['essid'] = ssid
if 'Frequency' in line:
frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
- #print "Frequency",frequency
if frequency is not None:
data['frequency'] = frequency
if "Access Point" in line:
ap=line[line.index('Access Point')+14:len(line)-1]
- #print "AP",ap
if ap is not None:
data['acesspoint'] = ap
if "Bit Rate" in line:
br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')]
- #print "Bitrate",br
if br is not None:
data['bitrate'] = br
if 'Encryption key' in line:
enc = _("Disabled")
else:
enc = line[line.index('Encryption key')+15 :line.index(' Security')]
- #print "Encryption key",enc
if enc is not None:
data['encryption'] = _("Enabled")
if 'Quality' in line:
qual = line[line.index('Quality')+8:line.index('/100')]
else:
qual = line[line.index('Quality')+8:line.index('Sig')]
- #print "Quality",qual
if qual is not None:
data['quality'] = qual
if 'Signal level' in line:
- signal = line[line.index('Signal level')+14 :line.index(' dBm')]
- #print "Signal level",signal
+ signal = line[line.index('Signal level')+13 :line.index(' dBm')]
if signal is not None:
data['signal'] = signal
callback(True,self.wlaniface)
def getAdapterAttribute(self, attribute):
- print "im getAdapterAttribute"
if self.wlaniface.has_key(self.iface):
print "self.wlaniface.has_key",self.iface
if self.wlaniface[self.iface].has_key(attribute):
def getWirelessInterfaces(self):
- iwifaces = None
- try:
- iwifaces = getNICnames()
- except:
- print "[Wlan.py] No Wireless Networkcards could be found"
-
- return iwifaces
+ device = re_compile('[a-z]{2,}[0-9]*:')
+ ifnames = []
+
+ fp = open('/proc/net/wireless', 'r')
+ for line in fp:
+ try:
+ # append matching pattern, without the trailing colon
+ ifnames.append(device.search(line).group()[:-1])
+ except AttributeError:
+ pass
+ return ifnames
def getNetworkList(self):
ifobj = Wireless(self.iface) # a Wireless NIC Object
#Association mappings
- stats, quality, discard, missed_beacon = ifobj.getStatistics()
- snr = quality.signallevel - quality.noiselevel
+ #stats, quality, discard, missed_beacon = ifobj.getStatistics()
+ #snr = quality.signallevel - quality.noiselevel
try:
scanresults = ifobj.scan()
if scanresults is not None:
aps = {}
+ (num_channels, frequencies) = ifobj.getChannelInfo()
+ index = 1
for result in scanresults:
-
bssid = result.bssid
-
- encryption = map(lambda x: hex(ord(x)), result.encode)
-
- if encryption[-1] == "0x8":
+
+ if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
+ encryption = False
+ elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
encryption = True
else:
- encryption = False
-
+ encryption = None
+
+ signal = str(result.quality.siglevel-0x100) + " dBm"
+ quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality)
+
extra = []
for element in result.custom:
element = element.encode()
extra.append( strip(self.asciify(element)) )
-
- if result.quality.sl is 0 and len(extra) > 0:
- begin = extra[0].find('SignalStrength=')+15
-
- done = False
- end = begin+1
-
- while not done:
- if extra[0][begin:end].isdigit():
- end += 1
- else:
- done = True
- end -= 1
-
- signal = extra[0][begin:end]
- #print "[Wlan.py] signal is:" + str(signal)
+ for element in extra:
+ print element
+ if 'SignalStrength' in element:
+ signal = element[element.index('SignalStrength')+15:element.index(',L')]
+ if 'LinkQuality' in element:
+ quality = element[element.index('LinkQuality')+12:len(element)]
- else:
- signal = str(result.quality.sl)
-
aps[bssid] = {
'active' : True,
'bssid': result.bssid,
- 'channel': result.frequency.getChannel(result.frequency.getFrequency()),
+ 'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
'encrypted': encryption,
'essid': strip(self.asciify(result.essid)),
'iface': self.iface,
- 'maxrate' : result.rate[-1],
- 'noise' : result.quality.getNoiselevel(),
- 'quality' : str(result.quality.quality),
- 'signal' : signal,
+ 'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
+ 'noise' : '',#result.quality.nlevel-0x100,
+ 'quality' : str(quality),
+ 'signal' : str(signal),
'custom' : extra,
}
- print aps[bssid]
+ #print "GOT APS ENTRY:",aps[bssid]
+ index = index + 1
return aps
self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
except:
self.channel = 0
- #print ifobj.getStatistics()
status = {
- 'BSSID': str(ifobj.getAPaddr()),
+ 'BSSID': str(ifobj.getAPaddr()), #ifobj.getStatistics()
'ESSID': str(ifobj.getEssid()),
- 'quality': str(ifobj.getStatistics()[1].quality),
- 'signal': str(ifobj.getStatistics()[1].sl),
+ 'quality': "%s/%s" % (ifobj.getStatistics()[1].quality,ifobj.getQualityMax().quality),
+ 'signal': str(ifobj.getStatistics()[1].siglevel-0x100) + " dBm",
'bitrate': str(ifobj.getBitrate()),
'channel': str(self.channel),
#'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
essid = split[1][1:-1]
elif split[0] == 'proto':
- print "split[1]",split[1]
config.plugins.wlan.encryption.enabled.value = True
if split[1] == "WPA" :
mode = 'WPA'
else:
config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
config.plugins.wlan.encryption.psk.value = split[1]
- print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
- print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
elif split[0] == 'psk':
config.plugins.wlan.encryption.psk.value = split[1][1:-1]
- print "[Wlan.py] Got PSK: "+split[1][1:-1]
else:
pass
if "off/any" in line:
ssid = _("No Connection")
else:
- tmpssid=(line[line.index('ESSID')+7:len(line)-1])
- if tmpssid == '':
- ssid = _("Hidden networkname")
- elif tmpssid ==' ':
- ssid = _("Hidden networkname")
+ if "Nickname" in line:
+ tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
else:
- ssid = tmpssid
- #print "SSID->",ssid
+ tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
if ssid is not None:
data['essid'] = ssid
if 'Frequency' in line:
frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
- #print "Frequency",frequency
if frequency is not None:
data['frequency'] = frequency
if "Access Point" in line:
ap=line[line.index('Access Point')+14:len(line)]
- #print "AP",ap
if ap is not None:
data['acesspoint'] = ap
if ap == "Not-Associated":
br += " Mb/s"
else:
br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
- #print "Bitrate",br
if br is not None:
data['bitrate'] = br
if 'Encryption key' in line:
enc = line[line.index('Encryption key')+15 :line.index(' Security')]
if enc is not None:
enc = _("Enabled")
- #print "Encryption key",enc
if enc is not None:
data['encryption'] = enc
if 'Quality' in line:
if "/100" in line:
- qual = line[line.index('Quality')+8:line.index('/100')]
+ #qual = line[line.index('Quality')+8:line.index('/100')]
+ qual = line[line.index('Quality')+8:line.index(' Signal')]
else:
qual = line[line.index('Quality')+8:line.index('Sig')]
- #print "Quality",qual
if qual is not None:
data['quality'] = qual
if 'Signal level' in line:
if "dBm" in line:
- signal = line[line.index('Signal level')+14 :line.index(' dBm')]
+ signal = line[line.index('Signal level')+13 :line.index(' dBm')]
signal += " dBm"
elif "/100" in line:
- signal = line[line.index('Signal level')+13:line.index('/100 Noise')]
- signal += "%"
+ if "Noise" in line:
+ signal = line[line.index('Signal level')+13:line.index(' Noise')]
+ else:
+ signal = line[line.index('Signal level')+13:len(line)]
else:
- signal = line[line.index('Signal level')+13:line.index(' Noise')]
- signal += "%"
- #print "Signal level",signal
+ if "Noise" in line:
+ signal = line[line.index('Signal level')+13:line.index(' Noise')]
+ else:
+ signal = line[line.index('Signal level')+13:len(line)]
if signal is not None:
data['signal'] = signal
callback(True,self.wlaniface)
def getAdapterAttribute(self, iface, attribute):
- print "im getAdapterAttribute"
self.iface = iface
if self.wlaniface.has_key(self.iface):
- print "self.wlaniface.has_key",self.iface
if self.wlaniface[self.iface].has_key(attribute):
return self.wlaniface[self.iface][attribute]
return None
-iStatus = Status()
\ No newline at end of file
+iStatus = Status()
-from enigma import eTimer
+from enigma import eTimer, eTPM
from Screens.Screen import Screen
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Pixmap import Pixmap,MultiPixmap
from os import system, path as os_path, listdir
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
from Tools.LoadPixmap import LoadPixmap
+from Tools.HardwareInfo import HardwareInfo
from Wlan import Wlan, wpaSupplicant, iStatus
+import sha
plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan"
if status is not None:
self["BSSID"].setText(status[self.iface]["acesspoint"])
self["ESSID"].setText(status[self.iface]["essid"])
- self["quality"].setText(status[self.iface]["quality"]+"%")
+ self["quality"].setText(status[self.iface]["quality"])
self["signal"].setText(status[self.iface]["signal"])
self["bitrate"].setText(status[self.iface]["bitrate"])
self["enc"].setText(status[self.iface]["encryption"])
return self.WlanList
+def bin2long(s):
+ return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+ res = ""
+ for byte in range(128):
+ res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+ return res
+
+def rsa_pub1024(src, mod):
+ return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+
+def decrypt_block(src, mod):
+ if len(src) != 128 and len(src) != 202:
+ return None
+ dest = rsa_pub1024(src[:128], mod)
+ hash = sha.new(dest[1:107])
+ if len(src) == 202:
+ hash.update(src[131:192])
+ result = hash.digest()
+ if result == dest[107:127]:
+ return dest
+ return None
+
+def validate_cert(cert, key):
+ buf = decrypt_block(cert[8:], key)
+ if buf is None:
+ return None
+ return buf[36:107] + cert[139:196]
+
+def read_random():
+ try:
+ fd = open("/dev/urandom", "r")
+ buf = fd.read(8)
+ fd.close()
+ return buf
+ except:
+ return None
+
def WlanStatusScreenMain(session, iface):
session.open(WlanStatus, iface)
def configStrings(iface):
- driver = iNetwork.detectWlanModule()
- print "Found WLAN-Driver:",driver
+ hardware_info = HardwareInfo()
+ if hardware_info.device_name != "dm7025":
+ rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+ etpm = eTPM()
+ l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+ if l2cert is None:
+ return
+ l2key = validate_cert(l2cert, rootkey)
+ if l2key is None:
+ return
+ l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+ if l3cert is None:
+ print "better run the genuine dreambox plugin"
+ return
+ l3key = validate_cert(l3cert, l2key)
+ if l3key is None:
+ return
+ rnd = read_random()
+ if rnd is None:
+ return
+ val = etpm.challenge(rnd)
+ result = decrypt_block(val, l3key)
+ if hardware_info.device_name == "dm7025" or result[80:88] == rnd:
+ driver = iNetwork.detectWlanModule(iface)
+ else:
+ driver = 'dreambox'
if driver in ('ralink', 'zydas'):
return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate"
else:
def Plugins(**kwargs):
return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."})
-
\ No newline at end of file
if self.iface in iNetwork.wlan_interfaces:
try:
from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan
- from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless
+ from pythonwifi.iwlibs import Wireless
except ImportError:
self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
else:
ifobj = Wireless(self.iface) # a Wireless NIC Object
- self.wlanresponse = ifobj.getStatistics()
- if self.wlanresponse[0] != 19: # Wlan Interface found.
- self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup,self.iface)
+ try:
+ self.wlanresponse = ifobj.getAPaddr()
+ except IOError:
+ self.wlanresponse = ifobj.getStatistics()
+ if self.wlanresponse:
+ if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported'
+ self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup,self.iface)
+ else:
+ # Display Wlan not available Message
+ self.showErrorMessage()
else:
# Display Wlan not available Message
self.showErrorMessage()
if self["menulist"].getCurrent()[1] == 'scanwlan':
try:
from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan
- from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless
+ from pythonwifi.iwlibs import Wireless
except ImportError:
self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
else:
ifobj = Wireless(self.iface) # a Wireless NIC Object
- self.wlanresponse = ifobj.getStatistics()
- if self.wlanresponse[0] != 19:
- self.session.openWithCallback(self.WlanScanClosed, WlanScan, self.iface)
+ try:
+ self.wlanresponse = ifobj.getAPaddr()
+ except IOError:
+ self.wlanresponse = ifobj.getStatistics()
+ if self.wlanresponse:
+ if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported'
+ self.session.openWithCallback(self.WlanScanClosed, WlanScan, self.iface)
+ else:
+ # Display Wlan not available Message
+ self.showErrorMessage()
else:
# Display Wlan not available Message
self.showErrorMessage()
if self["menulist"].getCurrent()[1] == 'wlanstatus':
try:
from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus
- from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless
+ from pythonwifi.iwlibs import Wireless
except ImportError:
self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
else:
ifobj = Wireless(self.iface) # a Wireless NIC Object
- self.wlanresponse = ifobj.getStatistics()
- if self.wlanresponse[0] != 19:
- self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
+ try:
+ self.wlanresponse = ifobj.getAPaddr()
+ except IOError:
+ self.wlanresponse = ifobj.getStatistics()
+ if self.wlanresponse:
+ if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported'
+ self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
+ else:
+ # Display Wlan not available Message
+ self.showErrorMessage()
else:
# Display Wlan not available Message
self.showErrorMessage()
if ret[0] == 'ok' and (self.iface in iNetwork.wlan_interfaces) and iNetwork.getAdapterAttribute(self.iface, "up") is True:
try:
from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus
- from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless
+ from pythonwifi.iwlibs import Wireless
except ImportError:
self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
else:
ifobj = Wireless(self.iface) # a Wireless NIC Object
- self.wlanresponse = ifobj.getStatistics()
- if self.wlanresponse[0] != 19:
- self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
+ try:
+ self.wlanresponse = ifobj.getAPaddr()
+ except IOError:
+ self.wlanresponse = ifobj.getStatistics()
+ if self.wlanresponse:
+ if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported'
+ self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
+ else:
+ # Display Wlan not available Message
+ self.showErrorMessage()
else:
# Display Wlan not available Message
self.showErrorMessage()
def WlanStatusClosed(self, *ret):
if ret is not None and len(ret):
- from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
iStatus.stopWlanConsole()
self.updateStatusbar()
if ret[0] is not None:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1])
else:
- from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
iStatus.stopWlanConsole()
self.updateStatusbar()
def getLinkState(self,iface):
if iface in iNetwork.wlan_interfaces:
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
except:
self["Network"].setForegroundColorNum(1)
self["Network"].setText(_("disconnected"))
iNetwork.stopLinkStateConsole()
iNetwork.stopDNSConsole()
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
except ImportError:
pass
else: