Add config option for entering a hidden network ssid. This is more intuitive as selecting the option from the found networks. refs #725
from Screens.MessageBox import MessageBox
from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
from Components.Sources.Boolean import Boolean
-from Components.config import config, ConfigBoolean, configfile, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, getConfigListEntry, ConfigSelection, ConfigPassword
from Components.Network import iNetwork
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
from enigma import eTimer
from os import system
-config.misc.firstrun = ConfigBoolean(default = True)
-list = []
-list.append("WEP")
-list.append("WPA")
-list.append("WPA2")
-list.append("WPA/WPA2")
-
-weplist = []
-weplist.append("ASCII")
-weplist.append("HEX")
-
-config.plugins.wlan = ConfigSubsection()
-config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
-config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
-
-config.plugins.wlan.encryption = ConfigSubsection()
-config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False))
-config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" ))
-config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
-config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
-
class NetworkWizard(WizardLanguage, Rc):
skin = """
<screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
newList.append(oldentry)
for newentry in newList:
- if newentry[1] == "hidden...":
+ if newentry[1] == "<hidden>":
continue
self.newAPlist.append(newentry)
if len(self.newAPlist):
- if "hidden..." not in self.newAPlist:
- self.newAPlist.append(( _("enter hidden network SSID"), "hidden..." ))
+ if "<hidden>" not in self.newAPlist:
+ self.newAPlist.append(( _("enter hidden network SSID"), "<hidden>" ))
if (self.wizard[self.currStep].has_key("dynamiclist")):
currentListEntry = self["list"].getCurrent()
complist.remove(compentry)
for entry in complist:
self.APList.append( (entry[1], entry[1]) )
-
- if "hidden..." not in self.APList:
- self.APList.append(( _("enter hidden network SSID"), "hidden..." ))
+
+ if "<hidden>" not in self.APList:
+ self.APList.append(( _("enter hidden network SSID"), "<hidden>" ))
self.rescanTimer.start(5000)
return self.APList
def AccessPointsSelectionMade(self, index):
self.ap = index
self.WlanList = []
- currList = []
if (self.wizard[self.currStep].has_key("dynamiclist")):
- currList = self['list'].list
- for entry in currList:
+ for entry in self['list'].list:
+ if entry[1] == "<hidden>":
+ continue
self.WlanList.append( (entry[1], entry[0]) )
self.AccessPointsSelect(index)
from Screens.Screen import Screen
from Plugins.Plugin import PluginDescriptor
-from Components.config import getConfigListEntry, config
+from Components.config import getConfigListEntry, config, ConfigBoolean
+
+config.misc.firstrun = ConfigBoolean(default = True)
def NetworkWizardMain(session, **kwargs):
session.open(NetworkWizard)
config.plugins.wlan = ConfigSubsection()
config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
-config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigYesNo(default = False))
config.plugins.wlan.encryption = ConfigSubsection()
config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = True))
fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
fp.write('eapol_version=1\n')
fp.write('fast_reauth=1\n')
- if essid == 'hidden...':
+
+ if hiddenessid:
fp.write('ap_scan=2\n')
else:
fp.write('ap_scan=1\n')
fp.write('network={\n')
- if essid == 'hidden...':
- fp.write('\tssid="'+hiddenessid+'"\n')
- else:
- fp.write('\tssid="'+essid+'"\n')
+ fp.write('\tssid="'+essid+'"\n')
fp.write('\tscan_ssid=0\n')
if encrypted:
if encryption in ('WPA', 'WPA2', 'WPA/WPA2'):
fp.write('}')
fp.write('\n')
fp.close()
- system('cat ' + getWlanConfigName(iface))
+ #system('cat ' + getWlanConfigName(iface))
def loadConfig(self,iface):
configfile = getWlanConfigName(iface)
fp = file(configfile, 'r')
supplicant = fp.readlines()
fp.close()
- ap_scan = False
essid = None
for s in supplicant:
split = s.strip().split('=',1)
if split[0] == 'ap_scan':
- print "[Wlan.py] Got Hidden SSID Scan Value ",split[1]
+ #print "[Wlan.py] Got Hidden SSID Scan Value ",split[1]
if split[1] == '2':
- ap_scan = True
+ config.plugins.wlan.hiddenessid.value = True
else:
- ap_scan = False
-
+ config.plugins.wlan.hiddenessid.value = False
+
elif split[0] == 'ssid':
- print "[Wlan.py] Got SSID ",split[1][1:-1]
+ #print "[Wlan.py] Got SSID ",split[1][1:-1]
essid = split[1][1:-1]
-
+ config.plugins.wlan.essid.value = essid
+
elif split[0] == 'proto':
config.plugins.wlan.encryption.enabled.value = True
if split[1] == 'WPA' :
mode = 'WPA2'
if split[1] in ('WPA RSN', 'WPA WPA2'):
mode = 'WPA/WPA2'
+ #print "[Wlan.py] Got Encryption: ",mode
config.plugins.wlan.encryption.type.value = mode
- print "[Wlan.py] Got Encryption: "+mode
elif split[0] == 'wep_key0':
config.plugins.wlan.encryption.enabled.value = True
else:
pass
- if ap_scan is True:
- config.plugins.wlan.hiddenessid.value = essid
- config.plugins.wlan.essid.value = 'hidden...'
- else:
- config.plugins.wlan.hiddenessid.value = essid
- config.plugins.wlan.essid.value = essid
wsconfig = {
'hiddenessid': config.plugins.wlan.hiddenessid.value,
'ssid': config.plugins.wlan.essid.value,
for (key, item) in wsconfig.items():
if item is "None" or item is "":
if key == 'hiddenessid':
- wsconfig['hiddenessid'] = "home"
+ wsconfig['hiddenessid'] = False
if key == 'ssid':
wsconfig['ssid'] = "home"
if key == 'encryption':
wsconfig['encryption'] = True
- if key == 'encryption':
+ if key == 'encryption_type':
wsconfig['encryption_type'] = "WPA/WPA2"
- if key == 'encryption':
+ if key == 'encryption_wepkeytype':
wsconfig['encryption_wepkeytype'] = "ASCII"
- if key == 'encryption':
+ if key == 'key':
wsconfig['key'] = "mysecurewlan"
except:
print "[Wlan.py] Error parsing ",configfile
wsconfig = {
- 'hiddenessid': "home",
+ 'hiddenessid': False,
'ssid': "home",
'encryption': True,
'encryption_type': "WPA/WPA2",
'encryption_wepkeytype': "ASCII",
'key': "mysecurewlan",
}
- print "[Wlan.py] WS-CONFIG-->",wsconfig
+ #print "[Wlan.py] WS-CONFIG-->",wsconfig
return wsconfig
else:
if "Nickname" in line:
tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
- if tmpssid == '':
- ssid = _("Hidden networkname")
- elif tmpssid ==' ':
+ if tmpssid in ('', ' '):
ssid = _("Hidden networkname")
else:
ssid = tmpssid
else:
tmpssid=(line[line.index('ESSID')+7:len(line)-1])
- if tmpssid == '':
- ssid = _("Hidden networkname")
- elif tmpssid ==' ':
+ if tmpssid in ('', ' '):
ssid = _("Hidden networkname")
else:
ssid = tmpssid
plugin_path = eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/WirelessLan")
+
list = []
list.append("WEP")
list.append("WPA")
config.plugins.wlan = ConfigSubsection()
config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
-config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigYesNo(default = False))
config.plugins.wlan.encryption = ConfigSubsection()
config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False))
self.rescanTimer.stop()
del self.rescanTimer
if cur[1] is not None:
- if cur[1] == 'hidden...':
+ if cur[1] == '<hidden>':
essid = cur[1]
else:
essid = cur[0]
def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal):
divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
encryption = encrypted and _("Yes") or _("No")
- if bssid == 'hidden...':
+ if bssid == '<hidden>':
return((essid, bssid, None, None, None, None, divpng))
else:
return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng))
tmpList.append(data)
if len(tmpList):
- if "hidden..." not in tmpList:
- tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
-
+ if "<hidden>" not in tmpList:
+ tmpList.append( ( _("enter hidden network SSID"), "<hidden>", True, self.iface, _("unavailable"), "" ) )
+
for entry in tmpList:
self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
else:
self.oldlist[entry[0]]['data'] = entry
- if "hidden..." not in self.cleanList:
- self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+ if "<hidden>" not in self.cleanList:
+ self.cleanList.append( ( _("enter hidden network SSID"), "<hidden>", True, self.iface, _("unavailable"), "" ) )
for entry in self.cleanList:
self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
def buildWlanList(self):
self.WlanList = []
for entry in self['list'].list:
- if entry[1] == "hidden...":
- self.WlanList.append(( "hidden...",_("enter hidden network SSID") ))
+ if entry[1] == "<hidden>":
+ continue
else:
self.WlanList.append( (entry[0], entry[0]) )
driver = 'dreambox'
print 'Using "%s" as wpa-supplicant driver' % (driver)
ret = ""
- if driver == 'madwifi' and config.plugins.wlan.essid.value == "hidden...":
- ret += "\tpre-up iwconfig " + iface + " essid \"" + config.plugins.wlan.hiddenessid.value + "\" || true\n"
+ if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
+ ret += "\tpre-up iwconfig " + iface + " essid \"" + config.plugins.wlan.essid.value + "\" || true\n"
ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
return ret
from Components.Label import Label,MultiColorLabel
from Components.Pixmap import Pixmap,MultiPixmap
from Components.MenuList import MenuList
-from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigPassword, ConfigSelection, getConfigListEntry, ConfigNothing
+from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigText, ConfigPassword, ConfigSelection, getConfigListEntry, ConfigNothing, ConfigBoolean
from Components.ConfigList import ConfigListScreen
from Components.PluginComponent import plugins
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
self.iface = networkinfo
self.essid = essid
self.aplist = aplist
+
self.extended = None
self.applyConfigRef = None
self.finished_cb = None
self.weplist = None
self.wsconfig = None
self.default = None
+ self.hiddenNW = None
if iNetwork.isWirelessInterface(self.iface):
from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant, iWlan
self.wsconfig = self.ws.loadConfig(self.iface)
if self.essid is not None: # ssid from wlan scan
self.default = self.essid
+ self.hiddenNW = self.wsconfig['hiddenessid']
+ if self.essid == '<hidden>':
+ self.hiddenNW = True
+ self.default = self.default = self.wsconfig['ssid']
else:
+ self.hiddenNW = self.wsconfig['hiddenessid']
self.default = self.wsconfig['ssid']
- if "hidden..." not in self.nwlist:
- self.nwlist.append(("hidden...",_("enter hidden network SSID")))
- if self.default not in self.nwlist:
+ if (self.default not in self.nwlist and self.default is not '<hidden>'):
self.nwlist.append((self.default,self.default))
- config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
- config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = self.wsconfig['hiddenessid'], visible_width = 50, fixed_size = False))
-
+
+ config.plugins.wlan.hiddenessid = NoSave(ConfigYesNo(default = self.hiddenNW))
+ if config.plugins.wlan.hiddenessid.value is True:
+ config.plugins.wlan.essid = NoSave(ConfigText(default = self.default, visible_width = 50, fixed_size = False))
+ else:
+ config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = self.wsconfig['encryption'] ))
config.plugins.wlan.encryption.type = NoSave(ConfigSelection(self.encryptionlist, default = self.wsconfig['encryption_type'] ))
config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(self.weplist, default = self.wsconfig['encryption_wepkeytype'] ))
if p.__call__.has_key("configStrings"):
self.configStrings = p.__call__["configStrings"]
- if config.plugins.wlan.essid.value == 'hidden...':
- self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid)
- self.list.append(self.wlanSSID)
- self.hiddenSSID = getConfigListEntry(_("Hidden network SSID"), config.plugins.wlan.hiddenessid)
- self.list.append(self.hiddenSSID)
+ self.hiddenSSID = getConfigListEntry(_("enter hidden network SSID"), config.plugins.wlan.hiddenessid)
+ self.list.append(self.hiddenSSID)
+
+ if config.plugins.wlan.hiddenessid.value is True:
+ config.plugins.wlan.essid = NoSave(ConfigText(default = self.default, visible_width = 50, fixed_size = False))
+ self.wlanSSID = getConfigListEntry(_("Hidden network SSID"), config.plugins.wlan.essid)
else:
+ config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
self.wlanSSID = getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid)
- self.list.append(self.wlanSSID)
+ self.list.append(self.wlanSSID)
self.encryptionEnabled = getConfigListEntry(_("Encryption"), config.plugins.wlan.encryption.enabled)
self.list.append(self.encryptionEnabled)
self.createSetup()
if self["config"].getCurrent() == self.gatewayEntry:
self.createSetup()
- if iNetwork.isWirelessInterface(self.iface):
- if self["config"].getCurrent() == self.wlanSSID:
+ if iNetwork.isWirelessInterface(self.iface):
+ if self["config"].getCurrent() == self.hiddenSSID:
self.createSetup()
if self["config"].getCurrent() == self.encryptionEnabled:
self.createSetup()
def hideInputHelp(self):
current = self["config"].getCurrent()
- if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
+ if current == self.wlanSSID and config.plugins.wlan.hiddenessid.value:
if current[1].help_window.instance is not None:
current[1].help_window.instance.hide()
elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value: