Support Uno4kSE
authorhschang <chang@dev3>
Fri, 3 Nov 2017 05:13:00 +0000 (14:13 +0900)
committerhschang <chang@dev3>
Fri, 3 Nov 2017 05:13:00 +0000 (14:13 +0900)
23 files changed:
configure.ac
data/Makefile.am
data/defaults/Dream/dm500hd.info
data/defaults/Dream/dm8000.info
data/keymap.xml
data/rc/Makefile.am [new file with mode: 0644]
data/rc/rc_0.png [new file with mode: 0644]
data/rc/rc_1.png [new file with mode: 0644]
data/rc/rc_2.png [new file with mode: 0644]
data/rcpositions.xml
lib/driver/rcinput.cpp
lib/dvb/pvrparse.cpp
lib/dvb/pvrparse.h
lib/dvb/tstools.cpp
lib/python/Components/InputDevice.py
lib/python/Components/SystemInfo.py
lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/InputDeviceSetup.py
lib/python/Screens/Rc.py
lib/python/Tools/KeyBindings.py
mytest.py
skin.py

index 286e71e..eba34a6 100644 (file)
@@ -148,6 +148,7 @@ data/skin_default/menu/Makefile
 data/skin_default/icons/Makefile
 data/skin_default/buttons/Makefile
 data/skin_default/spinner/Makefile
+data/rc/Makefile
 include/Makefile
 lib/Makefile
 lib/actions/Makefile
index 0eaa082..2c65fed 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = countries fonts defaults extensions keymaps skin_default
+SUBDIRS = countries fonts defaults extensions keymaps skin_default rc
 
 dist_pkgdata_DATA = \
        defaultsatlists.xml \
index 29d14b6..3fc7906 100644 (file)
@@ -12,7 +12,6 @@
                <!-- available types: "directories" -->
        <files type="directories">
                <!--file type="skin" directory="test_skin/" flag="default" name="Default Skin" /-->
-               <file type="config" name="settings.500hd" />
                <!--file type="services" name="lamedb.192">
                        <prerequisites>
                                <bcastsystem type="DVB-S" />
index f052226..d6cc83a 100644 (file)
@@ -12,7 +12,6 @@
                <!-- available types: "directories" -->
        <files type="directories">
                <!--file type="skin" directory="test_skin/" flag="default" name="Default Skin" /-->
-               <file type="config" name="settings.8000" />
                <!--file type="services" name="lamedb.192">
                        <prerequisites>
                                <bcastsystem type="DVB-S" />
index b478f57..f91650c 100755 (executable)
                <key id="KEY_POWER" mapto="power_long" flags="l" />
                <key id="KEY_POWER" mapto="power_down" flags="m" />
                <key id="KEY_POWER" mapto="power_up" flags="b" />
+               <key id="KEY_EDIT" mapto="timer_down" flags="m" />
+               <key id="KEY_EDIT" mapto="timer_up" flags="b" />
                <device name="dreambox front panel">
                        <key id="KEY_POWER" mapto="deepstandby" flags="l" />
                </device>
diff --git a/data/rc/Makefile.am b/data/rc/Makefile.am
new file mode 100644 (file)
index 0000000..7f0b1bc
--- /dev/null
@@ -0,0 +1,4 @@
+installdir = $(pkgdatadir)/rc
+
+dist_install_DATA = \
+       rc_0.png rc_1.png rc_2.png
diff --git a/data/rc/rc_0.png b/data/rc/rc_0.png
new file mode 100644 (file)
index 0000000..59fdae4
Binary files /dev/null and b/data/rc/rc_0.png differ
diff --git a/data/rc/rc_1.png b/data/rc/rc_1.png
new file mode 100644 (file)
index 0000000..59fdae4
Binary files /dev/null and b/data/rc/rc_1.png differ
diff --git a/data/rc/rc_2.png b/data/rc/rc_2.png
new file mode 100644 (file)
index 0000000..bafdc52
Binary files /dev/null and b/data/rc/rc_2.png differ
index f5daeac..ec603d5 100755 (executable)
@@ -5,6 +5,7 @@
                <button name="DREAMSELECT" pos="54,53" />
                <button name="TVSELECT" pos="98,53" />
                <button name="SUBTITLE" pos="60,70" />
+               <button name="EDIT" pos="75,340" />
                <button name="1" pos="43,98" />
                <button name="2" pos="74,98" />
                <button name="3" pos="106,98" />
@@ -52,6 +53,7 @@
                <button name="DREAMSELECT" pos="51,55" />
                <button name="TVSELECT" pos="97,55" />
                <button name="SUBTITLE" pos="64,73" />
+               <button name="EDIT" pos="75,340" />
                <button name="1" pos="40,100" />
                <button name="2" pos="76,100" />
                <button name="3" pos="102,100" />
                <button name="HELP" pos="108,370" />
                <button name="PLAY" pos="64,394" />
        </rc>
+       <rc id="2">
+               <button name="POWER" pos="107,25" />
+               <button name="TEXT" pos="31,45" />
+               <button name="SUBTITLE" pos="57,45" />
+               <button name="HELP" pos="109,45" />
+               <button name="1" pos="36,65" />
+               <button name="2" pos="70,65" />
+               <button name="3" pos="106,65" />
+               <button name="4" pos="36,86" />
+               <button name="5" pos="70,86" />
+               <button name="6" pos="106,86" />
+               <button name="7" pos="36,107" />
+               <button name="8" pos="70,107" />
+               <button name="9" pos="106,107" />
+               <button name="ARROWLEFT" pos="35,128" />
+               <button name="0" pos="70,128" />
+               <button name="ARROWRIGHT" pos="105,128" />
+               <button name="RED" pos="31,148" />
+               <button name="GREEN" pos="57,148" />
+               <button name="YELLOW" pos="83,148" />
+               <button name="BLUE" pos="109,148" />
+               <button name="VIDEO" pos="33,170" />
+               <button name="MENU" pos="107,170" />
+               <button name="OK" pos="70,201" />
+               <button name="UP" pos="70,177" />
+               <button name="DOWN" pos="70,227" />
+               <button name="LEFT" pos="46,201" />
+               <button name="RIGHT" pos="94,201" />
+               <button name="INFO" pos="33,232" />
+               <button name="EXIT" pos="107,232" />
+               <button name="VOL+" pos="36,260" />
+               <button name="VOL-" pos="36,291" />
+               <button name="AUDIO" pos="70,255" />
+               <button name="MUTE" pos="70,275" />
+               <button name="TIMER" pos="70,295" />
+               <button name="CH+" pos="104,260" />
+               <button name="CH-" pos="104,291" />
+               <button name="REWIND" pos="31,314" />
+               <button name="PLAY" pos="57,314" />
+               <button name="PAUSE" pos="83,314" />
+               <button name="FASTFORWARD" pos="109,314" />
+               <button name="TV" pos="31,333" />
+               <button name="RECORD" pos="57,333" />
+               <button name="STOP" pos="83,333" />
+               <button name="RADIO" pos="109,333" />
+       </rc>
 </rcs>
index 3242d41..5a458eb 100644 (file)
@@ -57,6 +57,7 @@ int getType(int code)
        case 168: // RW
        case 167: // record
        case 174: // exit
+       case 176: // timer edit
        case 207: // play
        case 352: // ok
        case 358: // epg
index 5b7e790..a52b99f 100755 (executable)
@@ -13,10 +13,26 @@ eMPEGStreamInformation::eMPEGStreamInformation()
 
 eMPEGStreamInformation::~eMPEGStreamInformation()
 {
+       readClose();
+       writeClose();
+}
+
+void eMPEGStreamInformation::readClose()
+{
        if (m_structure_read)
+       {
                fclose(m_structure_read);
+               m_structure_read = 0;
+       }
+}
+
+void eMPEGStreamInformation::writeClose()
+{
        if (m_structure_write)
+       {
                fclose(m_structure_write);
+               m_structure_write = 0;
+       }
 }
 
 int eMPEGStreamInformation::startSave(const char *filename)
@@ -63,8 +79,7 @@ int eMPEGStreamInformation::stopSave(void)
 int eMPEGStreamInformation::load(const char *filename)
 {
        m_filename = filename;
-       if (m_structure_read)
-               fclose(m_structure_read);
+       readClose();
        m_structure_read = fopen((std::string(m_filename) + ".sc").c_str(), "rb");
        m_access_points.clear();
        m_pts_to_offset.clear();
index a15bbaf..5f99700 100755 (executable)
@@ -14,6 +14,9 @@ class eMPEGStreamInformation
 public:
        eMPEGStreamInformation();
        ~eMPEGStreamInformation();
+
+       void writeClose();
+       void readClose();
                /* we order by off_t here, since the timestamp may */
                /* wrap around. */
                /* we only record sequence start's pts values here. */
index aefc3b5..8f3d38d 100755 (executable)
@@ -72,6 +72,8 @@ void eDVBTSTools::closeFile()
 {
        if (m_source)
                closeSource();
+
+       m_streaminfo.readClose();
 }
 
 void eDVBTSTools::setSyncPID(int pid)
index 965a27f..6fe81ef 100755 (executable)
@@ -49,9 +49,9 @@ class inputDevices:
                        if self.name:
                                if self.name == 'dreambox front panel':
                                        continue
-                               if self.name == "dreambox advanced remote control (native)" and config.misc.rcused.value != 0:
+                               if self.name == "dreambox advanced remote control (native)" and config.misc.rcused.value == 1:
                                        continue
-                               if self.name == "dreambox remote control (native)" and config.misc.rcused.value == 0:
+                               if self.name == "dreambox remote control (native)" and config.misc.rcused.value != 1:
                                        continue
                                self.Devices[evdev] = {'name': self.name, 'type': self.getInputDeviceType(self.name),'enabled': False, 'configuredName': None }
        
@@ -77,7 +77,7 @@ class inputDevices:
                return sorted(self.Devices.iterkeys())
 
        def getDefaultRCdeviceName(self):
-               if config.misc.rcused.value == 0:
+               if config.misc.rcused.value != 1:
                        for device in self.Devices.iterkeys():
                                if self.Devices[device]["name"] == "dreambox advanced remote control (native)":
                                        return device
index a1f0d6f..8ec5a65 100644 (file)
@@ -29,7 +29,7 @@ SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
 SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
 SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
 SystemInfo["DeepstandbySupport"] = HardwareInfo().get_device_name() != "dm800"
-SystemInfo["HdmiInSupport"] = HardwareInfo().get_vu_device_name() == "ultimo4k"
+SystemInfo["HdmiInSupport"] = HardwareInfo().get_vu_device_name() in ("ultimo4k", "uno4kse")
 SystemInfo["WOWLSupport"] = HardwareInfo().get_vu_device_name() == "ultimo4k"
 SystemInfo["ScrambledPlayback"] = HardwareInfo().get_vu_device_name() in ("solo4k", "ultimo4k")
 SystemInfo["FastChannelChange"] =  fileExists("/proc/stb/frontend/fbc/fcc")
index 6b5d4d7..1a15563 100644 (file)
@@ -62,10 +62,10 @@ class VideoHardware:
        }
 
        widescreen_modes = set(["720p", "1080i", "1080p", "2160p"])
-       hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k"])
-       hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k"])
-       noscart_hw_types = set(["zero", "solo4k", "ultimo4k", "uno4k"])
-       noypbpr_hw_types = set(["solose", "zero", "solo4k", "ultimo4k", "uno4k"])
+       hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k"])
+       hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k"])
+       noscart_hw_types = set(["zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k"])
+       noypbpr_hw_types = set(["solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k"])
 
        def getDeviceName(self):
                device_name = "unknown"
@@ -80,10 +80,10 @@ class VideoHardware:
                return device_name
 
        def isVumodel(self, hw_type):
-               return hw_type in set(["bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k"])
+               return hw_type in set(["bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k"])
 
        def isVumodel4K(self, hw_type):
-               return hw_type in set(["solo4k", "ultimo4k", "uno4k"])
+               return hw_type in set(["solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k"])
 
        # re-define AVSwitch.getOutputAspect
        def getOutputAspect(self):
index ea75301..cce091e 100755 (executable)
@@ -1906,8 +1906,8 @@ class InfoBarAdditionalInfo:
 
                self["RecordingPossible"] = Boolean(fixed=harddiskmanager.HDDCount() > 0 and config.misc.rcused.value == 1)
                self["TimeshiftPossible"] = self["RecordingPossible"]
-               self["ShowTimeshiftOnYellow"] = Boolean(fixed=(not config.misc.rcused.value == 0))
-               self["ShowAudioOnYellow"] = Boolean(fixed=config.misc.rcused.value == 0)
+               self["ShowTimeshiftOnYellow"] = Boolean(fixed=(config.misc.rcused.value == 1))
+               self["ShowAudioOnYellow"] = Boolean(fixed=config.misc.rcused.value != 1)
                self["ShowRecordOnRed"] = Boolean(fixed=config.misc.rcused.value == 1)
                self["ExtensionsAvailable"] = Boolean(fixed=1)
 
index c465f28..aec66c4 100755 (executable)
@@ -87,7 +87,7 @@ class InputDeviceSelection(Screen,HelpableScreen):
                enabled = iInputDevices.getDeviceAttribute(device, 'enabled')
 
                if type == 'remote':
-                       if config.misc.rcused.value == 0:
+                       if config.misc.rcused.value != 1:
                                if enabled:
                                        devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew-configured.png"))
                                else:
index 27ba1ab..2ddfeb8 100644 (file)
@@ -2,6 +2,8 @@ from Components.Pixmap import MovingPixmap, MultiPixmap
 from Tools.Directories import resolveFilename, SCOPE_SKIN
 from xml.etree.ElementTree import ElementTree
 from Components.config import config, ConfigInteger
+from Tools.HardwareInfo import HardwareInfo
+import skin
 
 config.misc.rcused = ConfigInteger(default = 1)
 
@@ -12,20 +14,34 @@ class Rc:
                self["arrowdown2"] = MovingPixmap()
                self["arrowup"] = MovingPixmap()
                self["arrowup2"] = MovingPixmap()
-               
-               config.misc.rcused = ConfigInteger(default = 1)
-               
-               self.rcheight = 500
-               self.rcheighthalf = 250
+
+               (rcArrowDownW, rcArrowDownH, rcArrowUpW, rcArrowUpH, rcheight, rcheighthalf) = skin.parameters.get("RcArrow", (18, 70, 18, 0, 500, 250))
+
+               self.rcheight = rcheight
+               self.rcheighthalf = rcheighthalf
                
                self.selectpics = []
-               self.selectpics.append((self.rcheighthalf, ["arrowdown", "arrowdown2"], (-18,-70)))
-               self.selectpics.append((self.rcheight, ["arrowup", "arrowup2"], (-18,0)))
+               self.selectpics.append((self.rcheighthalf, ["arrowdown", "arrowdown2"], (-rcArrowDownW, -rcArrowDownH)))
+               self.selectpics.append((self.rcheight, ["arrowup", "arrowup2"], (-rcArrowUpW, rcArrowUpH)))
+
+               self.initRcused()
                
                self.readPositions()
                self.clearSelectedKeys()
                self.onShown.append(self.initRc)
 
+       def initRcused(self):
+               if config.misc.firstrun.value:
+                       boxType = HardwareInfo().get_vu_device_name()
+
+                       if boxType == 'solo':
+                               config.misc.rcused.value = 0
+                       elif boxType in ('duo', 'uno', 'ultimo', 'solo2', 'duo2', 'solose', 'zero', 'solo4k', 'uno4k', 'ultimo4k'):
+                               config.misc.rcused.value = 1
+                       else:
+                               config.misc.rcused.value = 2
+                       config.misc.rcused.save()
+
        def initRc(self):
                self["rc"].setPixmapNum(config.misc.rcused.value)               
                                
index cfd177e..331fd15 100755 (executable)
@@ -47,7 +47,8 @@ keyDescriptions = [{
                KEYIDS["KEY_EXIT"]: ("EXIT",),
                KEYIDS["KEY_STOP"]: ("STOP",),
                KEYIDS["KEY_RECORD"]: ("RECORD",),
-               KEYIDS["KEY_SUBTITLE"]: ("SUBTITLE",)
+               KEYIDS["KEY_SUBTITLE"]: ("SUBTITLE",),
+               KEYIDS["KEY_EDIT"]: ("KEY_EDIT",)
        },
        {
                KEYIDS["BTN_0"]: ("UP", "fp"),
@@ -90,7 +91,56 @@ keyDescriptions = [{
                KEYIDS["KEY_EXIT"]: ("EXIT",),
                KEYIDS["KEY_STOP"]: ("TV", "SHIFT"),
                KEYIDS["KEY_RECORD"]: ("RECORD",),
-               KEYIDS["KEY_SUBTITLE"]: ("SUBTITLE",)
+               KEYIDS["KEY_SUBTITLE"]: ("SUBTITLE",),
+               KEYIDS["KEY_EDIT"]: ("EDIT",)
+       },
+       {
+               KEYIDS["KEY_POWER"]: ("POWER",),
+               KEYIDS["KEY_TEXT"]: ("TEXT",),
+               KEYIDS["KEY_SUBTITLE"]: ("SUBTITLE",),
+               KEYIDS["KEY_HELP"]: ("HELP",),
+               KEYIDS["KEY_0"]: ("0",),
+               KEYIDS["KEY_1"]: ("1",),
+               KEYIDS["KEY_2"]: ("2",),
+               KEYIDS["KEY_3"]: ("3",),
+               KEYIDS["KEY_4"]: ("4",),
+               KEYIDS["KEY_5"]: ("5",),
+               KEYIDS["KEY_6"]: ("6",),
+               KEYIDS["KEY_7"]: ("7",),
+               KEYIDS["KEY_8"]: ("8",),
+               KEYIDS["KEY_9"]: ("9",),
+               KEYIDS["KEY_PREVIOUS"]: ("ARROWLEFT",),
+               KEYIDS["KEY_NEXT"]: ("ARROWRIGHT",),
+               KEYIDS["KEY_RED"]: ("RED",),
+               KEYIDS["KEY_GREEN"]: ("GREEN",),
+               KEYIDS["KEY_YELLOW"]: ("YELLOW",),
+               KEYIDS["KEY_BLUE"]: ("BLUE",),
+               KEYIDS["KEY_VIDEO"]: ("VIDEO",),
+               KEYIDS["KEY_MENU"]: ("MENU",),
+               KEYIDS["KEY_OK"]: ("OK", ""),
+               KEYIDS["KEY_UP"]: ("UP",),
+               KEYIDS["KEY_DOWN"]: ("DOWN",),
+               KEYIDS["KEY_LEFT"]: ("LEFT",),
+               KEYIDS["KEY_RIGHT"]: ("RIGHT",),
+               KEYIDS["KEY_INFO"]: ("INFO",),
+               KEYIDS["KEY_EXIT"]: ("EXIT",),
+               KEYIDS["KEY_VOLUMEUP"]: ("VOL+",),
+               KEYIDS["KEY_VOLUMEDOWN"]: ("VOL-",),
+               KEYIDS["KEY_AUDIO"]: ("AUDIO",),
+               KEYIDS["KEY_MUTE"]: ("MUTE",),
+               KEYIDS["KEY_EDIT"]: ("TIMER",),
+               KEYIDS["KEY_TV"]: ("TV",),
+               KEYIDS["KEY_RADIO"]: ("RADIO",),
+               KEYIDS["KEY_CHANNELUP"]: ("CH+",),
+               KEYIDS["KEY_CHANNELDOWN"]: ("CH-",),
+               KEYIDS["KEY_PREVIOUSSONG"]: ("REWIND",),
+               KEYIDS["KEY_PLAY"]: ("PLAY",),
+               KEYIDS["KEY_PLAYPAUSE"]: ("PAUSE",),
+               KEYIDS["KEY_NEXTSONG"]: ("FASTFORWARD",),
+               KEYIDS["KEY_TV"]: ("TV",),
+               KEYIDS["KEY_RECORD"]: ("RECORD",),
+               KEYIDS["KEY_STOP"]: ("STOP",),
+               KEYIDS["KEY_RADIO"]: ("RADIO",),
        }
 ]
 def getRCUName():
index 99695e0..0ec61dd 100755 (executable)
--- a/mytest.py
+++ b/mytest.py
@@ -405,6 +405,34 @@ class PowerKey:
                if not Screens.Standby.inStandby and self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND and self.session.in_exec:
                        self.session.open(Screens.Standby.Standby)
 
+class TimerKey:
+       def __init__(self, session):
+               self.session = session
+               globalActionMap.actions["timer_down"]=self.timerDown
+               globalActionMap.actions["timer_up"]=self.timerUp
+               self.timerblocked = 1
+
+       def MenuClosed(self, *val):
+               self.session.infobar = None
+
+       def doAction(self):
+               self.timerblocked = 1
+
+               if self.session.current_dialog and not self.session.current_dialog.ALLOW_SUSPEND:
+                       return
+
+               self.session.infobar = self
+               from Screens.TimerEdit import TimerEditList
+               menu_screen = self.session.openWithCallback(self.MenuClosed, TimerEditList)
+               return
+
+       def timerDown(self):
+               self.timerblocked = 0
+
+       def timerUp(self):
+               if self.timerblocked == 0:
+                       self.doAction()
+
 profile("Scart")
 from Screens.Scart import Scart
 
@@ -489,6 +517,9 @@ def runScreenTest():
        profile("Init:PowerKey")
        power = PowerKey(session)
 
+       profile("Init:TimerKey")
+       timer = TimerKey(session)
+
        # we need session.scart to access it from within menu.xml
        session.scart = AutoScartControl(session)
 
diff --git a/skin.py b/skin.py
index f763dd0..a4c9021 100755 (executable)
--- a/skin.py
+++ b/skin.py
@@ -174,6 +174,11 @@ def collectAttributes(skinAttributes, node, context, skin_path_prefix=None, igno
        if size is not None:
                skinAttributes.append(('size', size))
 
+def morphRcImagePath(value):
+       if value.startswith('/usr/share/enigma2') and path.basename(value) in ('rc.png', 'rcold.png'):
+               value = resolveFilename(SCOPE_SKIN, 'rc/' + 'rc_%d.png' % config.misc.rcused.value)
+       return value
+
 def loadPixmap(path, desktop):
        cached = False
        option = path.find("#")
@@ -181,7 +186,7 @@ def loadPixmap(path, desktop):
                options = path[option+1:].split(',')
                path = path[:option]
                cached = "cached" in options
-       ptr = LoadPixmap(path, desktop, cached)
+       ptr = LoadPixmap(morphRcImagePath(path), desktop, cached)
        if ptr is None:
                raise SkinError("pixmap file %s not found!" % (path))
        return ptr