1 from Screens.Screen import Screen
2 from Components.ConfigList import ConfigListScreen
3 from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection
4 from Components.ActionMap import ActionMap
5 from Screens.MessageBox import MessageBox
6 from Components.Sources.StaticText import StaticText
7 from Plugins.Plugin import PluginDescriptor
8 from Tools.Directories import fileExists
10 config.plugins.ultimo4kMiscControl = ConfigSubsection()
11 config.plugins.ultimo4kMiscControl.forceLnbPower = ConfigSelection(default = "off", choices = [ ("on", _("Yes")), ("off", _("No"))] )
12 config.plugins.ultimo4kMiscControl.forceToneBurst = ConfigSelection(default = "disable", choices = [ ("enable", _("Yes")), ("disable", _("No"))] )
13 config.plugins.ultimo4kMiscControl.dvbCiDelay = ConfigSelection(default = "256", choices = [ ("16", _("16")), ("32", _("32")), ("64", _("64")), ("128", _("128")), ("256", _("256"))] )
15 PROC_FORCE_LNBPOWER = "/proc/stb/frontend/fbc/force_lnbon"
16 PROC_FORCE_TONEBURST = "/proc/stb/frontend/fbc/force_toneburst"
17 PROC_DVB_CI_DELAY = "/proc/stb/tsmux/rmx_delay"
19 def setProcValueOnOff(value, procPath):
21 print "[ultimo4kMiscControl] set %s : %s" % (procPath, value)
22 fd = open(procPath,'w')
27 print "[ultimo4kMiscControl] proc write Error", e
31 from enigma import eTimer
32 class checkDriverSupport:
34 self.onLayoutFinish.append(self.procCheck)
35 self.dispErrorTimer = eTimer()
36 self.dispErrorTimer.callback.append(self.dispErrorMsg)
39 if not (fileExists(PROC_FORCE_LNBPOWER) and fileExists(PROC_FORCE_TONEBURST) and fileExists(PROC_DVB_CI_DELAY)):
40 self.dispErrorTimer.start(0, True)
42 def dispErrorMsg(self):
43 self.session.openWithCallback(self.close ,MessageBox, _("Driver is not supported."), MessageBox.TYPE_ERROR)
45 class ultimo4kMiscControl(Screen, ConfigListScreen, checkDriverSupport):
47 <screen position="center,center" size="400,250" title="Ultimo4K Misc. Control" >
48 <ePixmap pixmap="skin_default/buttons/red.png" position="30,10" size="140,40" alphatest="on" />
49 <ePixmap pixmap="skin_default/buttons/green.png" position="230,10" size="140,40" alphatest="on" />
50 <widget source="key_red" render="Label" position="30,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
51 <widget source="key_green" render="Label" position="230,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
52 <widget name="config" zPosition="2" position="5,70" size="380,180" scrollbarMode="showOnDemand" transparent="1" />
56 def __init__(self,session):
57 Screen.__init__(self,session)
58 self.session = session
59 self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ],
62 "cancel": self.keyCancel,
63 "red": self.keyCancel,
64 "green": self.keySave,
67 ConfigListScreen.__init__(self, self.list,session = self.session)
68 self["key_red"] = StaticText(_("Cancel"))
69 self["key_green"] = StaticText(_("Ok"))
72 checkDriverSupport.__init__(self)
74 def createSetup(self):
76 self.lnbPowerEntry = getConfigListEntry(_("Force LNB Power"), config.plugins.ultimo4kMiscControl.forceLnbPower)
77 self.toneBurstEntry = getConfigListEntry(_("Force ToneBurst"), config.plugins.ultimo4kMiscControl.forceToneBurst)
78 self.ciDelayEntry = getConfigListEntry(_("DVB CI Delay"), config.plugins.ultimo4kMiscControl.dvbCiDelay)
79 self.list.append( self.lnbPowerEntry )
80 self.list.append( self.toneBurstEntry )
81 self.list.append( self.ciDelayEntry )
82 self["config"].list = self.list
83 self["config"].l.setList(self.list)
86 res = setProcValueOnOff(config.plugins.ultimo4kMiscControl.forceLnbPower.value, PROC_FORCE_LNBPOWER)
88 res = setProcValueOnOff(config.plugins.ultimo4kMiscControl.forceToneBurst.value, PROC_FORCE_TONEBURST)
90 res = setProcValueOnOff(config.plugins.ultimo4kMiscControl.dvbCiDelay.value, PROC_DVB_CI_DELAY)
94 self.session.openWithCallback(self.close, MessageBox, _("SET FAILED!\n"), MessageBox.TYPE_ERROR)
99 def resetConfig(self):
100 for x in self["config"].list:
103 def main(session, **kwargs):
104 session.open(ultimo4kMiscControl)
106 def OnSessionStart(session, **kwargs):
107 setProcValueOnOff(config.plugins.ultimo4kMiscControl.forceLnbPower.value, PROC_FORCE_LNBPOWER)
108 setProcValueOnOff(config.plugins.ultimo4kMiscControl.forceToneBurst.value, PROC_FORCE_TONEBURST)
109 setProcValueOnOff(config.plugins.ultimo4kMiscControl.dvbCiDelay.value, PROC_DVB_CI_DELAY)
111 def Plugins(**kwargs):
113 pList.append( PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, fnc=OnSessionStart) )
114 pList.append( PluginDescriptor(name=_("Ultimo4K Misc. Control"), description="set Ultimo4K LNB Power and etc..", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = False, fnc=main) )