diff options
author | smlee <smlee@dev3> | 2016-04-18 10:17:23 (GMT) |
---|---|---|
committer | smlee <smlee@dev3> | 2016-04-18 10:17:23 (GMT) |
commit | 814b8ce842acf21087a4ec2b56fd3102e698fb08 (patch) | |
tree | 852d39e0bcc08502c2f1a86cacf1ceaf9ffe79e2 | |
parent | 059fdda03072b1be0d67a525f20284df68a84a3c (diff) | |
parent | 0a885c4052c7e0ab2395fc9fb79e400a16b04d56 (diff) |
Merge branch 'vuplus_experimental' into vuplus_experimental
8 files changed, 191 insertions, 40 deletions
diff --git a/configure.ac b/configure.ac index ba807c9..134dc50 100644 --- a/configure.ac +++ b/configure.ac @@ -304,6 +304,8 @@ lib/python/Plugins/SystemPlugins/AnimationSetup/Makefile lib/python/Plugins/SystemPlugins/AnimationSetup/meta/Makefile lib/python/Plugins/SystemPlugins/BoxModeConfig/Makefile lib/python/Plugins/SystemPlugins/BoxModeConfig/meta/Makefile +lib/python/Plugins/SystemPlugins/Solo4kMiscControl/Makefile +lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/Makefile lib/python/Tools/Makefile lib/service/Makefile lib/components/Makefile diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index 7f546fe..3a16f5f 100755 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -8,7 +8,7 @@ SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \ Blindscan RemoteControlCode UI3DSetup UIPositionSetup HDMICEC LEDBrightnessSetup \ FirmwareUpgrade CrashReport 3GModemManager WirelessAccessPoint ZappingModeSelection \ DeviceManager TransCodingSetup WOLSetup NetDrive AudioEffect AnimationSetup \ - BoxModeConfig + BoxModeConfig Solo4kMiscControl install_PYTHON = \ __init__.py diff --git a/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/Makefile.am b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/Makefile.am new file mode 100644 index 0000000..1d7f276 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/Makefile.am @@ -0,0 +1,7 @@ +installdir = $(pkglibdir)/python/Plugins/SystemPlugins/Solo4kMiscControl + +SUBDIRS = meta + +install_PYTHON = \ + __init__.py \ + plugin.py diff --git a/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/__init__.py b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/__init__.py new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/__init__.py @@ -0,0 +1 @@ + diff --git a/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/Makefile.am new file mode 100644 index 0000000..990f998 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/Makefile.am @@ -0,0 +1,3 @@ +installdir = $(datadir)/meta + +dist_install_DATA = plugin_solo4kmisccontrol.xml diff --git a/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/plugin_solo4kmisccontrol.xml b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/plugin_solo4kmisccontrol.xml new file mode 100644 index 0000000..d4bd7e2 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/meta/plugin_solo4kmisccontrol.xml @@ -0,0 +1,16 @@ +<default> + <prerequisites> + <tag type="System" /> + </prerequisites> + <info> + <author>hschang</author> + <name>Solo4kMiscControl</name> + <packagename>enigma2-plugin-systemplugins-solo4kmisccontrol</packagename> + <shortdescription>set Solo4K LNB Power and etc..</shortdescription> + <description>Control LNB Power and ToneBurst,CI delay for Solo4K.</description> + </info> + + <files type="package"> <!-- without version, without .ipk --> + <file type="package" name="enigma2-plugin-systemplugins-solo4kmisccontrol" /> + </files> +</default> diff --git a/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/plugin.py b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/plugin.py new file mode 100644 index 0000000..26c3aa0 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/Solo4kMiscControl/plugin.py @@ -0,0 +1,116 @@ +from Screens.Screen import Screen +from Components.ConfigList import ConfigListScreen +from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection +from Components.ActionMap import ActionMap +from Screens.MessageBox import MessageBox +from Components.Sources.StaticText import StaticText +from Plugins.Plugin import PluginDescriptor +from Tools.Directories import fileExists + +config.plugins.solo4kMiscControl = ConfigSubsection() +config.plugins.solo4kMiscControl.forceLnbPower = ConfigSelection(default = "off", choices = [ ("on", _("Yes")), ("off", _("No"))] ) +config.plugins.solo4kMiscControl.forceToneBurst = ConfigSelection(default = "disable", choices = [ ("enable", _("Yes")), ("disable", _("No"))] ) +config.plugins.solo4kMiscControl.dvbCiDelay = ConfigSelection(default = "256", choices = [ ("16", _("16")), ("32", _("32")), ("64", _("64")), ("128", _("128")), ("256", _("256"))] ) + +PROC_FORCE_LNBPOWER = "/proc/stb/frontend/fbc/force_lnbon" +PROC_FORCE_TONEBURST = "/proc/stb/frontend/fbc/force_toneburst" +PROC_DVB_CI_DELAY = "/proc/stb/tsmux/rmx_delay" + +def setProcValueOnOff(value, procPath): + try: + print "[Solo4kMiscControl] set %s : %s" % (procPath, value) + fd = open(procPath,'w') + fd.write(value) + fd.close() + return 0 + except Exception, e: + print "[Solo4kMiscControl] proc write Error", e + return -1 + + +from enigma import eTimer +class checkDriverSupport: + def __init__(self): + self.onLayoutFinish.append(self.procCheck) + self.dispErrorTimer = eTimer() + self.dispErrorTimer.callback.append(self.dispErrorMsg) + + def procCheck(self): + if not (fileExists(PROC_FORCE_LNBPOWER) and fileExists(PROC_FORCE_TONEBURST) and fileExists(PROC_DVB_CI_DELAY)): + self.dispErrorTimer.start(0, True) + + def dispErrorMsg(self): + self.session.openWithCallback(self.close ,MessageBox, _("Driver is not supported."), MessageBox.TYPE_ERROR) + +class Solo4kMiscControl(Screen, ConfigListScreen, checkDriverSupport): + skin = """ + <screen position="center,center" size="400,250" title="Solo4K Misc. Control" > + <ePixmap pixmap="skin_default/buttons/red.png" position="30,10" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="230,10" size="140,40" alphatest="on" /> + <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" /> + <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" /> + <widget name="config" zPosition="2" position="5,70" size="380,180" scrollbarMode="showOnDemand" 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(_("Ok")) + self.createSetup() + + checkDriverSupport.__init__(self) + + def createSetup(self): + self.list = [] + self.lnbPowerEntry = getConfigListEntry(_("Force LNB Power"), config.plugins.solo4kMiscControl.forceLnbPower) + self.toneBurstEntry = getConfigListEntry(_("Force ToneBurst"), config.plugins.solo4kMiscControl.forceToneBurst) + self.ciDelayEntry = getConfigListEntry(_("DVB CI Delay"), config.plugins.solo4kMiscControl.dvbCiDelay) + self.list.append( self.lnbPowerEntry ) + self.list.append( self.toneBurstEntry ) + self.list.append( self.ciDelayEntry ) + self["config"].list = self.list + self["config"].l.setList(self.list) + + def keySave(self): + res = setProcValueOnOff(config.plugins.solo4kMiscControl.forceLnbPower.value, PROC_FORCE_LNBPOWER) + if res == 0: + res = setProcValueOnOff(config.plugins.solo4kMiscControl.forceToneBurst.value, PROC_FORCE_TONEBURST) + if res == 0: + res = setProcValueOnOff(config.plugins.solo4kMiscControl.dvbCiDelay.value, PROC_DVB_CI_DELAY) + + if res == -1: + self.resetConfig() + self.session.openWithCallback(self.close, MessageBox, _("SET FAILED!\n"), MessageBox.TYPE_ERROR) + else: + self.saveAll() + self.close() + + def resetConfig(self): + for x in self["config"].list: + x[1].cancel() + +def main(session, **kwargs): + session.open(Solo4kMiscControl) + +def OnSessionStart(session, **kwargs): + setProcValueOnOff(config.plugins.solo4kMiscControl.forceLnbPower.value, PROC_FORCE_LNBPOWER) + setProcValueOnOff(config.plugins.solo4kMiscControl.forceToneBurst.value, PROC_FORCE_TONEBURST) + setProcValueOnOff(config.plugins.solo4kMiscControl.dvbCiDelay.value, PROC_DVB_CI_DELAY) + +def Plugins(**kwargs): + pList = [] + pList.append( PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, fnc=OnSessionStart) ) + pList.append( PluginDescriptor(name=_("Solo4K Misc. Control"), description="set Solo4K LNB Power and etc..", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = False, fnc=main) ) + return pList + diff --git a/main/enigma.cpp b/main/enigma.cpp index 49c5017..6ea4a64 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -122,6 +122,48 @@ public: int exit_code; +void quitMainloop(int exitCode) +{ + FILE *f = fopen("/proc/stb/fp/was_timer_wakeup", "w"); + if (f) + { + fprintf(f, "%d", 0); + fclose(f); + } + else + { + int fd = open("/dev/dbox/fp0", O_WRONLY); + if (fd >= 0) + { + if (ioctl(fd, 10 /*FP_CLEAR_WAKEUP_TIMER*/) < 0) + eDebug("FP_CLEAR_WAKEUP_TIMER failed (%m)"); + close(fd); + } + else + eDebug("open /dev/dbox/fp0 for wakeup timer clear failed!(%m)"); + } + exit_code = exitCode; + eApp->quit(0); +} + +static void sigterm_handler(int num) +{ + quitMainloop(128 + num); +} + +void setSigTermHandler() +{ + struct sigaction act; + + act.sa_handler = sigterm_handler; + act.sa_flags = SA_RESTART; + + if (sigemptyset(&act.sa_mask) == -1) + perror("sigemptyset"); + if (sigaction(SIGTERM, &act, 0) == -1) + perror("SIGTERM"); +} + int main(int argc, char **argv) { #ifdef MEMLEAK_CHECK @@ -232,6 +274,8 @@ int main(int argc, char **argv) bsodCatchSignals(); + setSigTermHandler(); + setIoPrio(IOPRIO_CLASS_BE, 3); // python.execute("mytest", "__main__"); @@ -269,47 +313,9 @@ eApplication *getApplication() return eApp; } -void quitMainloop(int exitCode) -{ - FILE *f = fopen("/proc/stb/fp/was_timer_wakeup", "w"); - if (f) - { - fprintf(f, "%d", 0); - fclose(f); - } - else - { - int fd = open("/dev/dbox/fp0", O_WRONLY); - if (fd >= 0) - { - if (ioctl(fd, 10 /*FP_CLEAR_WAKEUP_TIMER*/) < 0) - eDebug("FP_CLEAR_WAKEUP_TIMER failed (%m)"); - close(fd); - } - else - eDebug("open /dev/dbox/fp0 for wakeup timer clear failed!(%m)"); - } - exit_code = exitCode; - eApp->quit(0); -} - -static void sigterm_handler(int num) -{ - quitMainloop(128 + num); -} - void runMainloop() { - struct sigaction act; - - act.sa_handler = sigterm_handler; - act.sa_flags = SA_RESTART; - - if (sigemptyset(&act.sa_mask) == -1) - perror("sigemptyset"); - if (sigaction(SIGTERM, &act, 0) == -1) - perror("SIGTERM"); - + setSigTermHandler(); eApp->runLoop(); } |