lib/python/Plugins/SystemPlugins/FPGAUpgrade/meta/Makefile
lib/python/Plugins/SystemPlugins/WirelessLanSetup/Makefile
lib/python/Plugins/SystemPlugins/WirelessLanSetup/meta/Makefile
+lib/python/Plugins/SystemPlugins/ManualFancontrol/Makefile
+lib/python/Plugins/SystemPlugins/ManualFancontrol/meta/Makefile
+lib/python/Plugins/SystemPlugins/Blindscan/Makefile
+lib/python/Plugins/SystemPlugins/Blindscan/meta/Makefile
lib/python/Tools/Makefile
lib/service/Makefile
lib/components/Makefile
--- /dev/null
+installdir = $(pkglibdir)/python/Plugins/SystemPlugins/Blindscan
+
+SUBDIRS = meta
+
+install_PYTHON = \
+ __init__.py \
+ plugin.py
+
--- /dev/null
+installdir = $(datadir)/meta
+
+dist_install_DATA = plugin_blindscan.xml
--- /dev/null
+<default>
+ <prerequisites>
+ <tag type="System" />
+ </prerequisites>
+ <info>
+ <author>doliyu and oskwon</author>
+ <name>Blindscan</name>
+ <packagename>enigma2-plugin-systemplugins-blindscan</packagename>
+ <shortdescription>vuplus blindscan...</shortdescription>
+ <description>vuplus blindscan...</description>
+ </info>
+
+ <files type="package"> <!-- without version, without .ipk -->
+ <file type="package" name="enigma2-plugin-systemplugins-blindscan" />
+ </files>
+</default>
--- /dev/null
+from Plugins.Plugin import PluginDescriptor
+
+from Screens.Screen import Screen
+from Screens.ServiceScan import ServiceScan
+from Screens.MessageBox import MessageBox
+from Screens.DefaultWizard import DefaultWizard
+
+from Components.Label import Label
+from Components.TuneTest import Tuner
+from Components.ConfigList import ConfigListScreen
+from Components.Sources.StaticText import StaticText
+from Components.ActionMap import NumberActionMap, ActionMap
+from Components.NimManager import nimmanager, getConfigSatlist
+from Components.config import config, ConfigSubsection, ConfigSelection, ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable
+
+from Tools.HardwareInfo import HardwareInfo
+from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION
+
+from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager
+
+class SatBlindscanSearchSupport:
+ def blindTransponderSearchSessionClosed(self, *val):
+ self.blind_search_container.appClosed.remove(self.blindScanSearchClosed)
+ self.blind_search_container.dataAvail.remove(self.getBlindTransponderData)
+ if val and len(val):
+ if val[0]:
+ self.tlist = self.__tlist
+ print self.__tlist
+ if self.frontend:
+ self.frontend = None
+ del self.raw_channel
+
+ self.blind_search_container.sendCtrlC()
+ import time
+ time.sleep(2)
+
+ self.blind_search_container = None
+ self.blind_search_container = None
+ self.__tlist = None
+
+ if self.tlist is None:
+ self.tlist = []
+ else:
+ self.startScan(self.tlist, self.flags, self.feid)
+
+ def blindScanSearchClosed(self, retval):
+ self.blind_search_session.close(True)
+
+ def getBlindTransponderData(self, str):
+ str = self.remainingdata + str
+ #split in lines
+ lines = str.split('\n')
+ #'str' should end with '\n', so when splitting, the last line should be empty. If this is not the case, we received an incomplete line
+ if len(lines[-1]):
+ #remember this data for next time
+ self.remainingdata = lines[-1]
+ lines = lines[0:-1]
+ else:
+ self.remainingdata = ""
+
+ for line in lines:
+ data = line.split()
+ if len(data):
+ print data
+ if data[0] == 'OK':
+ parm = eDVBFrontendParametersSatellite()
+ sys = { "DVB-S" : eDVBFrontendParametersSatellite.System_DVB_S,
+ "DVB-S2" : eDVBFrontendParametersSatellite.System_DVB_S2 }
+ qam = { "QPSK" : parm.Modulation_QPSK,
+ "8PSK" : parm.Modulation_8PSK }
+ inv = { "INVERSION_OFF" : parm.Inversion_Off,
+ "INVERSION_ON" : parm.Inversion_On,
+ "INVERSION_AUTO" : parm.Inversion_Unknown }
+ fec = { "FEC_AUTO" : parm.FEC_Auto,
+ "FEC_1_2" : parm.FEC_1_2,
+ "FEC_2_3" : parm.FEC_2_3,
+ "FEC_3_4" : parm.FEC_3_4,
+ "FEC_5_6": parm.FEC_5_6,
+ "FEC_7_8" : parm.FEC_7_8,
+ "FEC_8_9" : parm.FEC_8_9,
+ "FEC_3_5" : parm.FEC_3_5,
+ "FEC_9_10" : parm.FEC_9_10,
+ "FEC_NONE" : parm.FEC_None }
+ roll = { "ROLLOFF_20" : parm.RollOff_alpha_0_20,
+ "ROLLOFF_25" : parm.RollOff_alpha_0_25,
+ "ROLLOFF_35" : parm.RollOff_alpha_0_35 }
+ pilot = { "PILOT_ON" : parm.Pilot_On,
+ "PILOT_OFF" : parm.Pilot_Off }
+ pol = { "HORIZONTAL" : parm.Polarisation_Horizontal,
+ "VERTICAL" : parm.Polarisation_Vertical }
+
+ sat = self.satList[0][self.scan_satselection[0].index]
+ parm.orbital_position = sat[0]
+
+ parm.polarisation = pol[data[1]]
+ parm.frequency = int(data[2])
+ parm.symbol_rate = int(data[3])
+ parm.system = sys[data[4]]
+ parm.inversion = inv[data[5]]
+ parm.pilot = pilot[data[6]]
+ parm.fec = fec[data[7]]
+ parm.modulation = qam[data[8]]
+ parm.rolloff = roll[data[9]]
+ self.__tlist.append(parm)
+ flags = None
+
+ def openFrontend(self):
+ res_mgr = eDVBResourceManager.getInstance()
+ if res_mgr:
+ self.raw_channel = res_mgr.allocateRawChannel(self.feid)
+ if self.raw_channel:
+ self.frontend = self.raw_channel.getFrontend()
+ if self.frontend:
+ return True
+ else:
+ print "getFrontend failed"
+ else:
+ print "getRawChannel failed"
+ else:
+ print "getResourceManager instance failed"
+ return False
+
+ def startSatBlindscanSearch(self, nim_idx, orbpos, session):
+ if self.blindscan_start_frequency.value < 950*1000000 or self.blindscan_start_frequency.value > 2150*1000000 :
+ self.session.open(MessageBox, _("Please check again.\nStart frequency must be between 950 and 2150."), MessageBox.TYPE_ERROR)
+ return
+ if self.blindscan_stop_frequency.value < 950*1000000 or self.blindscan_stop_frequency.value > 2150*1000000 :
+ self.session.open(MessageBox, _("Please check again.\nStop frequency must be between 950 and 2150."), MessageBox.TYPE_ERROR)
+ return
+ if self.blindscan_start_frequency.value > self.blindscan_stop_frequency.value :
+ self.session.open(MessageBox, _("Please check again.\nFrequency : start value is larger than stop value."), MessageBox.TYPE_ERROR)
+ return
+ if self.blindscan_start_symbol.value < 2*1000000 or self.blindscan_start_symbol.value > 45*1000000 :
+ self.session.open(MessageBox, _("Please check again.\nStart symbolrate must be between 2MHz and 45MHz."), MessageBox.TYPE_ERROR)
+ return
+ if self.blindscan_stop_symbol.value < 2*1000000 or self.blindscan_stop_symbol.value > 45*1000000 :
+ self.session.open(MessageBox, _("Please check again.\nStop symbolrate must be between 2MHz and 45MHz."), MessageBox.TYPE_ERROR)
+ return
+ if self.blindscan_start_symbol.value > self.blindscan_stop_symbol.value :
+ self.session.open(MessageBox, _("Please check again.\nSymbolrate : start value is larger than stop value."), MessageBox.TYPE_ERROR)
+ return
+
+ self.__tlist = [ ]
+ self.remainingdata = ""
+ self.feid = nim_idx
+ if not self.openFrontend():
+ self.oldref = session.nav.getCurrentlyPlayingServiceReference()
+ session.nav.stopService() # try to disable foreground service
+ if not self.openFrontend():
+ if session.pipshown: # try to disable pip
+ session.pipshown = False
+ del session.pip
+ if not self.openFrontend():
+ self.frontend = None # in normal case this should not happen
+
+ self.tuner = Tuner(self.frontend)
+ sat = self.satList[0][self.scan_satselection[0].index]
+
+ tab_hilow = {"high" : 1, "low" : 0}
+ returnvalue = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ if tab_hilow[self.blindscan_hi.value]:
+ self.scan_sat.frequency.value = 12515
+ else:
+ self.scan_sat.frequency.value = 11015
+ returnvalue = (self.scan_sat.frequency.value,
+ 0,
+ self.scan_sat.polarization.value,
+ 0,
+ 0,
+ int(orbpos[0]),
+ eDVBFrontendParametersSatellite.System_DVB_S,
+ 0,
+ 0,
+ 0)
+ self.tuner.tune(returnvalue)
+
+ self.blind_search_container = eConsoleAppContainer()
+ self.blind_search_container.appClosed.append(self.blindScanSearchClosed)
+ self.blind_search_container.dataAvail.append(self.getBlindTransponderData)
+ cmd = "vuplus_blindscan %d %d %d %d %d %d %d" % (self.blindscan_start_frequency.value/1000000, self.blindscan_stop_frequency.value/1000000, self.blindscan_start_symbol.value/1000000, self.blindscan_stop_symbol.value/1000000, self.scan_sat.polarization.value, tab_hilow[self.blindscan_hi.value], self.feid)
+ print "prepared command : ", cmd
+ self.blind_search_container.execute(cmd)
+
+ tmpstr = _("Blindscan takes some minute.")
+ self.blind_search_session = self.session.openWithCallback(self.blindTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
+
+class Blindscan(ConfigListScreen, Screen, SatBlindscanSearchSupport):
+ skin="""
+ <screen name="Blindscan" position="center,center" size="560,250" title="Blindscan">
+ <ePixmap pixmap="Vu_HD/buttons/red.png" position="5,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="Vu_HD/buttons/green.png" position="145,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="Vu_HD/buttons/button_off.png" position="285,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="Vu_HD/buttons/button_off.png" position="425,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="20,0" zPosition="1" size="115,30" font="Regular;20" halign="center" valign="center" transparent="1" />
+ <widget source="key_green" render="Label" position="160,0" zPosition="1" size="115,30" font="Regular;20" halign="center" valign="center" transparent="1" />
+ <widget name="config" position="5,50" size="550,200" scrollbarMode="showOnDemand" />
+ </screen>
+ """
+ def __init__(self, session):
+ Screen.__init__(self, session)
+
+ self.updateSatList()
+ self.service = session.nav.getCurrentService()
+ self.current_play_service = self.session.nav.getCurrentlyPlayingServiceReference()
+ self.feinfo = None
+ self.networkid = 0
+ frontendData = None
+ if self.service is not None:
+ self.feinfo = self.service.frontendInfo()
+ frontendData = self.feinfo and self.feinfo.getAll(True)
+
+ self.createConfig(frontendData)
+
+ del self.feinfo
+ del self.service
+
+ self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", ],
+ {
+ "red": self.keyCancel,
+ "green": self.keyGo,
+ "ok": self.keyGo,
+ "cancel": self.keyCancel,
+ }, -2)
+
+ self.statusTimer = eTimer()
+ self.statusTimer.callback.append(self.updateStatus)
+
+ self.list = []
+ ConfigListScreen.__init__(self, self.list)
+
+ self["key_red"] = StaticText(_("Exit"))
+ self["key_green"] = StaticText("Start")
+
+ #if not self.scan_nims.value == "":
+ # self.createSetup()
+ try:
+ if not self.scan_nims.value == "":
+ self.createSetup()
+ except:
+ self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", ],
+ {
+ "red": self.keyCancel,
+ "green": self.keyNone,
+ "ok": self.keyNone,
+ "cancel": self.keyCancel,
+ }, -2)
+ self["key_red"] = StaticText(_("Exit"))
+ self["key_green"] = StaticText(" ")
+
+ def keyNone(self):
+ None
+
+ def updateSatList(self):
+ self.satList = []
+ for slot in nimmanager.nim_slots:
+ if slot.isCompatible("DVB-S"):
+ self.satList.append(nimmanager.getSatListForNim(slot.slot))
+ else:
+ self.satList.append(None)
+
+ def createConfig(self, frontendData):
+ defaultSat = {
+ "orbpos": 192,
+ "system": eDVBFrontendParametersSatellite.System_DVB_S,
+ "frequency": 11836,
+ "inversion": eDVBFrontendParametersSatellite.Inversion_Unknown,
+ "symbolrate": 27500,
+ "polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal,
+ "fec": eDVBFrontendParametersSatellite.FEC_Auto,
+ "fec_s2": eDVBFrontendParametersSatellite.FEC_9_10,
+ "modulation": eDVBFrontendParametersSatellite.Modulation_QPSK }
+ if frontendData is not None:
+ ttype = frontendData.get("tuner_type", "UNKNOWN")
+ if ttype == "DVB-S":
+ defaultSat["system"] = frontendData.get("system", eDVBFrontendParametersSatellite.System_DVB_S)
+ defaultSat["frequency"] = frontendData.get("frequency", 0) / 1000
+ defaultSat["inversion"] = frontendData.get("inversion", eDVBFrontendParametersSatellite.Inversion_Unknown)
+ defaultSat["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000
+ defaultSat["polarization"] = frontendData.get("polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal)
+ if defaultSat["system"] == eDVBFrontendParametersSatellite.System_DVB_S2:
+ defaultSat["fec_s2"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
+ defaultSat["rolloff"] = frontendData.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35)
+ defaultSat["pilot"] = frontendData.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown)
+ else:
+ defaultSat["fec"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
+ defaultSat["modulation"] = frontendData.get("modulation", eDVBFrontendParametersSatellite.Modulation_QPSK)
+ defaultSat["orbpos"] = frontendData.get("orbital_position", 0)
+
+ self.scan_sat = ConfigSubsection()
+ self.scan_networkScan = ConfigYesNo(default = False)
+
+ # blindscan add
+ self.blindscan_hi = ConfigSelection(default = "low", choices = [("low", _("low")), ("high", _("high"))])
+
+ #ConfigYesNo(default = True)
+ self.blindscan_start_frequency = ConfigInteger(default = 950*1000000)
+ self.blindscan_stop_frequency = ConfigInteger(default = 2150*1000000)
+ self.blindscan_start_symbol = ConfigInteger(default = 2*1000000)
+ self.blindscan_stop_symbol = ConfigInteger(default = 45*1000000)
+
+ nim_list = []
+ # collect all nims which are *not* set to "nothing"
+ for n in nimmanager.nim_slots:
+ if n.config_mode == "nothing":
+ continue
+ if n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1:
+ continue
+ if n.config_mode in ("loopthrough", "satposdepends"):
+ root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value))
+ if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa
+ continue
+ nim_list.append((str(n.slot), n.friendly_full_description))
+
+ self.scan_nims = ConfigSelection(choices = nim_list)
+
+ # status
+ self.scan_snr = ConfigSlider()
+ self.scan_snr.enabled = False
+ self.scan_agc = ConfigSlider()
+ self.scan_agc.enabled = False
+ self.scan_ber = ConfigSlider()
+ self.scan_ber.enabled = False
+
+ # sat
+ self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999))
+ self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [
+ (eDVBFrontendParametersSatellite.Polarisation_Horizontal, _("horizontal")),
+ (eDVBFrontendParametersSatellite.Polarisation_Vertical, _("vertical")),
+ (eDVBFrontendParametersSatellite.Polarisation_CircularLeft, _("circular left")),
+ (eDVBFrontendParametersSatellite.Polarisation_CircularRight, _("circular right"))])
+ self.scan_scansat = {}
+ for sat in nimmanager.satList:
+ self.scan_scansat[sat[0]] = ConfigYesNo(default = False)
+
+ self.scan_satselection = []
+ for slot in nimmanager.nim_slots:
+ if slot.isCompatible("DVB-S"):
+ self.scan_satselection.append(getConfigSatlist(defaultSat["orbpos"], self.satList[slot.slot]))
+ else:
+ self.scan_satselection.append(None)
+ return True
+
+
+ def newConfig(self):
+ cur = self["config"].getCurrent()
+ print "cur is", cur
+ if cur == self.tunerEntry or \
+ cur == self.systemEntry or \
+ (self.modulationEntry and self.systemEntry[1].value == eDVBFrontendParametersSatellite.System_DVB_S2 and cur == self.modulationEntry):
+ self.createSetup()
+
+ def keyLeft(self):
+ ConfigListScreen.keyLeft(self)
+ self.newConfig()
+
+ def keyRight(self):
+ ConfigListScreen.keyRight(self)
+ self.newConfig()
+
+ def updateStatus(self):
+ print "updatestatus"
+
+ def keyGo(self):
+ if self.scan_nims.value == "":
+ return
+ tlist = []
+ flags = None
+ removeAll = True
+ index_to_scan = int(self.scan_nims.value)
+
+ if self.scan_nims == [ ]:
+ self.session.open(MessageBox, _("No tuner is enabled!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
+ return
+
+ nim = nimmanager.nim_slots[index_to_scan]
+ print "nim", nim.slot
+ if nim.isCompatible("DVB-S") :
+ print "is compatible with DVB-S"
+ else:
+ print "is not compatible with DVB-S"
+ return
+
+ flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0
+ for x in self["config"].list:
+ x[1].save()
+
+ self.flags = flags
+ self.feid = index_to_scan
+ self.tlist = []
+ orbpos = self.satList[index_to_scan][self.scan_satselection[index_to_scan].index]
+ self.startSatBlindscanSearch(index_to_scan, orbpos, self.session)
+
+ def keyCancel(self):
+ for x in self["config"].list:
+ x[1].cancel()
+ self.session.nav.playService(self.current_play_service)
+ self.close()
+
+ def startScan(self, tlist, flags, feid, networkid = 0):
+ if len(tlist):
+ self.session.open(ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags, "networkid": networkid}])
+ else:
+ self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
+
+ def createSetup(self):
+ self.list = []
+ self.multiscanlist = []
+ index_to_scan = int(self.scan_nims.value)
+ print "ID: ", index_to_scan
+
+ self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
+ self.list.append(self.tunerEntry)
+
+ if self.scan_nims == [ ]:
+ return
+
+ self.systemEntry = None
+ self.modulationEntry = None
+ nim = nimmanager.nim_slots[index_to_scan]
+
+ self.scan_networkScan.value = False
+ if nim.isCompatible("DVB-S") :
+ self.list.append(getConfigListEntry(_('Satellite'), self.scan_satselection[index_to_scan]))
+ self.list.append(getConfigListEntry(_('Scan start frequency'), self.blindscan_start_frequency))
+ self.list.append(getConfigListEntry(_('Scan stop frequency'), self.blindscan_stop_frequency))
+ self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
+ self.list.append(getConfigListEntry(_("Scan band"), self.blindscan_hi))
+ self.list.append(getConfigListEntry(_('Scan start symbolrate'), self.blindscan_start_symbol))
+ self.list.append(getConfigListEntry(_('Scan stop symbolrate'), self.blindscan_stop_symbol))
+ self["config"].list = self.list
+ self["config"].l.setList(self.list)
+ else:
+ self.session.open(MessageBox, _("Please setup DVB-S Tuner"), MessageBox.TYPE_ERROR)
+
+
+def main(session, **kwargs):
+ session.open(Blindscan)
+
+def Plugins(**kwargs):
+ return PluginDescriptor(name=_("Blindscan"), description="scan type(DVB-S)", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
+
SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \
DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment \
CrashlogAutoSubmit CleanupWizard VideoEnhancement WirelessLan NetworkWizard \
- TempFanControl FactoryTest Fancontrol FPGAUpgrade WirelessLanSetup
+ TempFanControl FactoryTest Fancontrol FPGAUpgrade WirelessLanSetup ManualFancontrol \
+ Blindscan
install_PYTHON = \
__init__.py
--- /dev/null
+from Components.config import config, ConfigSubList, ConfigSubsection
+import NavigationInstance
+from enigma import iRecordableService
+from Components.ConfigList import ConfigListScreen
+from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSlider
+from enigma import eTimer
+
+config.plugins.simplefancontrols = ConfigSubsection()
+config.plugins.simplefancontrols.standbymode = ConfigSelection(default = "yes", choices = [
+ ("no", _("no")), ("yes", _("yes"))])
+config.plugins.simplefancontrols.pwmvalue = ConfigSlider(default = 10, increment = 5, limits = (0, 255))
+
+class instandbyOn:
+ def __init__(self):
+ self.fanoffmode = 'OFF'
+ self.default_pwm_value_onRecordings = 5
+ config.misc.standbyCounter.addNotifier(self.standbyBegin, initial_call = False)
+ if config.plugins.simplefancontrols.pwmvalue.value == 0:
+ self.fanoffmode = 'ON'
+ self.InitTimer = eTimer()
+ if self.initConfig not in self.InitTimer.callback:
+ self.InitTimer.callback.append(self.initConfig)
+ print "<SimpleFancontrol> init : Timer loop start!!"
+ self.InitTimer.startLongTimer(3)
+ print "<SimpleFancontrol> init : self.fanoffmode : ", self.fanoffmode
+ print "<SimpleFancontrol> init : config.plugins.simplefancontrols.pwmvalue.value : ", config.plugins.simplefancontrols.pwmvalue.value
+
+ def initConfig(self):
+ print "<SimpleFancontrol>Try initConfig..."
+ if NavigationInstance.instance is None:
+ self.InitTimer.startLongTimer(1)
+ else:
+ if config.plugins.simplefancontrols.pwmvalue.value == 0:
+ NavigationInstance.instance.record_event.append(self.getRecordEvent_onFanOFF)
+ recordings = NavigationInstance.instance.getRecordings()
+ print "<SimpleFancontrol> initConfig : recordings : ", recordings
+ if recordings:
+ self.setPWM(self.default_pwm_value_onRecordings)
+ else:
+ self.setPWM(0)
+ else:
+ self.setPWM(config.plugins.simplefancontrols.pwmvalue.value)
+
+ def standbyBegin(self, configElement):
+ print "<SimpleFancontrol> standbyBegin : config.plugins.fancontrols.standbymode.value : ", config.plugins.simplefancontrols.standbymode.value
+ print "<SimpleFancontrol> standbyBegin : self.fanoffmode : ", self.fanoffmode
+ if config.plugins.simplefancontrols.standbymode.value == "yes" and config.plugins.simplefancontrols.pwmvalue > 0:
+ from Screens.Standby import inStandby
+ inStandby.onClose.append(self.StandbyEnd)
+ NavigationInstance.instance.record_event.append(self.getRecordEvent)
+ recordings = NavigationInstance.instance.getRecordings()
+ if not recordings:
+ self.setPWM(0)
+
+ def StandbyEnd(self):
+ print "<SimpleFancontrol> Standby End"
+ NavigationInstance.instance.record_event.remove(self.getRecordEvent)
+ if self.getPWM() == 0:
+ self.setPWM(config.plugins.simplefancontrols.pwmvalue.value)
+
+ def getRecordEvent(self, recservice, event):
+ recordings = len(NavigationInstance.instance.getRecordings())
+ print "<SimpleFancontrol> recordings : %d , event : %d" % (recordings,event)
+ if event == iRecordableService.evEnd:
+ print "<SimpleFancontrol> getRecordEvent : evEnd"
+ if recordings == 0:
+ self.setPWM(0)
+ elif event == iRecordableService.evStart:
+ print "<SimpleFancontrol> getRecordEvent : evStart"
+ if self.getPWM() == 0:
+ self.setPWM(config.plugins.simplefancontrols.pwmvalue.value)
+
+ def getPWM(self):
+ f = open("/proc/stb/fp/fan_pwm", "r")
+ value = int(f.readline().strip(), 16)
+ f.close()
+ print "<SimpleFancontrol> getPWM : %d "%value
+ return value
+
+ def setPWM(self, value):
+ print "<SimpleFancontrol> setPWM to : %d"%value
+ f = open("/proc/stb/fp/fan_pwm", "w")
+ f.write("%x" % value)
+ f.close()
+
+ def appendRecordEventCallback(self):
+ print "<SimpleFancontrol> appendRecordEventCallback "
+ NavigationInstance.instance.record_event.append(self.getRecordEvent_onFanOFF)
+ recordings = NavigationInstance.instance.getRecordings()
+ if recordings:
+ instandbyon.setPWM(self.default_pwm_value_onRecordings)
+
+ def removeRecordEventCallback(self):
+ print "<SimpleFancontrol> removeRecordEventCallback "
+ NavigationInstance.instance.record_event.remove(self.getRecordEvent_onFanOFF)
+
+ def getRecordEvent_onFanOFF(self, recservice, event):
+ recordings = len(NavigationInstance.instance.getRecordings())
+ print "<SimpleFancontrol_> recordings : %d , event : %d" % (recordings,event)
+ if event == iRecordableService.evEnd:
+ print "<SimpleFancontrol_> getRecordEvent : evEnd"
+ if recordings == 0:
+ self.setPWM(0)
+ elif event == iRecordableService.evStart:
+ print "<SimpleFancontrol_> getRecordEvent : evStart"
+ if self.getPWM() == 0:
+ self.setPWM(self.default_pwm_value_onRecordings)
+
+instandbyon = instandbyOn()
+
--- /dev/null
+installdir = $(pkglibdir)/python/Plugins/SystemPlugins/ManualFancontrol
+
+SUBDIRS = meta
+
+install_PYTHON = \
+ __init__.py \
+ plugin.py \
+ InstandbyOn.py
--- /dev/null
+installdir = $(datadir)/meta
+
+dist_install_DATA = plugin_manualfancontrol.xml
--- /dev/null
+<default>
+ <prerequisites>
+ <tag type="System" />
+ </prerequisites>
+ <info>
+ <author>hschang</author>
+ <name>ManualFancontrol</name>
+ <packagename>enigma2-plugin-systemplugins-manualfancontrol</packagename>
+ <shortdescription>Fancontrol Settings inStandby Mode</shortdescription>
+ <description>Fancontrol Settings inStandby Mode</description>
+ </info>
+
+ <files type="package"> <!-- without version, without .ipk -->
+ <file type="package" name="enigma2-plugin-systemplugins-manualfancontrol" />
+ </files>
+
+</default>
--- /dev/null
+from Screens.Screen import Screen
+from Components.ConfigList import ConfigListScreen
+from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection, ConfigInteger
+from Components.ActionMap import ActionMap,NumberActionMap
+from Screens.MessageBox import MessageBox
+from Components.Sources.StaticText import StaticText
+from Plugins.Plugin import PluginDescriptor
+from Plugins.SystemPlugins.ManualFancontrol.InstandbyOn import instandbyon
+import NavigationInstance
+
+class ManualFancontrol(Screen,ConfigListScreen):
+ skin = """
+ <screen name="ManualFancontrol" position="center,center" size="560,300" title="Fancontrol Settings in Standby mode" >
+ <ePixmap pixmap="Vu_HD/buttons/red.png" position="10,10" size="25,25" alphatest="on" />
+ <ePixmap pixmap="Vu_HD/buttons/green.png" position="290,10" size="25,25" alphatest="on" />
+ <widget source="key_red" render="Label" position="40,10" zPosition="1" size="140,25" font="Regular;20" halign="center" valign="center" transparent="1" />
+ <widget source="key_green" render="Label" position="320,10" zPosition="1" size="140,25" font="Regular;20" halign="center" valign="center" transparent="1" />
+ <widget name="config" zPosition="2" position="5,50" size="550,200" scrollbarMode="showOnDemand" transparent="1" />
+ <widget source="current" render="Label" position="150,270" zPosition="1" size="280,30" font="Regular;20" halign="center" valign="center" transparent="1" />
+ </screen>"""
+
+ def __init__(self,session):
+ Screen.__init__(self,session)
+ self.session = session
+ self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ],
+ {
+ "ok": self.keySave,
+ "cancel": self.keyCancel,
+ "red": self.keyCancel,
+ "green": self.keySave,
+ }, -2)
+ self.list = []
+ ConfigListScreen.__init__(self, self.list,session = self.session)
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("Save"))
+ self["current"] = StaticText(_(" "))
+ self.configSetup()
+
+ def isRecording(self):
+ recordings = NavigationInstance.instance.getRecordings()
+ if recordings :
+ return True
+ else:
+ return False
+
+ def displayCurrentValue(self):
+ currrent_val = self["config"].getCurrent()[0]+" : "+str(self["config"].getCurrent()[1].value)
+ self["current"].setText(_(currrent_val))
+ print currrent_val
+
+ def selectionChanged(self):
+ if self["config"].getCurrent() == self.pwmEntry:
+ instandbyon.setPWM(self["config"].getCurrent()[1].value)
+
+ def keyLeft(self):
+ oldpwmvalue=config.plugins.simplefancontrols.pwmvalue.value
+ ConfigListScreen.keyLeft(self)
+ if self["config"].getCurrent() == self.pwmEntry and oldpwmvalue == 5:
+ self.createSetup()
+ else:
+ self.displayCurrentValue()
+ self.selectionChanged()
+
+ def keyRight(self):
+ oldpwmvalue=config.plugins.simplefancontrols.pwmvalue.value
+ ConfigListScreen.keyRight(self)
+ if self["config"].getCurrent() == self.pwmEntry and oldpwmvalue == 0:
+ self.createSetup()
+ while self["config"].getCurrent() != self.pwmEntry:
+ self["config"].setCurrentIndex(self["config"].getCurrentIndex()+1)
+ else:
+ self.displayCurrentValue()
+ self.selectionChanged()
+
+ def createSetup(self):
+ self.list = []
+ if config.plugins.simplefancontrols.pwmvalue.value > 0:
+ self.list.append( self.standbyEntry )
+ self.list.append( self.pwmEntry )
+ self["config"].list = self.list
+ self["config"].l.setList(self.list)
+
+ def configSetup(self):
+ self.standbyEntry = getConfigListEntry(_("FanOFF InStanby"), config.plugins.simplefancontrols.standbymode)
+ self.pwmEntry = getConfigListEntry(_("PWM value"), config.plugins.simplefancontrols.pwmvalue)
+ if not self.displayCurrentValue in self["config"].onSelectionChanged:
+ self["config"].onSelectionChanged.append(self.displayCurrentValue)
+ self.createSetup()
+
+ def newConfig(self):
+ if self["config"].getCurrent() == self.pwmEntry and config.plugins.simplefancontrols.pwmvalue.value == 0:
+ self.createSetup()
+
+ def keySave(self):
+ if instandbyon.fanoffmode is 'OFF' and config.plugins.simplefancontrols.pwmvalue.value == 0:
+ instandbyon.appendRecordEventCallback()
+ instandbyon.fanoffmode = 'ON'
+ print "<SimpleFancontrol> instandbyon.fanoffmode 'OFF' -> 'ON'"
+
+ elif instandbyon.fanoffmode is 'ON' and config.plugins.simplefancontrols.pwmvalue.value != 0:
+ instandbyon.removeRecordEventCallback()
+ instandbyon.fanoffmode = 'OFF'
+ print "<SimpleFancontrol> instandbyon.fanoffmode 'ON' -> 'OFF'"
+ if instandbyon.fanoffmode == 'ON' and self.isRecording() and instandbyon.getPWM() != instandbyon.default_pwm_value_onRecordings:
+ instandbyon.setPWM(instandbyon.default_pwm_value_onRecordings)
+ ConfigListScreen.keySave(self)
+
+ def cancelConfirm(self, result):
+ if not result:
+ return
+ for x in self["config"].list:
+ x[1].cancel()
+ if instandbyon.fanoffmode == 'ON' and self.isRecording():
+ if instandbyon.getPWM() != instandbyon.default_pwm_value_onRecordings:
+ instandbyon.setPWM(instandbyon.default_pwm_value_onRecordings)
+ else:
+ pass
+ else:
+ instandbyon.setPWM(config.plugins.simplefancontrols.pwmvalue.value)
+ self.close()
+
+ def keyCancel(self):
+ if self["config"].isChanged():
+ self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
+ else:
+ if instandbyon.fanoffmode == 'ON' and self.isRecording() and instandbyon.getPWM() != instandbyon.default_pwm_value_onRecordings:
+ instandbyon.setPWM(instandbyon.default_pwm_value_onRecordings)
+ self.close()
+
+def main(session, **kwargs):
+ session.open(ManualFancontrol)
+
+def Plugins(**kwargs):
+ return [PluginDescriptor(name=_("Manual Fan control"), description="setup Fancontol inStandby mode", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = True, fnc=main)]
<tag type="System" />
</prerequisites>
<info language="en">
- <author>ikseong</author>
+ <author>hschang</author>
<name>WirelessLanSetup</name>
<packagename>enigma2-plugin-systemplugins-wirelesslansetup</packagename>
<shortdescription>Wireless LAN Setup plugin</shortdescription>
for x in iNetwork.getAdapterList():
if x.startswith('eth'):
continue
- list.append((self.getAdapterDescription(x) + " (%s)"%x,x))
+ description=self.getAdapterDescription(x)
+ if description == "Unknown network adapter":
+ list.append((description,x))
+ else:
+ list.append((description + " (%s)"%x,x))
return list
def getAdapterDescription(self, iface):
- if iface == 'eth0':
- return _("Internal LAN adapter.")
- else:
- classdir = "/sys/class/net/" + iface + "/device/"
- driverdir = "/sys/class/net/" + iface + "/device/driver/"
- if os_path.exists(classdir):
- files = listdir(classdir)
- if 'driver' in files:
- if os_path.realpath(driverdir).endswith('rtw_usb_drv'):
- return _("Realtak")+ " " + _("WLAN adapter.")
- elif os_path.realpath(driverdir).endswith('ath_pci'):
- return _("Atheros")+ " " + _("WLAN adapter.")
- elif os_path.realpath(driverdir).endswith('zd1211b'):
- return _("Zydas")+ " " + _("WLAN adapter.")
- elif os_path.realpath(driverdir).endswith('rt73'):
- return _("Ralink")+ " " + _("WLAN adapter.")
- elif os_path.realpath(driverdir).endswith('rt73usb'):
- return _("Ralink")+ " " + _("WLAN adapter.")
- else:
- return str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter")
+ classdir = "/sys/class/net/" + iface + "/device/"
+ driverdir = "/sys/class/net/" + iface + "/device/driver/"
+ if os_path.exists(classdir):
+ files = listdir(classdir)
+ if 'driver' in files:
+ if os_path.realpath(driverdir).endswith('rtw_usb_drv'):
+ return _("Realtak")+ " " + _("WLAN adapter.")
+ elif os_path.realpath(driverdir).endswith('ath_pci'):
+ return _("Atheros")+ " " + _("WLAN adapter.")
+ elif os_path.realpath(driverdir).endswith('zd1211b'):
+ return _("Zydas")+ " " + _("WLAN adapter.")
+ elif os_path.realpath(driverdir).endswith('rt73'):
+ return _("Ralink")+ " " + _("WLAN adapter.")
+ elif os_path.realpath(driverdir).endswith('rt73usb'):
+ return _("Ralink")+ " " + _("WLAN adapter.")
else:
- return _("Unknown network adapter.")
+ return str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter")
+ else:
+ return _("Unknown network adapter")
+ else:
+ return _("Unknown network adapter")
class WlanSetup(Screen,HelpableScreen):
skin = """
self.key_type = None
self.encryption_key = None
self.wlanscanap = None
- self.scanAPcount =5
+# self.scanAPcount =5
+ self.scanAPcount =1
self.list = []
ConfigListScreen.__init__(self, self.list,session = self.session)
self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
self.readWpaSupplicantConf()
-# iNetwork.getInterfaces()
- self.readWlanSettings()
+ self.scanAPFailedTimer = eTimer()
+ self.scanAPFailedTimer.callback.append(self.scanAPFailed)
self.scanAplistTimer = eTimer()
self.scanAplistTimer.callback.append(self.scanApList)
- self.scanAplistTimer.start(100,True)
self.Console = Console()
+# self.scanAplistTimer.start(100,True)
+ iNetwork.getInterfaces(self.readWlanSettings)
- def readWlanSettings(self):
+ def readWlanSettings(self,ret=None):
+ if ret is not True:
+ print "getInterfaces Fail... "
if iNetwork.getAdapterAttribute(self.iface, "up") == True:
default_tmp = "on"
else:
wlanconfig.gateway = ConfigIP(default=iNetwork.getAdapterAttribute(self.iface, "gateway") or [0,0,0,0])
- self["ipaddress"] = StaticText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "ip"))))
- self["netmask"] = StaticText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "netmask"))))
- self["gateway"] = StaticText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "gateway"))))
+ self["ipaddress"].setText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "ip"))))
+ self["netmask"].setText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "netmask"))))
+ self["gateway"].setText(_(self.formatip(iNetwork.getAdapterAttribute(self.iface, "gateway"))))
if self.encryption_key is not None:
default_tmp = "on"
("ascii", _("ASCII")), ("hex", _("HEX"))])
default_tmp = self.encryption_key or "XXXXXXXX"
wlanconfig.key = ConfigText(default = default_tmp, visible_width = 50, fixed_size = False)
+ self.scanAplistTimer.start(100,True)
def readWpaSupplicantConf(self):
try:
self.key_type = 0 # hex
self.encryption_key = data[4:-1]
data = wpafd.readline()
- print self.ssid,self.scan_ssid,self.key_mgmt,self.proto,self.key_type,self.wep_key
+ print self.ssid,self.scan_ssid,self.key_mgmt,self.proto,self.key_type,self.encryption_key
wpafd.close()
else:
print 'read error'
if wlanconfig.usegateway.value is "on":
self.configList.append(self.gatewayEntry)
self.configList.append( self.essidEntry )
- print "#### wlanconfig.essid.value : ",wlanconfig.essid.value
+# print "#### wlanconfig.essid.value : ",wlanconfig.essid.value
if wlanconfig.essid.value == 'Input hidden ESSID':
self.configList.append( self.hiddenessidEntry )
self.configList.append( self.encryptEntry )
def scanApList(self):
self.apList = []
- self.scanAPcount -=1
self.configurationmsg = self.session.open(MessageBox, _("Please wait for scanning AP..."), type = MessageBox.TYPE_INFO, enable_input = False)
- os_system('ifconfig '+self.iface+" up")
+ cmd = "ifconfig "+self.iface+" up"
+ print 'cmd ',cmd
+ os_system(cmd)
self.wlanscanap = Console()
cmd = "iwlist "+self.iface+" scan"
- print 'cmd',cmd
+ print 'cmd ',cmd
self.wlanscanap.ePopen(cmd, self.apListFinnished,self.apListParse)
def apListFinnished(self, result, retval,extra_args):
global selectap
if data == 0:
if self.scanAPcount >0:
+ self.scanAPcount -=1
self.configurationmsg.close(True)
- self.scanAplistTimer.start(100,True)
+ time.sleep(3)
+ self.scanAplistTimer.start(500,True)
return
else:
self.configurationmsg.close(True)
- self.session.open(MessageBox, _("Scan AP Failed"), MessageBox.TYPE_INFO,2)
+ self.scanAPFailedTimer.start(500,True)
return
else:
self.apList = []
- self.scanAPcount =5
+# self.scanAPcount =5
+ self.scanAPcount =0
list = data.splitlines()
for x in list:
xx = x.lstrip()
- if xx.startswith('ESSID:') and len(xx)>8:
+ if xx.startswith('ESSID:') and len(xx)>8 and xx[7:-1]not in self.apList:
self.apList.append(xx[7:-1])
self.apList.append('Input hidden ESSID')
- print "###### selectap : ",selectap
+# print "###### selectap : ",selectap
if selectap is not None and selectap in self.apList:
wlanconfig.essid = ConfigSelection(default=selectap,choices = self.apList)
elif self.ap_scan is not None and self.ap_scan.strip() == '2':
self.configurationmsg.close(True)
self.createConfig()
+ def scanAPFailed(self):
+ self.session.openWithCallback(self.keyCancel ,MessageBox, _("Scan AP Failed"), MessageBox.TYPE_ERROR,10)
+
def keyLeft(self):
ConfigListScreen.keyLeft(self)
self.newConfig()
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") ) )
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
- print "########## checkNetworkShares : "
if not self.Console:
self.Console = Console()
cmd = "cat /proc/mounts"
if split[2] in networks:
self.session.open(MessageBox, ("NOT deconfiguring network interfaces :\n network shares still mounted\n"), type = MessageBox.TYPE_ERROR, timeout = 10)
callback(False)
+ if self["config"].getCurrent() == self.keyEntry or self["config"].getCurrent() == self.hiddenessidEntry :
+ self["config"].getCurrent()[1].onSelect(self.session)
return
callback(True)
if num_configured_if == 1 and self.iface in iNetwork.getConfiguredAdapters():
self.writeWlanConfig(False)
else:
- self.session.openWithCallback(self.writeWlanConfig, MessageBox, (_("Are you sure you want to deactive another network interfaces?\n") ) )
+ 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)
else:
self.writeWlanConfig(False)
elif ret == -2:
self.session.open(MessageBox, _("hidden ESSID empty"), type = MessageBox.TYPE_ERROR, timeout = 10)
return
- iffd = open("/etc/network/interfaces","r")
- if iffd > 0:
- prev_content = ""
- next_content = ""
- data = iffd.readline()
- status = 0
- while len(data) >0 :
- if data.startswith('iface '+self.iface) or data.startswith('auto '+self.iface):
- status = 1
- data = iffd.readline()
- continue
- elif not data.startswith('auto lo') and data.startswith('auto '):
- if ret == True or data[5:] not in iNetwork.getConfiguredAdapters():
- data = iffd.readline()
- continue
- if status == 1 and data.startswith('iface ') or data.startswith('auto '):
- status = 2
- if status == 0:
- prev_content += data
- elif status == 2:
- next_content += data
- data = iffd.readline()
- iffd.close()
- iffd = open("/etc/network/interfaces","w")
- if iffd > 0 :
- if prev_content == "":
- prev_content = "# automatically generated by STB\n"
- prev_content += "# do Not change manually!\n\n"
- prev_content += "auto lo\n"
- prev_content += "iface lo inet loopback\n\n"
- iffd.write(prev_content)
- if wlanconfig.usedevice.value=="on":
- iNetwork.setAdapterAttribute(self.iface, "up", True)
- contents = "auto "+self.iface+"\n"
- contents += "iface "+self.iface+" inet "
- if wlanconfig.usedhcp.value =="on":
- iNetwork.setAdapterAttribute(self.iface, "dhcp", True)
- contents +="dhcp\n"
- else:
- iNetwork.setAdapterAttribute(self.iface, "dhcp", False)
- contents +="static\n"
- print wlanconfig.ip.value
- iNetwork.setAdapterAttribute(self.iface, "ip", wlanconfig.ip.value)
- iNetwork.setAdapterAttribute(self.iface, "netmask", wlanconfig.netmask.value)
- contents +="\taddress "+ self.formatip(wlanconfig.ip.value)+"\n"
- contents +="\tnetmask "+ self.formatip(wlanconfig.netmask.value)+"\n"
- if wlanconfig.usegateway.value == "on":
- iNetwork.setAdapterAttribute(self.iface, "gateway", wlanconfig.gateway.value)
- contents +="\tgateway "+ self.formatip(wlanconfig.gateway.value)+"\n"
- contents += "\tpre-up wpa_supplicant -i"+self.iface+" -c/etc/wpa_supplicant.conf -B -D"+iNetwork.detectWlanModule(self.iface)+"\n"
- contents += "\tpost-down wpa_cli terminate\n\n"
- iffd.write(contents)
- else:
- iNetwork.setAdapterAttribute(self.iface, "up", False)
- iNetwork.deactivateInterface(self.iface)
- iffd.write(next_content)
- iffd.close()
- else :
- self.session.open(MessageBox, _("/etc/network/interfaces open error."), type = MessageBox.TYPE_ERROR, timeout = 10)
- return
+
+ if wlanconfig.usedevice.value=="on":
+ iNetwork.setAdapterAttribute(self.iface, "up", True)
+ if wlanconfig.usedhcp.value =="on":
+ iNetwork.setAdapterAttribute(self.iface, "dhcp", True)
+ else:
+ iNetwork.setAdapterAttribute(self.iface, "dhcp", False)
+ iNetwork.setAdapterAttribute(self.iface, "ip", wlanconfig.ip.value)
+ iNetwork.setAdapterAttribute(self.iface, "netmask", wlanconfig.netmask.value)
+ if wlanconfig.usegateway.value == "on":
+ iNetwork.setAdapterAttribute(self.iface, "gateway", wlanconfig.gateway.value)
+ else:
+ iNetwork.setAdapterAttribute(self.iface, "up", False)
+ iNetwork.deactivateInterface(self.iface)
+ contents = "\tpre-up wpa_supplicant -i"+self.iface+" -c/etc/wpa_supplicant.conf -B -D"+iNetwork.detectWlanModule(self.iface)+"\n"
+ contents += "\tpost-down wpa_cli terminate\n\n"
+ iNetwork.setAdapterAttribute(self.iface, "configStrings", contents)
+ iNetwork.writeNetworkConfig()
iNetwork.restartNetwork(self.updateCurrentInterfaces)
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 formatip(self, iplist):
list = []
list = iplist
+# print "iplist : ",iplist
try:
if len(iplist) == 4:
result = str(iplist[0])+"."+str(iplist[1])+"."+str(iplist[2])+"."+str(iplist[3])
else:
result ="0.0.0.0"
+# print "result : ",result
return result
except:
return "[N/A]"
if not result:
return
if self.oldInterfaceState is False:
+ iNetwork.setAdapterAttribute(self.iface, "up", False)
iNetwork.deactivateInterface(self.iface,self.keyCancelCB)
else:
self.close()
- def keyCancel(self):
+ def keyCancel(self,yesno = True):
if self["config"].isChanged():
self.session.openWithCallback(self.keyCancelConfirm, MessageBox, _("Really close without saving settings?"))
else:
- self.close()
+ self.keyCancelConfirm(True)
def keyCancelCB(self,data):
if data is not None:
<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,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 __init__(self, session, iface):
self.session = session
self.iface = iface
self.wlanscanap = None
- self.scanAPcount = 5
+# self.scanAPcount = 5
+ self.scanAPcount = 1
self.apList = {}
self.SetApList = []
self["Frequency"] = StaticText(" ")
self["Encryption key"] = StaticText(" ")
self["BitRate"] = StaticText(" ")
+ self.scanAPFailedTimer = eTimer()
+ self.scanAPFailedTimer.callback.append(self.scanAPFailed)
self.scanAplistTimer = eTimer()
self.scanAplistTimer.callback.append(self.scanApList)
self.scanAplistTimer.start(100,True)
-
def left(self):
self["menulist"].pageUp()
self.displayApInfo()
# self.close()
def scanApList(self):
- print "self.scanAPcount : ",self.scanAPcount
+ # print "self.scanAPcount : ",self.scanAPcount
self.apList = {}
self.SetApList = []
self.configurationmsg = self.session.open(MessageBox, _("Please wait for scanning AP..."), type = MessageBox.TYPE_INFO, enable_input = False)
- self.scanAPcount -=1
os_system('ifconfig '+self.iface+" up")
self.wlanscanap = Console()
cmd = "iwlist "+self.iface+" scan"
def APListParse(self,data):
if data == 0:
if self.scanAPcount >0:
+ self.scanAPcount -=1
self.configurationmsg.close(True)
- self.scanAplistTimer.start(100,True)
+ time.sleep(3)
+ self.scanAplistTimer.start(500,True)
return
else:
- self.session.open(MessageBox, _("Scan AP Failed"), MessageBox.TYPE_INFO,5)
+ self.configurationmsg.close(True)
+ self.scanAPFailedTimer.start(500,True)
return
else:
# print data
self.apList = {}
- self.scanAPcount =5
+# self.scanAPcount =5
+ self.scanAPcount =0
list = data.splitlines()
for line in list:
# print "line : ",line
self.configurationmsg.close(True)
self.displayApInfo()
+ def scanAPFailed(self):
+ self.session.openWithCallback(self.ScanAPclose,MessageBox, _("Scan AP Failed"), MessageBox.TYPE_ERROR,10)
+
def displayApInfo(self):
if len(self.apList) >0:
self["menulist"].setList(self.SetApList)
def readAP(self,result,retval,extra_args):
(callback) = extra_args
- self.apState = False
+ self.apState = None
if self.iwconfigConsole is not None:
if retval == 0:
self.iwconfigConsole = None