Support duo4k.
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / Videomode / VideoHardware.py
index 802c0b6..8425f42 100644 (file)
@@ -1,6 +1,7 @@
-from Components.config import config, ConfigSubDict, ConfigSelection
+from Components.config import config, ConfigSubDict, ConfigSelection, ConfigNothing, NoSave
 from Tools.CList import CList
 from Tools.HardwareInfo import HardwareInfo
+import os
 
 # VideoHardware is the interface to /proc/stb/video.
 class VideoHardware:
@@ -61,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"])
-       hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k"])
-       noscart_hw_types = set(["zero", "solo4k"])
-       noypbpr_hw_types = set(["solose", "zero", "solo4k"])
+       hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+       hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+       noscart_hw_types = set(["zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+       noypbpr_hw_types = set(["solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
 
        def getDeviceName(self):
                device_name = "unknown"
@@ -79,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"])
+               return hw_type in set(["bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
 
        def isVumodel4K(self, hw_type):
-               return hw_type in set(["solo4k"])
+               return hw_type in set(["solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
 
        # re-define AVSwitch.getOutputAspect
        def getOutputAspect(self):
@@ -273,6 +274,45 @@ class VideoHardware:
                        config.av.videomode[port] = ConfigSelection(choices = modelist)
                config.av.videoport = ConfigSelection(choices = portlist)
 
+               if os.path.exists("/proc/stb/video/hdmi_colorspace"):
+                       def setHdmiColorspace(config):
+                               try:
+                                       print "set HDMI Colorspace : ",config.value
+                                       f = open("/proc/stb/video/hdmi_colorspace", "w")
+                                       f.write(config.value)
+                                       f.close()
+                               except IOError:
+                                       print "set HDMI Colorspace failed!"
+                       hdmicolorspace_choices = {}
+                       hdmicolorspace_choices["Edid(Auto)"] = _("Auto")
+                       hdmicolorspace_choices["Hdmi_Rgb"] = _("RGB")
+                       hdmicolorspace_choices["444"] = _("YCbCr444")
+                       hdmicolorspace_choices["422"] = _("YCbCr422")
+                       hdmicolorspace_choices["420"] = _("YCbCr420")
+                       config.av.hdmicolorspace = ConfigSelection(choices = hdmicolorspace_choices, default = "Edid(Auto)")
+                       config.av.hdmicolorspace.addNotifier(setHdmiColorspace)
+               else:
+                       config.av.hdmicolorspace = NoSave(ConfigNothing())
+
+               if os.path.exists("/proc/stb/video/hdmi_colordepth"):
+                       def setHdmiColordepth(config):
+                               try:
+                                       print "set HDMI Colordepth : ",config.value
+                                       f = open("/proc/stb/video/hdmi_colordepth", "w")
+                                       f.write(config.value)
+                                       f.close()
+                               except IOError:
+                                       print "set HDMI Colordepth failed!"
+                       hdmicolordepth_choices = {}
+                       hdmicolordepth_choices["auto"] = _("Auto")
+                       hdmicolordepth_choices["8bit"] = _("8bit")
+                       hdmicolordepth_choices["10bit"] = _("10bit")
+                       hdmicolordepth_choices["12bit"] = _("12bit")
+                       config.av.hdmicolordepth = ConfigSelection(choices = hdmicolordepth_choices, default = "auto")
+                       config.av.hdmicolordepth.addNotifier(setHdmiColordepth)
+               else:
+                       config.av.hdmicolordepth = NoSave(ConfigNothing())
+
        def changedVideomode(self, configElement):
                if self.is_init:
                        return