import time
class WlanSelection(Screen,HelpableScreen):
- skin = """
- <screen name="WlanSelection" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
- <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
- <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
- <eLabel text="Wireless Network Adapter Selection..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
- <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
- <convert type="ClockToText">Format:%H:%M</convert>
- </widget>
- <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
- <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
- <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
- <widget name="menulist" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
- <widget source="description" render="Label" position="500,140" size="280,360" font="Regular;19" halign="center" valign="center" backgroundColor="#c5c9cc" transparent="1"/>
- </screen>"""
-
+ skin = """
+ <screen position="center,center" size="510,400" title="Wireless Network Adapter Selection..." >
+ <ePixmap pixmap="skin_default/div-h.png" position="0,350" zPosition="1" size="560,2" />
+ <ePixmap pixmap="skin_default/border_menu.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
+
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="360,360" size="140,40" alphatest="on" />
+
+ <widget source="key_red" render="Label" position="10,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+ <widget source="key_green" render="Label" position="360,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
+
+ <widget name="menulist" position="20,20" size="230,260" transparent="1" backgroundColor="#371e1c1a" zPosition="10" scrollbarMode="showOnDemand" />
+ <widget source="description" render="Label" position="305,10" size="195,300" font="Regular;19" halign="center" valign="center" />
+ </screen>
+ """
def __init__(self, session):
Screen.__init__(self,session)
HelpableScreen.__init__(self)
files = listdir(classdir)
if 'driver' in files:
if os_path.realpath(driverdir).endswith('rtw_usb_drv'):
- return _("Realtak")+ " " + _("WLAN adapter.")
+ return _("Realtek")+ " " + _("WLAN adapter.")
elif os_path.realpath(driverdir).endswith('ath_pci'):
return _("Atheros")+ " " + _("WLAN adapter.")
elif os_path.realpath(driverdir).endswith('zd1211b'):
iNetwork.stopGetInterfacesConsole()
class WlanSetup(Screen,HelpableScreen):
- skin = """
- <screen name="WlanSetup" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
- <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
- <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
- <eLabel text="Wireless Network Setup Menu..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
- <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
- <convert type="ClockToText">Format:%H:%M</convert>
- </widget>
- <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
- <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
- <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
- <widget name="menulist" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
- <widget source="description" render="Label" position="500,140" size="280,360" font="Regular;19" halign="center" valign="center" backgroundColor="#c5c9cc" transparent="1"/>
- </screen>"""
+ skin = """
+ <screen position="center,center" size="510,400" title="Wireless Network Setup Menu..." >
+ <ePixmap pixmap="skin_default/div-h.png" position="0,350" zPosition="1" size="560,2" />
+ <ePixmap pixmap="skin_default/border_menu.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
+
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="360,360" size="140,40" alphatest="on" />
+
+ <widget source="key_red" render="Label" position="10,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+ <widget source="key_green" render="Label" position="360,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
+
+ <widget name="menulist" position="20,20" size="230,260" transparent="1" backgroundColor="#371e1c1a" zPosition="10" scrollbarMode="showOnDemand" />
+ <widget source="description" render="Label" position="305,10" size="195,300" font="Regular;19" halign="center" valign="center" />
+ </screen>
+ """
def __init__(self, session, ifaces):
Screen.__init__(self, session)
HelpableScreen.__init__(self)
("wep", _("WEP")), ("wpa", _("WPA")), ("wpa2", _("WPA2")),("wpa/wpa2", _("WPA/WPA2"))])
wlanconfig.keytype = ConfigSelection(default = "ascii", choices = [
("ascii", _("ASCII")), ("hex", _("HEX"))])
-wlanconfig.key = ConfigText(default = "XXXXXXXX", visible_width = 50, fixed_size = False)
+wlanconfig.key = ConfigPassword(default = "XXXXXXXX", visible_width = 50, fixed_size = False)
wlanconfig.usegateway = ConfigSelection(default = "off", choices = [
("off", _("no")), ("on", _("yes"))])
wlanconfig.ip = ConfigIP([0,0,0,0])
selectap = None
class WlanConfig(Screen, ConfigListScreen, HelpableScreen):
- skin = """
- <screen name="WlanConfig" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
- <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
- <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
- <eLabel text="Wireless Network Configuration..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
- <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
- <convert type="ClockToText">Format:%H:%M</convert>
- </widget>
- <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
- <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
- <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="key_grean" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
- <widget name="config" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
- <eLabel text="IP Address : " position="500,160" size="200,26" font="Semiboldit;22" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <widget source="ipaddress" render="Label" position="530,190" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <eLabel text="NetMask : " position="500,220" size="200,26" font="Semiboldit;22" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <widget source="netmask" render="Label" position="530,250" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <eLabel text="Gateway : " position="500,280" size="200,26" font="Semiboldit;22" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <widget source="gateway" render="Label" position="530,310" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- </screen>"""
-
+ skin = """
+ <screen position="center,center" size="510,400" title="Wireless Network Configuration..." >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="360,360" size="140,40" alphatest="on" />
+
+ <widget source="key_red" render="Label" position="10,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+ <widget source="key_green" render="Label" position="360,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
+
+ <widget name="config" position="10,10" backgroundColor="#371e1c1a" transparent="1" size="480,210" scrollbarMode="showOnDemand" />
+ <ePixmap pixmap="skin_default/div-h.png" position="0,225" zPosition="1" size="550,2" />
+ <eLabel text="IP Address : " position="100,250" size="190,21" font="Regular;19" />
+ <widget source="ipaddress" render="Label" position="300,250" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" />
+ <eLabel text="NetMask : " position="100,275" size="190,21" font="Regular;19" />
+ <widget source="netmask" render="Label" position="300,275" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" />
+ <eLabel text="Gateway : " position="100,300" size="190,21" font="Regular;19" />
+ <widget source="gateway" render="Label" position="300,300" zPosition="1" size="150,26" font="Regular;20" halign="center" valign="center" />
+ </screen>
+ """
def __init__(self, session, iface):
Screen.__init__(self,session)
self.session = session
self["key_red"] = StaticText(_("Close"))
- self["key_grean"] = StaticText(_("Ok"))
+ self["key_green"] = StaticText(_("Ok"))
self["ipaddress"] = StaticText(_("[ N/A ]"))
self["netmask"] = StaticText(_("[ N/A ]"))
self["gateway"] = StaticText(_("[ N/A ]"))
self.key_type = None
self.encryption_key = None
self.wlanscanap = None
+ self.wpaphraseconsole = None
# self.scanAPcount =5
self.scanAPcount =1
self.list = []
wlanconfig.keytype = ConfigSelection(default = default_tmp, choices = [
("ascii", _("ASCII")), ("hex", _("HEX"))])
default_tmp = self.encryption_key or "XXXXXXXX"
- wlanconfig.key = ConfigText(default = default_tmp, visible_width = 50, fixed_size = False)
+# default_tmp = "XXXXXXXX"
+ wlanconfig.key = ConfigPassword(default = default_tmp, visible_width = 50, fixed_size = False)
self.scanAplistTimer.start(100,True)
def readWpaSupplicantConf(self):
elif data.startswith('psk="') and len(data) > 6:
self.key_type = 1 # ascii
self.encryption_key = data[5:-2]
- elif data.startswith('psk=') and len(data) > 4:
+ elif data.startswith('#psk="') and len(data) > 6:
+ self.key_type = 0 # hex
+ self.encryption_key = data[6:-2]
+ elif not self.encryption_key and data.startswith('psk=') and len(data) > 4:
self.key_type = 0 # hex
self.encryption_key = data[4:-1]
data = wpafd.readline()
self.configList.append( self.encryptEntry )
if wlanconfig.encrypt.value is "on" :
self.configList.append( self.methodEntry )
- self.configList.append( self.keytypeEntry )
+ if wlanconfig.method.value =="wep":
+ self.configList.append( self.keytypeEntry )
self.configList.append( self.keyEntry )
self["config"].list = self.configList
def newConfig(self):
if self["config"].getCurrent() == self.usedeviceEntry or self["config"].getCurrent() == self.encryptEntry \
or self["config"].getCurrent() == self.usedhcpEntry or self["config"].getCurrent() == self.usegatewayEntry \
- or self["config"].getCurrent() == self.essidEntry:
+ or self["config"].getCurrent() == self.essidEntry or self["config"].getCurrent() == self.methodEntry:
self.createConfig()
def saveWlanConfig(self):
- if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
- self["config"].getCurrent()[1].onDeselect(self.session)
- if self["config"].isChanged():
- self.session.openWithCallback(self.checkNetworkShares, MessageBox, (_("Are you sure you want to restart your network interfaces?\n") ) )
- else:
- self.session.openWithCallback(self.checkNetworkShares, MessageBox, (_("Network configuration is not changed....\n\nAre you sure you want to restart your network interfaces?\n") ) )
+ try:
+ if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
+ self["config"].getCurrent()[1].onDeselect(self.session)
+ if self["config"].isChanged():
+ self.session.openWithCallback(self.checkNetworkConfig, MessageBox, (_("Are you sure you want to restart your network interfaces?\n") ) )
+ else:
+ self.session.openWithCallback(self.checkNetworkConfig, MessageBox, (_("Network configuration is not changed....\n\nAre you sure you want to restart your network interfaces?\n") ) )
+ except:
+ pass
- def checkNetworkShares(self,ret = False):
+ def checkNetworkConfig(self, ret = False):
if ret == False:
if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
self["config"].getCurrent()[1].onSelect(self.session)
return
+ if wlanconfig.essid.value == 'Input hidden ESSID':
+ if len(wlanconfig.hiddenessid.value) == 0:
+ self.session.open(MessageBox, ("PLEASE INPUT HIDDEN ESSID"), type = MessageBox.TYPE_ERROR, timeout = 10)
+ return
+ if len(wlanconfig.key.value) == 0:
+ self.session.open(MessageBox, ("PLEASE INPUT NETWORK KEY"), type = MessageBox.TYPE_ERROR, timeout = 10)
+ return
+ self.checkNetworkShares()
+
+# def checkNetworkShares(self,ret = False):
+# if ret == False:
+# if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
+# self["config"].getCurrent()[1].onSelect(self.session)
+# return
+ def checkNetworkShares(self):
if not self.Console:
self.Console = Console()
cmd = "cat /proc/mounts"
num_configured_if = len(iNetwork.getConfiguredAdapters())
if num_configured_if >= 1:
if num_configured_if == 1 and self.iface in iNetwork.getConfiguredAdapters():
- self.writeWlanConfig(False)
+ self.getWpaPhrase(False)
else:
- self.session.openWithCallback(self.writeWlanConfig, MessageBox, _("A second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
+ self.session.openWithCallback(self.getWpaPhrase, MessageBox, _("A second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
else:
- self.writeWlanConfig(False)
+ self.getWpaPhrase(False)
- def writeWlanConfig(self,ret = False):
+ def getWpaPhrase(self,ret):
if ret == True:
configuredInterfaces = iNetwork.getConfiguredAdapters()
for interface in configuredInterfaces:
continue
iNetwork.setAdapterAttribute(interface, "up", False)
iNetwork.deactivateInterface(interface)
- ret=self.writeWpasupplicantConf()
+ if wlanconfig.method.value =="wep":
+ self.writeWpasupplicantConf("wep") # passphrasekey is not None
+ else:
+ if wlanconfig.essid.value == 'Input hidden ESSID':
+ cmd = "wpa_passphrase '%s' %s" % (wlanconfig.hiddenessid.value,wlanconfig.key.value)
+ else :
+ cmd = "wpa_passphrase '%s' %s" % (wlanconfig.essid.value,wlanconfig.key.value)
+ print cmd
+ self.wpaphraseconsole = Console()
+ self.wpaphraseconsole.ePopen(cmd, self.parseWpaPhrase, self.writeWpasupplicantConf)
+
+ def parseWpaPhrase(self, result, retval, extra_args):
+ print "parseWpaPhrase"
+ (writewlanconfig) = extra_args
+ if self.wpaphraseconsole is not None:
+ print "retval = ",retval
+ if retval == 0:
+ self.wpaphraseconsole.killAll()
+ self.wpaphraseconsole = None
+ print "parseWpaPhrase result : "
+ print result
+ psk = None
+ for line in result.splitlines():
+ if line.find('ssid') == -1 and line.find('#psk=') != -1:
+ plainpwd = line
+ elif line.find('psk=') != -1:
+ psk = line
+ if psk:
+ writewlanconfig(psk,plainpwd)
+# writewlanconfig(None)
+ else:
+ writewlanconfig(None)
+ else:
+ writewlanconfig(None)
+
+ def writeWpasupplicantConf(self, passphrasekey=None,plainpwd=None):
+ if passphrasekey:
+ wpafd = open("/etc/wpa_supplicant.conf","w")
+ if wpafd > 0:
+ contents = "#WPA Supplicant Configuration by STB\n"
+ contents += "ctrl_interface=/var/run/wpa_supplicant\n"
+ contents += "eapol_version=1\n"
+ contents += "fast_reauth=1\n"
+
+ if wlanconfig.essid.value == 'Input hidden ESSID':
+ contents += "ap_scan=2\n"
+ else :
+ contents += "ap_scan=1\n"
+ contents += "network={\n"
+ if wlanconfig.essid.value == 'Input hidden ESSID':
+ contents += "\tssid=\""+wlanconfig.hiddenessid.value+"\"\n"
+ else :
+ contents += "\tssid=\""+wlanconfig.essid.value+"\"\n"
+ contents += "\tscan_ssid=0\n"
+ if wlanconfig.encrypt.value == "on":
+ if wlanconfig.method.value =="wep":
+ contents += "\tkey_mgmt=NONE\n"
+ contents += "\twep_key0="
+ if wlanconfig.keytype.value == "ascii":
+ contents += "\""+wlanconfig.key.value+"\"\n"
+ else:
+ contents += wlanconfig.key.value+"\n"
+ else:
+ print "plainpwd : ",plainpwd
+ print "passphrasekey : ",passphrasekey
+ if wlanconfig.method.value == "wpa":
+ contents += "\tkey_mgmt=WPA-PSK\n"
+ contents += "\tproto=WPA\n"
+ contents += "\tpairwise=CCMP TKIP\n"
+ contents += "\tgroup=CCMP TKIP\n"
+ elif wlanconfig.method.value == "wpa2":
+ contents += "\tkey_mgmt=WPA-PSK\n"
+ contents += "\tproto=RSN\n"
+ contents += "\tpairwise=CCMP TKIP\n"
+ contents += "\tgroup=CCMP TKIP\n"
+ else:
+ contents += "\tkey_mgmt=WPA-PSK\n"
+ contents += "\tproto=WPA RSN\n"
+ contents += "\tpairwise=CCMP TKIP\n"
+ contents += "\tgroup=CCMP TKIP\n"
+ contents += plainpwd+"\n"
+ contents += passphrasekey+"\n"
+ else:
+ contents += "\tkey_mgmt=NONE\n"
+ contents += "}\n"
+ print "content = \n"+contents
+ wpafd.write(contents)
+ wpafd.close()
+ self.writeNetConfig(0)
+ else :
+ self.session.open(MessageBox, _("wpa_supplicant.conf open error."), type = MessageBox.TYPE_ERROR, timeout = 10)
+ self.writeNetConfig(-1)
+ else:
+ self.writeNetConfig(-2)
+
+ def writeNetConfig(self,ret = -1):
if ret == -1:
self.session.open(MessageBox, _("wpa_supplicant.conf open error."), type = MessageBox.TYPE_ERROR, timeout = 10)
return
elif ret == -2:
- self.session.open(MessageBox, _("hidden ESSID empty"), type = MessageBox.TYPE_ERROR, timeout = 10)
+ self.session.open(MessageBox, _("Can NOT generate passphrase"), type = MessageBox.TYPE_ERROR, timeout = 10)
return
if wlanconfig.usedevice.value=="on":
self.configurationmsg = None
self.configurationmsg = self.session.openWithCallback(self.configFinished, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
- def writeWpasupplicantConf(self):
- wpafd = open("/etc/wpa_supplicant.conf","w")
- if wpafd > 0:
- contents = "#WPA Supplicant Configuration by STB\n"
- contents += "ctrl_interface=/var/run/wpa_supplicant\n"
- contents += "eapol_version=1\n"
- contents += "fast_reauth=1\n"
- if wlanconfig.essid.value == 'Input hidden ESSID':
- contents += "ap_scan=2\n"
- else :
- contents += "ap_scan=1\n"
- contents += "network={\n"
- if wlanconfig.essid.value == 'Input hidden ESSID':
- if len(wlanconfig.hiddenessid.value) == 0:
- wpafd.close()
- return -2
- contents += "\tssid=\""+wlanconfig.hiddenessid.value+"\"\n"
- else :
- contents += "\tssid=\""+wlanconfig.essid.value+"\"\n"
- contents += "\tscan_ssid=0\n"
- if wlanconfig.encrypt.value == "on":
- if wlanconfig.method.value =="wep":
- contents += "\tkey_mgmt=NONE\n"
- contents += "\twep_key0="
- elif wlanconfig.method.value == "wpa":
- contents += "\tkey_mgmt=WPA-PSK\n"
- contents += "\tproto=WPA\n"
- contents += "\tpairwise=CCMP TKIP\n"
- contents += "\tgroup=CCMP TKIP\n"
- contents += "\tpsk="
- elif wlanconfig.method.value == "wpa2":
- contents += "\tkey_mgmt=WPA-PSK\n"
- contents += "\tproto=RSN\n"
- contents += "\tpairwise=CCMP TKIP\n"
- contents += "\tgroup=CCMP TKIP\n"
- contents += "\tpsk="
- else:
- contents += "\tkey_mgmt=WPA-PSK\n"
- contents += "\tproto=WPA RSN\n"
- contents += "\tpairwise=CCMP TKIP\n"
- contents += "\tgroup=CCMP TKIP\n"
- contents += "\tpsk="
- if wlanconfig.keytype.value == "ascii":
- contents += "\""+wlanconfig.key.value+"\"\n"
- else:
- contents += wlanconfig.key.value+"\n"
- else:
- contents += "\tkey_mgmt=NONE\n"
- contents += "}\n"
- print "content = \n"+contents
- wpafd.write(contents)
- wpafd.close()
- return 0
- else :
- self.session.open(MessageBox, _("wpa_supplicant.conf open error."), type = MessageBox.TYPE_ERROR, timeout = 10)
- return -1
def updateCurrentInterfaces(self,ret):
if ret is True:
iNetwork.getInterfaces(self.configurationMsgClose)
iNetwork.stopDeactivateInterfaceConsole()
self.stopwlanscanapConsole()
self.stopCheckNetworkSharesConsole()
+ self.stopWpaPhraseConsole()
def stopwlanscanapConsole(self):
if self.wlanscanap is not None:
for name in self.Console.appContainers.keys():
self.Console.kill(name)
-class WlanScanAp(Screen,HelpableScreen):
- skin = """
- <screen name="WlanScanAp" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
- <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
- <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
- <eLabel text="Wireless Network AP Scan..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
- <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
- <convert type="ClockToText">Format:%H:%M</convert>
- </widget>
- <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
- <ePixmap pixmap="Vu_HD/buttons/green.png" position="240,98" size="25,25" alphatest="blend" />
- <ePixmap pixmap="Vu_HD/buttons/blue.png" position="630,98" size="25,25" alphatest="blend" />
- <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="key_green" render="Label" position="268,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="key_blue" render="Label" position="665,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <ePixmap pixmap="Vu_HD/border_menu.png" position="120,140" zPosition="-1" size="342,358" transparent="1" alphatest="blend" />
- <widget name="menulist" position="130,150" size="322,338" transparent="1" backgroundColor="#27d9dee2" zPosition="10" scrollbarMode="showOnDemand" />
- <widget source="Address" render="Label" position="490,220" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="ESSID" render="Label" position="490,250" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="Protocol" render="Label" position="490,280" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="Frequency" render="Label" position="490,310" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="Encryption key" render="Label" position="490,340" zPosition="1" size="300,30" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="BitRate" render="Label" position="490,370" zPosition="1" size="300,60" font="Regular;20" halign="center" valign="center" backgroundColor="#27b5b9bd" foregroundColor="#1c1c1c" transparent="1" />
- </screen>"""
+ def stopWpaPhraseConsole(self):
+ if self.wpaphraseconsole is not None:
+ if len(self.wpaphraseconsole.appContainers):
+ for name in self.wpaphraseconsole.appContainers.keys():
+ self.wpaphraseconsole.kill(name)
+class WlanScanAp(Screen,HelpableScreen):
+ skin = """
+ <screen position="center,center" size="510,400" title="Wireless Network AP Scan..." >
+ <ePixmap pixmap="skin_default/div-h.png" position="0,350" zPosition="1" size="560,2" />
+ <ePixmap pixmap="skin_default/border_menu.png" position="10,10" zPosition="1" size="250,300" transparent="1" alphatest="on" />
+
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,360" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="185,360" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="360,360" size="140,40" alphatest="on" />
+
+ <widget source="key_red" render="Label" position="10,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+ <widget source="key_green" render="Label" position="185,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
+ <widget source="key_blue" render="Label" position="360,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" foregroundColor="#ffffff" transparent="1" />
+
+ <widget name="menulist" position="20,20" size="230,260" backgroundColor="#371e1c1a" transparent="1" zPosition="10" scrollbarMode="showOnDemand" />
+
+ <widget source="Address" render="Label" position="265,70" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
+ <widget source="ESSID" render="Label" position="265,100" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
+ <widget source="Protocol" render="Label" position="265,130" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
+ <widget source="Frequency" render="Label" position="265,160" zPosition="1" size="240,40" font="Regular;18" halign="center" valign="center" />
+ <widget source="Encryption key" render="Label" position="265,200" zPosition="1" size="240,30" font="Regular;18" halign="center" valign="center" />
+ <widget source="BitRate" render="Label" position="265,220" zPosition="1" size="240,60" font="Regular;18" halign="center" valign="center" />
+ </screen>
+ """
def __init__(self, session, iface):
Screen.__init__(self,session)
HelpableScreen.__init__(self)
if self.apList[index].has_key(key):
self[key].setText((key+": "+self.apList[index][key]))
else:
- self[key].setText(("None"))
+ self[key].setText((key+": None"))
else:
self.session.openWithCallback(self.ScanAPclose, MessageBox, _("No AP detected."), type = MessageBox.TYPE_INFO, timeout = 10)
callback(self.apState)
class Wlanstatus(Screen):
- skin = """
- <screen name="Wlanstatus" position="209,48" size="865,623" title="Wireless Network Configuration..." flags="wfNoBorder" backgroundColor="transparent">
- <ePixmap pixmap="Vu_HD/Bg_EPG_view.png" zPosition="-1" position="0,0" size="865,623" alphatest="on" />
- <ePixmap pixmap="Vu_HD/menu/ico_title_Setup.png" position="32,41" size="40,40" alphatest="blend" transparent="1" />
- <eLabel text="Wireless Network Status..." position="90,50" size="600,32" font="Semiboldit;32" foregroundColor="#5d5d5d" backgroundColor="#27b5b9bd" transparent="1" />
- <ePixmap pixmap="Vu_HD/icons/clock.png" position="750,55" zPosition="1" size="20,20" alphatest="blend" />
- <widget source="global.CurrentTime" render="Label" position="770,57" zPosition="1" size="50,20" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" halign="right" transparent="1">
- <convert type="ClockToText">Format:%H:%M</convert>
- </widget>
- <ePixmap pixmap="Vu_HD/buttons/red.png" position="45,98" size="25,25" alphatest="blend" />
- <widget source="key_red" render="Label" position="66,97" zPosition="1" size="150,25" font="Regular;20" halign="center" valign="center" backgroundColor="darkgrey" foregroundColor="#1c1c1c" transparent="1" />
- <widget source="status" render="Label" position="110,200" size="650,400" transparent="1" font="Regular;20" foregroundColor="#1c1c1c" backgroundColor="#27d9dee2" zPosition="1" />
- </screen>"""
+ skin = """
+ <screen position="center,center" size="510,400" title="Wireless Network Status..." >
+ <widget source="status" render="Label" position="5,15" size="500,350" font="Regular;18" zPosition="1" />
+
+ <ePixmap pixmap="skin_default/buttons/red.png" position="185,360" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="185,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+ </screen>
+ """
def __init__(self, session,iface):
Screen.__init__(self,session)
self.session = session