def __init__(self): global hw_info if hw_info: return hw_info = self print("[HardwareInfo] Scanning hardware info") # Version try: self.device_version = open("/proc/stb/info/version").read().strip() except: pass # Revision try: self.device_revision = open( "/proc/stb/info/board_revision").read().strip() except: pass # Name ... bit odd, but history prevails try: self.device_name = open("/etc/openvision/model").read().strip() except: pass # Brandname ... bit odd, but history prevails try: self.device_brandname = open( "/etc/openvision/brand").read().strip() except: pass # Model try: self.device_model = open("/etc/openvision/model").read().strip() except: pass self.device_model = self.device_model or self.device_name self.device_hw = self.device_model self.machine_name = self.device_model if self.device_revision: self.device_string = "%s (%s-%s)" % ( self.device_hw, self.device_revision, self.device_version) elif self.device_version: self.device_string = "%s (%s)" % (self.device_hw, self.device_version) else: self.device_string = self.device_hw # only some early DMM boxes do not have HDMI hardware self.device_hdmi = getHaveHDMI() == "True" print("[HardwareInfo] Detected: " + self.get_device_string())
class AVSwitch: has_rca = getHaveRCA() in ('True', ) has_dvi = getHaveDVI() in ('True', ) has_jack = getHaveAVJACK() in ('True', ) has_scart = getHaveSCART() in ('True', ) print "SystemInfo", "MachineBuild", getMachineBuild() print "SystemInfo", "BoxType", getBoxType() print "SystemInfo", "BrandOEM", getBrandOEM() print "SystemInfo", "DisplayType", getDisplayType() print "SystemInfo", "HaveRCA", getHaveRCA() print "SystemInfo", "getHaveDVI", getHaveDVI() print "SystemInfo", "HaveYUV", getHaveYUV() print "SystemInfo", "HaveSCART", getHaveSCART() print "SystemInfo", "HaveAVJACK", getHaveAVJACK() print "SystemInfo", "HaveSCARTYUV", getHaveSCARTYUV() print "SystemInfo", "HaveHDMI", getHaveHDMI() print "SystemInfo", "MachineMtdRoot", getMachineMtdRoot() print "VideoWizard", "has_dvi", has_dvi print "VideoWizard", "has_rca", has_rca print "VideoWizard", "has_jack", has_jack print "VideoWizard", "has_scart", has_scart print "AVSwitch", "Scart-YPbPr", SystemInfo["Scart-YPbPr"] print "AVSwitch", "no_YPbPr", SystemInfo["no_YPbPr"] print "AVSwitch", "yellow_RCA_no_scart", SystemInfo["yellow_RCA_no_scart"] print "AVSwitch", "no_yellow_RCA__no_scart", SystemInfo[ "no_yellow_RCA__no_scart"] rates = {} # high-level, use selectable modes. modes = {} # a list of (high-level) modes for a certain port. rates["PAL"] = { "50Hz": { 50: "pal" }, "60Hz": { 60: "pal60" }, "multi": { 50: "pal", 60: "pal60" } } rates["NTSC"] = {"60Hz": {60: "ntsc"}} rates["Multi"] = {"multi": {50: "pal", 60: "ntsc"}} rates["480i"] = {"60Hz": {60: "480i"}} rates["576i"] = {"50Hz": {50: "576i"}} rates["480p"] = {"60Hz": {60: "480p"}} rates["576p"] = {"50Hz": {50: "576p"}} rates["720p"] = { "50Hz": { 50: "720p50" }, "60Hz": { 60: "720p" }, "multi": { 50: "720p50", 60: "720p" } } rates["1080i"] = { "50Hz": { 50: "1080i50" }, "60Hz": { 60: "1080i" }, "multi": { 50: "1080i50", 60: "1080i" } } rates["1080p"] = { "50Hz": { 50: "1080p50" }, "60Hz": { 60: "1080p" }, "multi": { 50: "1080p50", 60: "1080p" } } rates["2160p"] = { "50Hz": { 50: "2160p50" }, "60Hz": { 60: "2160p" }, "multi": { 50: "2160p50", 60: "2160p" } } rates["2160p30"] = {"multi": {50: "2160p25", 60: "2160p30"}} rates["PC"] = { "1024x768": { 60: "1024x768" }, # not possible on DM7025 "800x600": { 60: "800x600" }, # also not possible "720x480": { 60: "720x480" }, "720x576": { 60: "720x576" }, "1280x720": { 60: "1280x720" }, "1280x720 multi": { 50: "1280x720_50", 60: "1280x720" }, "1920x1080": { 60: "1920x1080" }, "1920x1080 multi": { 50: "1920x1080", 60: "1920x1080_50" }, "1280x1024": { 60: "1280x1024" }, "1366x768": { 60: "1366x768" }, "1366x768 multi": { 50: "1366x768", 60: "1366x768_50" }, "1280x768": { 60: "1280x768" }, "640x480": { 60: "640x480" } } modes["Scart"] = ["PAL", "NTSC", "Multi"] # modes["DVI-PC"] = ["PC"] modes["HDMI"] = SystemInfo["VideoModes"][0] widescreen_modes = SystemInfo["VideoModes"][1] modes["YPbPr"] = modes["HDMI"] if SystemInfo["Scart-YPbPr"]: modes["Scart-YPbPr"] = modes["HDMI"] # if "DVI-PC" in modes and not getModeList("DVI-PC"): # print "[VideoHardware] remove DVI-PC because of not existing modes" # del modes["DVI-PC"] if "YPbPr" in modes and SystemInfo["no_YPbPr"]: del modes["YPbPr"] if "Scart" in modes and SystemInfo["yellow_RCA_no_scart"]: modes["RCA"] = modes["Scart"] del modes["Scart"] if "Scart" in modes and SystemInfo["no_yellow_RCA__no_scart"]: del modes["Scart"] def __init__(self): self.last_modes_preferred = [] self.on_hotplug = CList() self.current_mode = None self.current_port = None self.readAvailableModes() self.createConfig() self.readPreferredModes() def readAvailableModes(self): try: f = open("/proc/stb/video/videomode_choices") modes = f.read()[:-1] f.close() except IOError: print "[VideoHardware] couldn't read available videomodes." modes = [] return modes return modes.split(' ') def readPreferredModes(self): try: f = open("/proc/stb/video/videomode_preferred") modes = f.read()[:-1] f.close() self.modes_preferred = modes.split(' ') except IOError: print "[VideoHardware] reading preferred modes failed, using all modes" self.modes_preferred = self.readAvailableModes() if self.modes_preferred != self.last_modes_preferred: self.last_modes_preferred = self.modes_preferred self.on_hotplug("HDMI") # must be HDMI # check if a high-level mode with a given rate is available. def isModeAvailable(self, port, mode, rate): rate = self.rates[mode][rate] for mode in rate.values(): if mode not in self.readAvailableModes(): return False return True def isWidescreenMode(self, port, mode): return mode in self.widescreen_modes def setMode(self, port, mode, rate, force=None): print "[VideoHardware] setMode - port: %s, mode: %s, rate: %s" % ( port, mode, rate) # config.av.videoport.setValue(port) # we can ignore "port" self.current_mode = mode self.current_port = port modes = self.rates[mode][rate] mode_50 = modes.get(50) mode_60 = modes.get(60) if mode_50 is None or force == 60: mode_50 = mode_60 if mode_60 is None or force == 50: mode_60 = mode_50 if os.path.exists( '/proc/stb/video/videomode_50hz') and getBoxType() not in (''): f = open("/proc/stb/video/videomode_50hz", "w") f.write(mode_50) f.close() if os.path.exists( '/proc/stb/video/videomode_60hz') and getBoxType() not in (''): f = open("/proc/stb/video/videomode_60hz", "w") f.write(mode_60) f.close() try: set_mode = modes.get(int(rate[:2])) except: # not support 50Hz, 60Hz for 1080p set_mode = mode_50 f = open("/proc/stb/video/videomode", "w") f.write(set_mode) f.close() map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} self.setColorFormat(map[config.av.colorformat.value]) def saveMode(self, port, mode, rate): config.av.videoport.setValue(port) config.av.videoport.save() if port in config.av.videomode: config.av.videomode[port].setValue(mode) config.av.videomode[port].save() if mode in config.av.videorate: config.av.videorate[mode].setValue(rate) config.av.videorate[mode].save() def isPortAvailable(self, port): # fixme return True def isPortUsed(self, port): if port == "HDMI": self.readPreferredModes() return len(self.modes_preferred) != 0 else: return True def getPortList(self): return [port for port in self.modes if self.isPortAvailable(port)] # get a list with all modes, with all rates, for a given port. def getModeList(self, port): res = [] for mode in self.modes[port]: # list all rates which are completely valid rates = [ rate for rate in self.rates[mode] if self.isModeAvailable(port, mode, rate) ] # if at least one rate is ok, add this mode if len(rates): res.append((mode, rates)) return res def createConfig(self, *args): hw_type = HardwareInfo().get_device_name() has_hdmi = HardwareInfo().has_hdmi() lst = [] config.av.videomode = ConfigSubDict() config.av.videorate = ConfigSubDict() # create list of output ports portlist = self.getPortList() for port in portlist: descr = port if 'HDMI' in port: lst.insert(0, (port, descr)) else: lst.append((port, descr)) modes = self.getModeList(port) if len(modes): config.av.videomode[port] = ConfigSelection( choices=[mode for (mode, rates) in modes]) for (mode, rates) in modes: config.av.videorate[mode] = ConfigSelection(choices=rates) config.av.videoport = ConfigSelection(choices=lst) def setInput(self, input): INPUT = {"ENCODER": 0, "SCART": 1, "AUX": 2} eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): if not self.current_port: self.current_port = config.av.videoport.value if self.current_port in ("YPbPr", "Scart-YPbPr"): eAVSwitch.getInstance().setColorFormat(3) elif self.current_port in ("RCA"): eAVSwitch.getInstance().setColorFormat(0) else: eAVSwitch.getInstance().setColorFormat(value) def setConfiguredMode(self): port = config.av.videoport.value if port not in config.av.videomode: print "[VideoHardware] current port not available, not setting videomode" return mode = config.av.videomode[port].value if mode not in config.av.videorate: print "[VideoHardware] current mode not available, not setting videomode" return rate = config.av.videorate[mode].value self.setMode(port, mode, rate) def setAspect(self, cfgelement): print "[VideoHardware] setting aspect: %s" % cfgelement.value f = open("/proc/stb/video/aspect", "w") f.write(cfgelement.value) f.close() def setWss(self, cfgelement): if not cfgelement.value: wss = "auto(4:3_off)" else: wss = "auto" print "[VideoHardware] setting wss: %s" % wss f = open("/proc/stb/denc/0/wss", "w") f.write(wss) f.close() def setPolicy43(self, cfgelement): print "[VideoHardware] setting policy: %s" % cfgelement.value f = open("/proc/stb/video/policy", "w") f.write(cfgelement.value) f.close() def setPolicy169(self, cfgelement): if os.path.exists("/proc/stb/video/policy2"): print "[VideoHardware] setting policy2: %s" % cfgelement.value f = open("/proc/stb/video/policy2", "w") f.write(cfgelement.value) f.close() def getOutputAspect(self): ret = (16, 9) port = config.av.videoport.value if port not in config.av.videomode: print "[VideoHardware] current port not available in getOutputAspect!!! force 16:9" else: mode = config.av.videomode[port].value force_widescreen = self.isWidescreenMode(port, mode) is_widescreen = force_widescreen or config.av.aspect.value in ( "16:9", "16:10") is_auto = config.av.aspect.value == "auto" if is_widescreen: if force_widescreen: pass else: aspect = { "16:9": "16:9", "16:10": "16:10" }[config.av.aspect.value] if aspect == "16:10": ret = (16, 10) elif is_auto: try: aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() if aspect_str == "1": # 4:3 ret = (4, 3) except IOError: pass else: # 4:3 ret = (4, 3) return ret def getFramebufferScale(self): aspect = self.getOutputAspect() fb_size = getDesktop(0).size() return aspect[0] * fb_size.height(), aspect[1] * fb_size.width() def getAspectRatioSetting(self): valstr = config.av.aspectratio.value if valstr == "4_3_letterbox": val = 0 elif valstr == "4_3_panscan": val = 1 elif valstr == "16_9": val = 2 elif valstr == "16_9_always": val = 3 elif valstr == "16_10_letterbox": val = 4 elif valstr == "16_10_panscan": val = 5 elif valstr == "16_9_letterbox": val = 6 return val
SystemInfo["HasFullHDSkinSupport"] = model not in ("et4000", "et5000", "sh1", "hd500c", "hd1100", "xp1000", "lc") SystemInfo["HasBypassEdidChecking"] = fileCheck("/proc/stb/hdmi/bypass_edid_checking") SystemInfo["HasColorspace"] = fileCheck("/proc/stb/video/hdmi_colorspace") SystemInfo["HasColorspaceSimple"] = SystemInfo["HasColorspace"] and model in ("vusolo4k","vuuno4k","vuuno4kse","vuultimo4k","vuduo4k","vuduo4kse") SystemInfo["HasMultichannelPCM"] = fileCheck("/proc/stb/audio/multichannel_pcm") SystemInfo["HasMMC"] = "root" in cmdline and cmdline["root"].startswith("/dev/mmcblk") SystemInfo["HasTranscoding"] = getHaveTranscoding() == "True" or getHaveMultiTranscoding() == "True" or pathExists("/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0") SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices","h265") SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = model in ("vusolo4k","gbquad4k") SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth") SystemInfo["HasFrontDisplayPicon"] = model in ("et8500", "vusolo4k", "vuuno4kse", "vuduo4k", "vuduo4kse", "vuultimo4k") SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz") SystemInfo["HasHDMIpreemphasis"] = fileCheck("/proc/stb/hdmi/preemphasis") SystemInfo["HasColorimetry"] = fileCheck("/proc/stb/video/hdmi_colorimetry") SystemInfo["HasHdrType"] = fileCheck("/proc/stb/video/hdmi_hdrtype") SystemInfo["HasHDMI-CEC"] = getHaveHDMI() == "True" and fileExists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/HdmiCEC/plugin.pyo")) and (fileExists("/dev/cec0") or fileExists("/dev/hdmi_cec") or fileExists("/dev/misc/hdmi_cec0")) SystemInfo["Has2160p"] = fileHas("/proc/stb/video/videomode_preferred","2160p50") SystemInfo["HasHDMI-CEC"] = getHaveHDMI() == "True" and fileExists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/HdmiCEC/plugin.pyo")) and (fileExists("/dev/cec0") or fileExists("/dev/hdmi_cec") or fileExists("/dev/misc/hdmi_cec0")) SystemInfo["HasHDMIHDin"] = getHaveHDMIinHD() == "True" SystemInfo["HasHDMIFHDin"] = getHaveHDMIinFHD() == "True" SystemInfo["HasHDMIin"] = SystemInfo["HasHDMIHDin"] or SystemInfo["HasHDMIFHDin"] SystemInfo["HasYPbPr"] = model in ("dm8000", "et5000", "et6000", "et6500", "et9000", "et9200", "et9500", "et10000", "formuler1", "mbtwinplus", "spycat", "vusolo", "vuduo", "vuduo2", "vuultimo") SystemInfo["HasScart"] = model in ("dm8000", "et4000", "et6500", "et8000", "et9000", "et9200", "et9500", "et10000", "formuler1", "hd1100", "hd1200", "hd1265", "hd2400", "vusolo", "vusolo2", "vuduo", "vuduo2", "vuultimo", "vuuno", "xp1000") SystemInfo["HasSVideo"] = model in ("dm8000") SystemInfo["HasComposite"] = model not in ("i55", "gbquad4k", "gbue4k", "hd1500", "osnino", "osninoplus", "purehd", "purehdse", "revo4k", "vusolo4k", "vuzero4k", "vuduo4k", "vuduo4kse", "vuuno4k", "vuuno4kse", "vuultimo4k") SystemInfo["HasAutoVolume"] = fileExists("/proc/stb/audio/avl_choices") and fileCheck("/proc/stb/audio/avl") SystemInfo["HasAutoVolumeLevel"] = fileExists("/proc/stb/audio/autovolumelevel_choices") and fileCheck("/proc/stb/audio/autovolumelevel") SystemInfo["Has3DSurround"] = fileExists("/proc/stb/audio/3d_surround_choices") and fileCheck("/proc/stb/audio/3d_surround") SystemInfo["Has3DSpeaker"] = fileExists("/proc/stb/audio/3d_surround_speaker_position_choices") and fileCheck("/proc/stb/audio/3d_surround_speaker_position") SystemInfo["Has3DSurroundSpeaker"] = fileExists("/proc/stb/audio/3dsurround_choices") and fileCheck("/proc/stb/audio/3dsurround") SystemInfo["Has3DSurroundSoftLimiter"] = fileExists("/proc/stb/audio/3dsurround_softlimiter_choices") and fileCheck("/proc/stb/audio/3dsurround_softlimiter")
"/proc/stb/frontend/fbc/force_lnbon") SystemInfo["ForceToneBurstChanged"] = fileCheck( "/proc/stb/frontend/fbc/force_toneburst") SystemInfo["USETunersetup"] = SystemInfo["ForceLNBPowerChanged"] or SystemInfo[ "ForceToneBurstChanged"] SystemInfo["HDMIin"] = getMachineBuild() in ( "inihdp", "hd2400", "et10000", "dm7080", "dm820", "dm900", "dm920", "vuultimo4k", "et13000", "sf5008", "vuuno4kse", "vuduo4k") or getBoxType() in ("spycat4k", "spycat4kcombo", "gbquad4k") SystemInfo["HaveRCA"] = getHaveRCA() == "True" SystemInfo["HaveDVI"] = getHaveDVI() == "True" SystemInfo["HaveAVJACK"] = getHaveAVJACK() == "True" SystemInfo["HAVESCART"] = getHaveSCART() == "True" SystemInfo["HAVESCARTYUV"] = getHaveSCARTYUV() == "True" SystemInfo["HAVEYUV"] = getHaveYUV() == "True" SystemInfo["HAVEHDMI"] = getHaveHDMI() == "True" SystemInfo["MBbootdevice"] = getMBbootdevice() SystemInfo["canMultiBoot"] = getMultibootslots() SystemInfo["canMode12"] = getMachineBuild() in ( 'hd51', 'vs1500', 'h7') and ('brcm_cma=440M@328M brcm_cma=192M@768M', 'brcm_cma=520M@248M brcm_cma=200M@768M') SystemInfo["HAScmdline"] = fileCheck("/boot/cmdline.txt") SystemInfo["HasHiSi"] = pathExists("/proc/hisi") SystemInfo["HasMMC"] = fileHas( "/proc/cmdline", "root=/dev/mmcblk") or "mmcblk" in getMachineMtdRoot() SystemInfo["HasSDmmc"] = SystemInfo["canMultiBoot"] and "sd" in SystemInfo[ "canMultiBoot"][2] and "mmcblk" in getMachineMtdRoot() SystemInfo["HasSDswap"] = getMachineBuild() in ( "h9", "i55plus") and pathExists("/dev/mmcblk0p1") SystemInfo["CanProc"] = SystemInfo["HasMMC"] and getBrandOEM() != "vuplus" SystemInfo["canRecovery"] = getMachineBuild() in (
SystemInfo["LCDsymbol_circle"] = fileCheck("/proc/stb/lcd/symbol_circle") SystemInfo["ForceLNBPowerChanged"] = fileCheck( "/proc/stb/frontend/fbc/force_lnbon") SystemInfo["ForceToneBurstChanged"] = fileCheck( "/proc/stb/frontend/fbc/force_toneburst") SystemInfo["USETunersetup"] = SystemInfo["ForceLNBPowerChanged"] or SystemInfo[ "ForceToneBurstChanged"] SystemInfo["HDMIin"] = getHaveHDMIinHD() or getHaveHDMIinFHD() SystemInfo["HDMIinFHD"] = getHaveHDMIinFHD() SystemInfo["HaveRCA"] = getHaveRCA() SystemInfo["HaveDVI"] = getHaveDVI() SystemInfo["HaveAVJACK"] = getHaveAVJACK() SystemInfo["HaveSCART"] = getHaveSCART() SystemInfo["HaveSCARTYUV"] = getHaveSCARTYUV() SystemInfo["HaveYUV"] = getHaveYUV() SystemInfo["HaveHDMI"] = getHaveHDMI() SystemInfo["HaveMiniTV"] = getHaveMiniTV() SystemInfo["HaveWOL"] = getHaveWOL() SystemInfo["HaveWWOL"] = getHaveWWOL() SystemInfo["HaveTranscoding2"] = getHaveTranscoding2() SystemInfo["HaveCI"] = getHaveCI() SystemInfo["HaveMultiBoot"] = (fileCheck("/boot/STARTUP") or fileCheck("/boot/cmdline.txt")) SystemInfo["HaveMultiBootHD"] = fileCheck("/boot/STARTUP") and getMachineBuild( ) in ('hd51', 'vs1500', 'h7', 'ceryon7252') SystemInfo["HaveMultiBootXC"] = fileCheck("/boot/cmdline.txt") SystemInfo["HaveMultiBootGB"] = fileCheck( "/boot/STARTUP") and getMachineBuild() in ('gb7252') SystemInfo["HaveMultiBootCY"] = fileCheck( "/boot/STARTUP") and getMachineBuild() in ('8100s') SystemInfo["HaveMultiBootOS"] = fileCheck("/boot/STARTUP") and getMachineBuild(
SystemInfo["CIHelper"] = fileExists("/usr/bin/cihelper") SystemInfo["grautec"] = fileExists("/tmp/usbtft") SystemInfo["3DMode"] = fileCheck("/proc/stb/fb/3dmode") or fileCheck("/proc/stb/fb/primary/3d") SystemInfo["3DZNorm"] = fileCheck("/proc/stb/fb/znorm") or fileCheck("/proc/stb/fb/primary/zoffset") SystemInfo["CanUse3DModeChoices"] = fileExists('/proc/stb/fb/3dmode_choices') and True or False SystemInfo["HaveMultiBoot"] = (fileCheck("/boot/STARTUP") or fileCheck("/boot/cmdline.txt")) SystemInfo["HaveMultiBootHD"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('hd51','vs1500','h7') SystemInfo["HaveMultiBootCY"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('8100s') SystemInfo["HaveMultiBootOS"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('osmio4k') SystemInfo["HaveMultiBootXC"] = fileCheck("/boot/cmdline.txt") SystemInfo["HaveMultiBootGB"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('gb7252') SystemInfo["HaveMultiBootDS"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('cc1','sf8008','ustym4kpro') and fileCheck("/dev/sda") SystemInfo["need_dsw"] = getBoxType() not in ('osminiplus','osmega') SystemInfo["HaveCISSL"] = fileCheck("/etc/ssl/certs/customer.pem") and fileCheck("/etc/ssl/certs/device.pem") SystemInfo["HaveID"] = fileCheck("/etc/.id") SystemInfo["HaveTouchSensor"] = getBoxType() in ('dm520', 'dm525', 'dm900', 'dm920') SystemInfo["DefaultDisplayBrightness"] = getBoxType() in ('dm900', 'dm920') and 8 or 5 SystemInfo["RecoveryMode"] = fileCheck("/proc/stb/fp/boot_mode") SystemInfo["ForceLNBPowerChanged"] = fileCheck("/proc/stb/frontend/fbc/force_lnbon") SystemInfo["ForceToneBurstChanged"] = fileCheck("/proc/stb/frontend/fbc/force_toneburst") SystemInfo["USETunersetup"] = SystemInfo["ForceLNBPowerChanged"] or SystemInfo["ForceToneBurstChanged"] SystemInfo["XcoreVFD"] = getMachineBuild() in ('xc7346','xc7439') SystemInfo["HDMIin"] = getMachineBuild() in ('inihdp', 'hd2400', 'et10000', 'dm7080', 'dm820', 'dm900', 'dm920', 'vuultimo4k', 'et13000', 'sf5008', 'vuuno4kse') or getBoxType() in ('spycat4k','spycat4kcombo','gbquad4k') SystemInfo["HaveRCA"] = getHaveRCA() in ('True') SystemInfo["HaveDVI"] = getHaveDVI() in ('True') SystemInfo["HaveAVJACK"] = getHaveAVJACK() in ('True') SystemInfo["HAVESCART"] = getHaveSCART() in ('True') SystemInfo["HAVESCARTYUV"] = getHaveSCARTYUV() in ('True') SystemInfo["HAVEYUV"] = getHaveYUV() in ('True') SystemInfo["HAVEHDMI"] = getHaveHDMI() in ('True')
class AVSwitch: hw_type = HardwareInfo().get_device_name() has_rca = getHaveRCA() in ('True',) has_dvi = getHaveDVI() in ('True',) has_jack = getHaveAVJACK() in ('True',) has_scart = getHaveSCART() in ('True',) print "SystemInfo", "MachineBuild", getMachineBuild() print "SystemInfo", "BoxType", getBoxType() print "SystemInfo", "BrandOEM", getBrandOEM() print "SystemInfo", "DisplayType", getDisplayType() print "SystemInfo", "HaveRCA", getHaveRCA() print "SystemInfo", "getHaveDVI", getHaveDVI() print "SystemInfo", "HaveYUV", getHaveYUV() print "SystemInfo", "HaveSCART", getHaveSCART() print "SystemInfo", "HaveAVJACK", getHaveAVJACK() print "SystemInfo", "HaveSCARTYUV", getHaveSCARTYUV() print "SystemInfo", "HaveHDMI", getHaveHDMI() print "SystemInfo", "MachineMtdRoot", getMachineMtdRoot() print "VideoWizard", "has_dvi", has_dvi print "VideoWizard", "has_rca", has_rca print "VideoWizard", "has_jack", has_jack print "VideoWizard", "has_scart", has_scart print "AVSwitch", "Scart-YPbPr", SystemInfo["Scart-YPbPr"] print "AVSwitch", "no_YPbPr", SystemInfo["no_YPbPr"] print "AVSwitch", "yellow_RCA_no_scart", SystemInfo["yellow_RCA_no_scart"] print "AVSwitch", "no_yellow_RCA__no_scart", SystemInfo["no_yellow_RCA__no_scart"] rates = { } # high-level, use selectable modes. modes = { } # a list of (high-level) modes for a certain port. rates["PAL"] = { "50Hz": { 50: "pal" }, "60Hz": { 60: "pal60" }, "multi": { 50: "pal", 60: "pal60" } } rates["NTSC"] = { "60Hz": { 60: "ntsc" } } rates["Multi"] = { "multi": { 50: "pal", 60: "ntsc" } } rates["480i"] = { "60Hz": { 60: "480i" } } rates["576i"] = { "50Hz": { 50: "576i" } } rates["480p"] = { "60Hz": { 60: "480p" } } rates["576p"] = { "50Hz": { 50: "576p" } } rates["720p"] = { "50Hz": { 50: "720p50" }, "60Hz": { 60: "720p" }, "multi": { 50: "720p50", 60: "720p" } } rates["1080i"] = { "50Hz": { 50: "1080i50" }, "60Hz": { 60: "1080i" }, "multi": { 50: "1080i50", 60: "1080i" } } rates["1080p"] = { "50Hz": { 50: "1080p50" }, "60Hz": { 60: "1080p" }, "multi": { 50: "1080p50", 60: "1080p" } } rates["2160p"] = { "50Hz": { 50: "2160p50" }, "60Hz": { 60: "2160p" }, "multi": { 50: "2160p50", 60: "2160p" } } rates["2160p30"] = { "multi": { 50: "2160p25", 60: "2160p30" } } rates["PC"] = { "1024x768": { 60: "1024x768" }, # not possible on DM7025 "800x600" : { 60: "800x600" }, # also not possible "720x480" : { 60: "720x480" }, "720x576" : { 60: "720x576" }, "1280x720": { 60: "1280x720" }, "1280x720 multi": { 50: "1280x720_50", 60: "1280x720" }, "1920x1080": { 60: "1920x1080"}, "1920x1080 multi": { 50: "1920x1080", 60: "1920x1080_50" }, "1280x1024" : { 60: "1280x1024"}, "1366x768" : { 60: "1366x768"}, "1366x768 multi" : { 50: "1366x768", 60: "1366x768_50" }, "1280x768": { 60: "1280x768" }, "640x480" : { 60: "640x480" } } modes["Scart"] = ["PAL", "NTSC", "Multi"] # modes["DVI-PC"] = ["PC"] modes["HDMI"] = SystemInfo["VideoModes"][0] widescreen_modes = SystemInfo["VideoModes"][1] modes["YPbPr"] = modes["HDMI"] if getBoxType() in ('dm500hd', 'dm800', 'vuuno', 'vusolo', 'vusolo2', 'vuultimo', 'vuduo', 'vuduo2'): if SystemInfo["Scart-YPbPr"]: modes["Scart-YPbPr"] = modes["HDMI"] # if "DVI-PC" in modes and not getModeList("DVI-PC"): # print "[VideoHardware] remove DVI-PC because of not existing modes" # del modes["DVI-PC"] if "YPbPr" in modes and SystemInfo["no_YPbPr"]: del modes["YPbPr"] if "Scart" in modes and SystemInfo["yellow_RCA_no_scart"]: modes["RCA"] = modes["Scart"] del modes["Scart"] if "Scart" in modes and SystemInfo["no_yellow_RCA__no_scart"]: del modes["Scart"] def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() self.current_mode = None self.current_port = None self.readAvailableModes() self.createConfig() self.readPreferredModes() def readAvailableModes(self): try: f = open("/proc/stb/video/videomode_choices") modes = f.read()[:-1] f.close() except IOError: print "[VideoHardware] couldn't read available videomodes." modes = [ ] return modes return modes.split(' ') def readPreferredModes(self): try: f = open("/proc/stb/video/videomode_preferred") modes = f.read()[:-1] f.close() self.modes_preferred = modes.split(' ') except IOError: print "[VideoHardware] reading preferred modes failed, using all modes" self.modes_preferred = self.readAvailableModes() if self.modes_preferred != self.last_modes_preferred: self.last_modes_preferred = self.modes_preferred self.on_hotplug("HDMI") # must be HDMI # check if a high-level mode with a given rate is available. def isModeAvailable(self, port, mode, rate): rate = self.rates[mode][rate] for mode in rate.values(): if mode not in self.readAvailableModes(): return False return True def isWidescreenMode(self, port, mode): return mode in self.widescreen_modes def setMode(self, port, mode, rate, force = None): print "[VideoHardware] setMode - port: %s, mode: %s, rate: %s" % (port, mode, rate) # config.av.videoport.setValue(port) # we can ignore "port" self.current_mode = mode self.current_port = port modes = self.rates[mode][rate] mode_50 = modes.get(50) mode_60 = modes.get(60) if mode_50 is None or force == 60: mode_50 = mode_60 if mode_60 is None or force == 50: mode_60 = mode_50 if os.path.exists('/proc/stb/video/videomode_50hz') and getBoxType() not in (''): f = open("/proc/stb/video/videomode_50hz", "w") f.write(mode_50) f.close() if os.path.exists('/proc/stb/video/videomode_60hz') and getBoxType() not in (''): f = open("/proc/stb/video/videomode_60hz", "w") f.write(mode_60) f.close() try: set_mode = modes.get(int(rate[:2])) except: # not support 50Hz, 60Hz for 1080p set_mode = mode_50 f = open("/proc/stb/video/videomode", "w") f.write(set_mode) f.close() map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} self.setColorFormat(map[config.av.colorformat.value]) def saveMode(self, port, mode, rate): config.av.videoport.setValue(port) config.av.videoport.save() if port in config.av.videomode: config.av.videomode[port].setValue(mode) config.av.videomode[port].save() if mode in config.av.videorate: config.av.videorate[mode].setValue(rate) config.av.videorate[mode].save() def isPortAvailable(self, port): # fixme return True def isPortUsed(self, port): if port == "HDMI": self.readPreferredModes() return len(self.modes_preferred) != 0 else: return True def getPortList(self): return [port for port in self.modes if self.isPortAvailable(port)] # get a list with all modes, with all rates, for a given port. def getModeList(self, port): res = [ ] for mode in self.modes[port]: # list all rates which are completely valid rates = [rate for rate in self.rates[mode] if self.isModeAvailable(port, mode, rate)] # if at least one rate is ok, add this mode if len(rates): res.append( (mode, rates) ) return res def createConfig(self, *args): hw_type = HardwareInfo().get_device_name() has_hdmi = HardwareInfo().has_hdmi() lst = [] config.av.videomode = ConfigSubDict() config.av.videorate = ConfigSubDict() # create list of output ports portlist = self.getPortList() for port in portlist: descr = port if 'HDMI' in port: lst.insert(0, (port, descr)) else: lst.append((port, descr)) modes = self.getModeList(port) if len(modes): config.av.videomode[port] = ConfigSelection(choices = [mode for (mode, rates) in modes]) for (mode, rates) in modes: config.av.videorate[mode] = ConfigSelection(choices = rates) config.av.videoport = ConfigSelection(choices = lst) def setInput(self, input): INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): if not self.current_port: self.current_port = config.av.videoport.value if self.current_port in ("YPbPr", "Scart-YPbPr"): eAVSwitch.getInstance().setColorFormat(3) elif self.current_port in ("RCA"): eAVSwitch.getInstance().setColorFormat(0) else: eAVSwitch.getInstance().setColorFormat(value) def setConfiguredMode(self): port = config.av.videoport.value if port not in config.av.videomode: print "[VideoHardware] current port not available, not setting videomode" return mode = config.av.videomode[port].value if mode not in config.av.videorate: print "[VideoHardware] current mode not available, not setting videomode" return rate = config.av.videorate[mode].value self.setMode(port, mode, rate) def setAspect(self, cfgelement): print "[VideoHardware] setting aspect: %s" % cfgelement.value f = open("/proc/stb/video/aspect", "w") f.write(cfgelement.value) f.close() def setWss(self, cfgelement): if not cfgelement.value: wss = "auto(4:3_off)" else: wss = "auto" print "[VideoHardware] setting wss: %s" % wss f = open("/proc/stb/denc/0/wss", "w") f.write(wss) f.close() def setPolicy43(self, cfgelement): print "[VideoHardware] setting policy: %s" % cfgelement.value f = open("/proc/stb/video/policy", "w") f.write(cfgelement.value) f.close() def setPolicy169(self, cfgelement): if os.path.exists("/proc/stb/video/policy2"): print "[VideoHardware] setting policy2: %s" % cfgelement.value f = open("/proc/stb/video/policy2", "w") f.write(cfgelement.value) f.close() def getOutputAspect(self): ret = (16,9) port = config.av.videoport.value if port not in config.av.videomode: print "[VideoHardware] current port not available in getOutputAspect!!! force 16:9" else: mode = config.av.videomode[port].value force_widescreen = self.isWidescreenMode(port, mode) is_widescreen = force_widescreen or config.av.aspect.value in ("16:9", "16:10") is_auto = config.av.aspect.value == "auto" if is_widescreen: if force_widescreen: pass else: aspect = {"16:9": "16:9", "16:10": "16:10"}[config.av.aspect.value] if aspect == "16:10": ret = (16,10) elif is_auto: try: aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() if aspect_str == "1": # 4:3 ret = (4,3) except IOError: pass else: # 4:3 ret = (4,3) return ret def getFramebufferScale(self): aspect = self.getOutputAspect() fb_size = getDesktop(0).size() return aspect[0] * fb_size.height(), aspect[1] * fb_size.width() def getAspectRatioSetting(self): valstr = config.av.aspectratio.value if valstr == "4_3_letterbox": val = 0 elif valstr == "4_3_panscan": val = 1 elif valstr == "16_9": val = 2 elif valstr == "16_9_always": val = 3 elif valstr == "16_10_letterbox": val = 4 elif valstr == "16_10_panscan": val = 5 elif valstr == "16_9_letterbox": val = 6 return val iAVSwitch = AVSwitch() def InitAVSwitch(): config.av.yuvenabled = ConfigBoolean(default=True) colorformat_choices = {"cvbs": _("CVBS"), "rgb": _("RGB"), "svideo": _("S-Video")} # when YUV is not enabled, don't let the user select it if config.av.yuvenabled.value: colorformat_choices["yuv"] = _("YPbPr") config.av.autores = ConfigSelection(choices={"disabled": _("Disabled"), "all": _("All resolutions"), "hd": _("only HD")}, default="disabled") choicelist = [] for i in range(5, 16): choicelist.append(("%d" % i, ngettext("%d second", "%d seconds", i) % i)) config.av.autores_label_timeout = ConfigSelection(default = "5", choices = [("0", _("Not Shown"))] + choicelist) config.av.autores_delay = ConfigSelectionNumber(min = 0, max = 15000, stepwidth = 500, default = 500, wraparound = True) config.av.autores_deinterlace = ConfigYesNo(default=False) config.av.autores_sd = ConfigSelection(choices={"720p": _("720p"), "1080i": _("1080i")}, default="720p") config.av.autores_480p24 = ConfigSelection(choices={"480p24": _("480p 24Hz"), "720p24": _("720p 24Hz"), "1080p24": _("1080p 24Hz")}, default="1080p24") config.av.autores_720p24 = ConfigSelection(choices={"720p24": _("720p 24Hz"), "1080p24": _("1080p 24Hz")}, default="1080p24") config.av.autores_1080p24 = ConfigSelection(choices={"1080p24": _("1080p 24Hz"), "1080p25": _("1080p 25Hz")}, default="1080p24") config.av.autores_1080p25 = ConfigSelection(choices={"1080p25": _("1080p 25Hz"), "1080p50": _("1080p 50Hz")}, default="1080p25") config.av.autores_1080p30 = ConfigSelection(choices={"1080p30": _("1080p 30Hz"), "1080p60": _("1080p 60Hz")}, default="1080p30") config.av.autores_2160p24 = ConfigSelection(choices={"2160p24": _("2160p 24Hz"), "2160p25": _("2160p 25Hz"), "2160p30": _("2160p 30Hz")}, default="2160p24") config.av.autores_2160p25 = ConfigSelection(choices={"2160p25": _("2160p 25Hz"), "2160p50": _("2160p 50Hz")}, default="2160p25") config.av.autores_2160p30 = ConfigSelection(choices={"2160p30": _("2160p 30Hz"), "2160p60": _("2160p 60Hz")}, default="2160p30") config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="rgb") config.av.aspectratio = ConfigSelection(choices={ "4_3_letterbox": _("4:3 Letterbox"), "4_3_panscan": _("4:3 PanScan"), "16_9": _("16:9"), "16_9_always": _("16:9 always"), "16_10_letterbox": _("16:10 Letterbox"), "16_10_panscan": _("16:10 PanScan"), "16_9_letterbox": _("16:9 Letterbox")}, default = "16_9") config.av.aspect = ConfigSelection(choices={ "4:3": _("4:3"), "16:9": _("16:9"), "16:10": _("16:10"), "auto": _("Automatic")}, default = "16:9") policy2_choices = { # TRANSLATORS: (aspect ratio policy: black bars on top/bottom) in doubt, keep english term. "letterbox": _("Letterbox"), # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term "panscan": _("Pan&scan"), # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect) "scale": _("Just scale")} if os.path.exists("/proc/stb/video/policy2_choices"): f = open("/proc/stb/video/policy2_choices") if "auto" in f.readline(): # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect. policy2_choices.update({"auto": _("Auto")}) f.close() config.av.policy_169 = ConfigSelection(choices=policy2_choices, default = "letterbox") policy_choices = { # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term. "panscan": _("Pillarbox"), # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term "letterbox": _("Pan&scan"), # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right) # "nonlinear": _("Nonlinear"), # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect) "bestfit": _("Just scale")} if os.path.exists("/proc/stb/video/policy_choices"): f = open("/proc/stb/video/policy_choices") if "auto" in f.readline(): # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect. policy_choices.update({"auto": _("Auto")}) f.close() config.av.policy_43 = ConfigSelection(choices=policy_choices, default = "panscan") config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal") config.av.wss = ConfigEnableDisable(default = True) config.av.generalAC3delay = ConfigSelectionNumber(-1000, 1000, 5, default = 0) config.av.generalPCMdelay = ConfigSelectionNumber(-1000, 1000, 5, default = 0) config.av.vcrswitch = ConfigEnableDisable(default = False) config.av.aspect.setValue('16:9') config.av.aspect.addNotifier(iAVSwitch.setAspect) config.av.wss.addNotifier(iAVSwitch.setWss) config.av.policy_43.addNotifier(iAVSwitch.setPolicy43) config.av.policy_169.addNotifier(iAVSwitch.setPolicy169) def setColorFormat(configElement): if config.av.videoport and config.av.videoport.value in ("YPbPr", "Scart-YPbPr"): iAVSwitch.setColorFormat(3) elif config.av.videoport and config.av.videoport.value in ("RCA"): iAVSwitch.setColorFormat(0) else: map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} iAVSwitch.setColorFormat(map[configElement.value]) config.av.colorformat.addNotifier(setColorFormat) def setAspectRatio(configElement): map = {"4_3_letterbox": 0, "4_3_panscan": 1, "16_9": 2, "16_9_always": 3, "16_10_letterbox": 4, "16_10_panscan": 5, "16_9_letterbox" : 6} iAVSwitch.setAspectRatio(map[configElement.value]) iAVSwitch.setInput("ENCODER") # init on startup SystemInfo["ScartSwitch"] = eAVSwitch.getInstance().haveScartSwitch() if SystemInfo["Canedidchecking"]: def setEDIDBypass(configElement): try: f = open("/proc/stb/hdmi/bypass_edid_checking", "w") f.write(configElement.value) f.close() except: pass config.av.bypass_edid_checking = ConfigSelection(choices={ "00000000": _("off"), "00000001": _("on")}, default = "00000000") config.av.bypass_edid_checking.addNotifier(setEDIDBypass) else: config.av.bypass_edid_checking = ConfigNothing() if SystemInfo["havecolorspace"]: def setHDMIColorspace(configElement): try: f = open("/proc/stb/video/hdmi_colorspace", "w") f.write(configElement.value) f.close() except: pass if getBoxType() in ('vuzero4k','vusolo4k','vuuno4k','vuuno4kse','vuultimo4k'): config.av.hdmicolorspace = ConfigSelection(choices={ "Edid(Auto)": _("Auto"), "Hdmi_Rgb": _("RGB"), "444": _("YCbCr444"), "422": _("YCbCr422"), "420": _("YCbCr420")}, default = "Edid(Auto)") else: config.av.hdmicolorspace = ConfigSelection(choices={ "auto": _("auto"), "rgb": _("rgb"), "420": _("420"), "422": _("422"), "444": _("444")}, default = "auto") config.av.hdmicolorspace.addNotifier(setHDMIColorspace) else: config.av.hdmicolorspace = ConfigNothing() if SystemInfo["havecolorimetry"]: def setHDMIColorimetry(configElement): try: f = open("/proc/stb/video/hdmi_colorimetry", "w") f.write(configElement.value) f.close() except: pass config.av.hdmicolorimetry = ConfigSelection(choices={ "Auto": _("Auto"), "bt2020ncl": _("BT 2020 NCL"), "bt2020cl": _("BT 2020 CL"), "bt709": _("BT 709")}, default = "Auto") config.av.hdmicolorimetry.addNotifier(setHDMIColorimetry) else: config.av.hdmicolorimetry = ConfigNothing() if SystemInfo["haveboxmode"]: def setBoxmode(configElement): try: f = open("/proc/stb/info/boxmode", "w") f.write(configElement.value) f.close() except: pass config.av.boxmode = ConfigSelection(choices={ "12": _("PIP enabled, no HDR"), "1": _("HDR, 12bit 4:2:0/4:2:2, no PIP")}, default = "12") config.av.boxmode.addNotifier(setBoxmode) else: config.av.boxmode = ConfigNothing() if SystemInfo["havehdmicolordepth"]: def setHdmiColordepth(configElement): try: f = open("/proc/stb/video/hdmi_colordepth", "w") f.write(configElement.value) f.close() except: pass config.av.hdmicolordepth = ConfigSelection(choices={ "auto": _("Auto"), "8bit": _("8bit"), "10bit": _("10bit"), "12bit": _("12bit")}, default = "auto") config.av.hdmicolordepth.addNotifier(setHdmiColordepth) else: config.av.hdmicolordepth = ConfigNothing() if SystemInfo["Canaudiosource"]: def setAudioSource(configElement): try: f = open("/proc/stb/hdmi/audio_source", "w") f.write(configElement.value) f.close() except: pass config.av.audio_source = ConfigSelection(choices={ "pcm": _("PCM"), "spdif": _("SPDIF")}, default="pcm") config.av.audio_source.addNotifier(setAudioSource) else: config.av.audio_source = ConfigNothing() if SystemInfo["Can3DSurround"]: def set3DSurround(configElement): f = open("/proc/stb/audio/3d_surround", "w") f.write(configElement.value) f.close() choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] config.av.surround_3d = ConfigSelection(choices = choice_list, default = "none") config.av.surround_3d.addNotifier(set3DSurround) else: config.av.surround_3d = ConfigNothing() if SystemInfo["Can3DSpeaker"]: def set3DSurroundSpeaker(configElement): f = open("/proc/stb/audio/3d_surround_speaker_position", "w") f.write(configElement.value) f.close() choice_list = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extra wide"))] config.av.surround_3d_speaker = ConfigSelection(choices = choice_list, default = "center") config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker) else: config.av.surround_3d_speaker = ConfigNothing() if SystemInfo["CanAutoVolume"]: def setAutoVolume(configElement): f = open("/proc/stb/audio/avl", "w") f.write(configElement.value) f.close() choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] config.av.autovolume = ConfigSelection(choices = choice_list, default = "none") config.av.autovolume.addNotifier(setAutoVolume) else: config.av.autovolume = ConfigNothing() if SystemInfo["supportPcmMultichannel"]: def setPCMMultichannel(configElement): open("/proc/stb/audio/multichannel_pcm", "w").write(configElement.value and "enable" or "disable") config.av.pcm_multichannel = ConfigYesNo(default = False) config.av.pcm_multichannel.addNotifier(setPCMMultichannel) if SystemInfo["CanDownmixAC3"]: def setAC3Downmix(configElement): open("/proc/stb/audio/ac3", "w").write(configElement.value and "downmix" or "passthrough") if SystemInfo.get("supportPcmMultichannel", False) and not configElement.value: SystemInfo["CanPcmMultichannel"] = True else: SystemInfo["CanPcmMultichannel"] = False if SystemInfo["supportPcmMultichannel"]: config.av.pcm_multichannel.setValue(False) config.av.downmix_ac3 = ConfigYesNo(default = True) config.av.downmix_ac3.addNotifier(setAC3Downmix) if SystemInfo["CanDownmixDTS"]: def setDTSDownmix(configElement): open("/proc/stb/audio/dts", "w").write(configElement.value and "downmix" or "passthrough") config.av.downmix_dts = ConfigYesNo(default = True) config.av.downmix_dts.addNotifier(setDTSDownmix) if SystemInfo["CanDownmixAAC"]: def setAACDownmix(configElement): open("/proc/stb/audio/aac", "w").write(configElement.value and "downmix" or "passthrough") config.av.downmix_aac = ConfigYesNo(default = True) config.av.downmix_aac.addNotifier(setAACDownmix) if SystemInfo["CanAACTranscode"]: def setAACTranscode(configElement): open("/proc/stb/audio/aac_transcode", "w").write(configElement.value) config.av.transcodeaac = ConfigSelection(default = "off", choices = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]) config.av.transcodeaac.addNotifier(setAACTranscode) else: config.av.transcodeaac = ConfigNothing() if SystemInfo["HasScaler_sharpness"]: def setScaler_sharpness(config): myval = int(config.value) try: print "[VideoHardware] setting scaler_sharpness to: %0.8X" % myval f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w") f.write("%0.8X" % myval) f.close() f = open("/proc/stb/vmpeg/0/pep_apply", "w") f.write("1") f.close() except IOError: print "[VideoHardware] couldn't write pep_scaler_sharpness" if getBoxType() in ('gbquad', 'gbquadplus'): config.av.scaler_sharpness = ConfigSlider(default=5, limits=(0,26)) else: config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0,26)) config.av.scaler_sharpness.addNotifier(setScaler_sharpness) else: config.av.scaler_sharpness = NoSave(ConfigNothing()) config.av.edid_override = ConfigYesNo(default = False) iAVSwitch.setConfiguredMode() class VideomodeHotplug: def __init__(self): pass def start(self): iAVSwitch.on_hotplug.append(self.hotplug) def stop(self): iAVSwitch.on_hotplug.remove(self.hotplug) def hotplug(self, what): print "[VideoHardware] hotplug detected on port '%s'" % what port = config.av.videoport.value mode = config.av.videomode[port].value rate = config.av.videorate[mode].value if not iAVSwitch.isModeAvailable(port, mode, rate): print "[VideoHardware] mode %s/%s/%s went away!" % (port, mode, rate) modelist = iAVSwitch.getModeList(port) if not len(modelist): print "[VideoHardware] sorry, no other mode is available (unplug?). Doing nothing." return mode = modelist[0][0] rate = modelist[0][1] print "[VideoHardware] setting %s/%s/%s" % (port, mode, rate) iAVSwitch.setMode(port, mode, rate) hotplug = None def startHotplug(): global hotplug hotplug = VideomodeHotplug() hotplug.start() def stopHotplug(): global hotplug hotplug.stop() def InitiVideomodeHotplug(**kwargs): startHotplug()
SystemInfo["Blindscan_t2_available"] = False SystemInfo["HasFullHDSkinSupport"] = getFHDSkin() == "True" SystemInfo["HasBypassEdidChecking"] = fileCheck("/proc/stb/hdmi/bypass_edid_checking") SystemInfo["HasColorspace"] = fileCheck("/proc/stb/video/hdmi_colorspace") SystemInfo["HasColorspaceSimple"] = SystemInfo["HasColorspace"] SystemInfo["HasMultichannelPCM"] = fileCheck("/proc/stb/audio/multichannel_pcm") SystemInfo["HasMMC"] = "root" in cmdline and cmdline["root"].startswith("/dev/mmcblk") SystemInfo["HasTranscoding"] = getHaveTranscoding() == "True" or getHaveMultiTranscoding() == "True" or pathExists("/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0") SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices", "h265") SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = True SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth") SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz") SystemInfo["HasHDMIpreemphasis"] = fileCheck("/proc/stb/hdmi/preemphasis") SystemInfo["HasColorimetry"] = fileCheck("/proc/stb/video/hdmi_colorimetry") SystemInfo["HasHdrType"] = fileCheck("/proc/stb/video/hdmi_hdrtype") SystemInfo["HasHDMI-CEC"] = getHaveHDMI() == "True" and (fileExists("/proc/stb/cec/send") or fileExists("/proc/stb/hdmi/cec")) SystemInfo["HasYPbPr"] = getHaveYUV() == "True" SystemInfo["HasScart"] = getHaveSCART() == "True" SystemInfo["HasSVideo"] = getHaveSVIDEO() == "True" SystemInfo["HasComposite"] = getHaveRCA() == "True" SystemInfo["HasAutoVolume"] = fileExists("/proc/stb/audio/avl_choices") or fileCheck("/proc/stb/audio/avl") SystemInfo["HasAutoVolumeLevel"] = fileExists("/proc/stb/audio/autovolumelevel_choices") or fileCheck("/proc/stb/audio/autovolumelevel") SystemInfo["Has3DSurround"] = fileExists("/proc/stb/audio/3d_surround_choices") or fileCheck("/proc/stb/audio/3d_surround") SystemInfo["Has3DSpeaker"] = fileExists("/proc/stb/audio/3d_surround_speaker_position_choices") or fileCheck("/proc/stb/audio/3d_surround_speaker_position") SystemInfo["Has3DSurroundSpeaker"] = fileExists("/proc/stb/audio/3dsurround_choices") or fileCheck("/proc/stb/audio/3dsurround") SystemInfo["Has3DSurroundSoftLimiter"] = fileExists("/proc/stb/audio/3dsurround_softlimiter_choices") or fileCheck("/proc/stb/audio/3dsurround_softlimiter") SystemInfo["HasOfflineDecoding"] = True SystemInfo["MultibootStartupDevice"] = getMultibootStartupDevice() SystemInfo["canMode12"] = False SystemInfo["canMultiBoot"] = False SystemInfo["canFlashWithOfgwrite"] = True
print "getOEVersion=%s<" % boxbranding.getOEVersion() print "getDriverDate=%s<" % boxbranding.getDriverDate() print "getImageVersion=%s<" % boxbranding.getImageVersion() print "getImageBuild=%s<" % boxbranding.getImageBuild() print "getImageDevBuild=%s<" % boxbranding.getImageDevBuild() print "getImageType=%s<" % boxbranding.getImageType() print "getImageDistro=%s<" % boxbranding.getImageDistro() print "getImageFolder=%s<" % boxbranding.getImageFolder() print "getImageFileSystem=%s<" % boxbranding.getImageFileSystem() print "getImageDevBuild=%s<" % boxbranding.getImageDevBuild() print "getImageType=%s<" % boxbranding.getImageType() print "getMachineMake=%s<" % boxbranding.getMachineMake() print "getImageArch=%s<" % boxbranding.getImageArch() print "getFeedsUrl=%s<" % boxbranding.getFeedsUrl() print "getDisplayType=%s<" % boxbranding.getDisplayType() print "getHaveHDMI=%s<" % boxbranding.getHaveHDMI() print "getHaveYUV=%s<" % boxbranding.getHaveYUV() print "getHaveRCA=%s<" % boxbranding.getHaveRCA() print "getHaveAVJACK=%s<" % boxbranding.getHaveAVJACK() print "getHaveSCART=%s<" % boxbranding.getHaveSCART() print "getHaveSCARTYUV=%s<" % boxbranding.getHaveSCARTYUV() print "getHaveDVI=%s<" % boxbranding.getHaveDVI() print "getHaveMiniTV=%s<" % boxbranding.getHaveMiniTV() print "getHaveHDMIinHD=%s<" % boxbranding.getHaveHDMIinHD() print "getHaveHDMIinFHD=%s<" % boxbranding.getHaveHDMIinFHD() print "getHaveWOL=%s<" % boxbranding.getHaveWOL() print "getHaveWWOL=%s<" % boxbranding.getHaveWWOL() print "getHaveTranscoding1=%s<" % boxbranding.getHaveTranscoding1() print "getHaveTranscoding2=%s<" % boxbranding.getHaveTranscoding2() print "getHaveCI=%s<" % boxbranding.getHaveCI()
SystemInfo["HaveMultiBoot"] = (fileCheck("/boot/STARTUP") or fileCheck("/boot/cmdline.txt")) SystemInfo["HaveMultiBootHD"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('hd51','vs1500','h7','ceryon7252') SystemInfo["HaveMultiBootXC"] = fileCheck("/boot/cmdline.txt") SystemInfo["HaveMultiBootGB"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('gb7252') SystemInfo["HaveMultiBootCY"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('8100s') SystemInfo["HaveMultiBootOS"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('osmio4k') SystemInfo["HaveMultiBootDS"] = fileCheck("/boot/STARTUP") and getMachineBuild() in ('cc1','sf8008','ustym4kpro') and fileCheck("/dev/sda") SystemInfo["need_dsw"] = getBoxType() not in ('osminiplus','osmega') SystemInfo["HaveCISSL"] = fileCheck("/etc/ssl/certs/customer.pem") and fileCheck("/etc/ssl/certs/device.pem") SystemInfo["HasMultichannelPCM"] = fileCheck("/proc/stb/audio/multichannel_pcm") SystemInfo["HaveTouchSensor"] = getBoxType() in ('dm520', 'dm525', 'dm900') SystemInfo["DefaultDisplayBrightness"] = getBoxType() == 'dm900' and 8 or 5 SystemInfo["RecoveryMode"] = fileCheck("/proc/stb/fp/boot_mode") SystemInfo["LCDMiniTV"] = fileExists("/proc/stb/lcd/mode") SystemInfo["LcdLiveTV"] = fileCheck("/proc/stb/fb/sd_detach") SystemInfo["MiniTV"] = fileCheck("/proc/stb/fb/sd_detach") or fileCheck("/proc/stb/lcd/live_enable") SystemInfo["FastChannelChange"] = False SystemInfo["LCDMiniTVPiP"] = SystemInfo["LCDMiniTV"] and getBoxType() not in ('gb800ueplus','gbquad4k','gbue4k') SystemInfo["LCDsymbol_circle"] = fileCheck("/proc/stb/lcd/symbol_circle") SystemInfo["ForceLNBPowerChanged"] = fileCheck("/proc/stb/frontend/fbc/force_lnbon") SystemInfo["ForceToneBurstChanged"] = fileCheck("/proc/stb/frontend/fbc/force_toneburst") SystemInfo["USETunersetup"] = SystemInfo["ForceLNBPowerChanged"] or SystemInfo["ForceToneBurstChanged"] SystemInfo["HDMIin"] = getMachineBuild() in ('inihdp', 'hd2400', 'et10000', 'dm7080', 'dm820', 'dm900', 'gb7252', 'vuultimo4k', 'gbquad4k') SystemInfo["HaveRCA"] = getHaveRCA() in ('True') SystemInfo["HaveDVI"] = getHaveDVI() in ('True') SystemInfo["HaveAVJACK"] = getHaveAVJACK() in ('True') SystemInfo["HaveSCART"] = getHaveSCART() in ('True') SystemInfo["HaveSCARTYUV"] = getHaveSCARTYUV() in ('True') SystemInfo["HaveYUV"] = getHaveYUV() in ('True') SystemInfo["HaveHDMI"] = getHaveHDMI() in ('True')
) == "True" or getHaveMultiTranscoding() == "True" or pathExists( "/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0") SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices", "h265") SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = model in ("vusolo4k", "gbquad4k") SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth") SystemInfo["HasFrontDisplayPicon"] = model in ("et8500", "vusolo4k", "vuuno4kse", "vuduo4k", "vuduo4kse", "vuultimo4k") SystemInfo["Has24hz"] = fileCheck( "/proc/stb/video/videomode_24hz") and platform != "dmamlogic" SystemInfo["HasHDMIpreemphasis"] = fileCheck("/proc/stb/hdmi/preemphasis") SystemInfo["HasColorimetry"] = fileCheck("/proc/stb/video/hdmi_colorimetry") SystemInfo["HasHdrType"] = fileCheck("/proc/stb/video/hdmi_hdrtype") SystemInfo["HasHDMI-CEC"] = getHaveHDMI() == "True" and ( fileExists("/dev/cec0") or fileExists("/dev/hdmi_cec") or fileExists("/dev/misc/hdmi_cec0")) SystemInfo["HasHDMIHDin"] = getHaveHDMIinHD() == "True" SystemInfo["HasHDMIFHDin"] = getHaveHDMIinFHD() == "True" SystemInfo[ "HasHDMIin"] = SystemInfo["HasHDMIHDin"] or SystemInfo["HasHDMIFHDin"] SystemInfo["HasYPbPr"] = getHaveYUV() == "True" SystemInfo["HasScart"] = getHaveSCART() == "True" SystemInfo["HasSVideo"] = getHaveSVIDEO() == "True" SystemInfo["HasComposite"] = getHaveRCA() == "True" SystemInfo["HasAutoVolume"] = fileExists( "/proc/stb/audio/avl_choices") or fileCheck("/proc/stb/audio/avl") SystemInfo["HasAutoVolumeLevel"] = fileExists( "/proc/stb/audio/autovolumelevel_choices") or fileCheck( "/proc/stb/audio/autovolumelevel")
print "getOEVersion=%s<" %boxbranding.getOEVersion() print "getDriverDate=%s<" %boxbranding.getDriverDate() print "getImageVersion=%s<" %boxbranding.getImageVersion() print "getImageBuild=%s<" %boxbranding.getImageBuild() print "getImageDevBuild=%s<" %boxbranding.getImageDevBuild() print "getImageType=%s<" %boxbranding.getImageType() print "getImageDistro=%s<" %boxbranding.getImageDistro() print "getImageFolder=%s<" %boxbranding.getImageFolder() print "getImageFileSystem=%s<" %boxbranding.getImageFileSystem() print "getImageDevBuild=%s<" %boxbranding.getImageDevBuild() print "getImageType=%s<" %boxbranding.getImageType() print "getMachineMake=%s<" %boxbranding.getMachineMake() print "getImageArch=%s<" %boxbranding.getImageArch() print "getFeedsUrl=%s<" %boxbranding.getFeedsUrl() print "getDisplayType=%s<" %boxbranding.getDisplayType() print "getHaveHDMI=%s<" %boxbranding.getHaveHDMI() print "getHaveYUV=%s<" %boxbranding.getHaveYUV() print "getHaveRCA=%s<" %boxbranding.getHaveRCA() print "getHaveAVJACK=%s<" %boxbranding.getHaveAVJACK() print "getHaveSCART=%s<" %boxbranding.getHaveSCART() print "getHaveSCARTYUV=%s<" %boxbranding.getHaveSCARTYUV() print "getHaveDVI=%s<" %boxbranding.getHaveDVI() print "getHaveMiniTV=%s<" %boxbranding.getHaveMiniTV() print "getHaveHDMIinHD=%s<" %boxbranding.getHaveHDMIinHD() print "getHaveHDMIinFHD=%s<" %boxbranding.getHaveHDMIinFHD() print "getHaveWOL=%s<" %boxbranding.getHaveWOL() print "getHaveWWOL=%s<" %boxbranding.getHaveWWOL() print "getHaveTranscoding1=%s<" %boxbranding.getHaveTranscoding1() print "getHaveTranscoding2=%s<" %boxbranding.getHaveTranscoding2() print "getHaveCI=%s<" %boxbranding.getHaveCI()
class AVSwitch: config.av = ConfigSubsection() if getBrandOEM() in ('azbox',): config.av.edid_override = ConfigYesNo(default = True) else: config.av.edid_override = ConfigYesNo(default = False) print "SystemInfo", "MachineBuild", getMachineBuild() print "SystemInfo", "BoxType", getBoxType() print "SystemInfo", "BrandOEM", getBrandOEM() print "SystemInfo", "DisplayType", getDisplayType() print "SystemInfo", "HaveRCA", getHaveRCA() print "SystemInfo", "getHaveDVI", getHaveDVI() print "SystemInfo", "HaveYUV", getHaveYUV() print "SystemInfo", "HaveSCART", getHaveSCART() print "SystemInfo", "HaveAVJACK", getHaveAVJACK() print "SystemInfo", "HaveSCARTYUV", getHaveSCARTYUV() print "SystemInfo", "HaveHDMI", getHaveHDMI() print "SystemInfo", "MachineMtdRoot", getMachineMtdRoot() # print "VideoWizard", "has_dvi", has_dvi # print "VideoWizard", "has_rca", has_rca # print "VideoWizard", "has_jack", has_jack # print "VideoWizard", "has_scart", has_scart # print "AVSwitch", "Scart-YPbPr", SystemInfo["Scart-YPbPr"] # print "AVSwitch", "no_YPbPr", SystemInfo["no_YPbPr"] # print "AVSwitch", "yellow_RCA_no_scart", SystemInfo["yellow_RCA_no_scart"] # print "AVSwitch", "no_yellow_RCA__no_scart", SystemInfo["no_yellow_RCA__no_scart"] rates = { } # high-level, use selectable modes. modes = { } # a list of (high-level) modes for a certain port. rates["PAL"] = { "50Hz": { 50: "pal" }, "60Hz": { 60: "pal60" }, "multi": { 50: "pal", 60: "pal60" } } rates["NTSC"] = { "60Hz": { 60: "ntsc" } } rates["Multi"] = { "multi": { 50: "pal", 60: "ntsc" } } rates["480i"] = { "60Hz": { 60: "480i" } } rates["576i"] = { "50Hz": { 50: "576i" } } rates["480p"] = { "60Hz": { 60: "480p" } } rates["576p"] = { "50Hz": { 50: "576p" } } rates["720p"] = { "50Hz": { 50: "720p50" }, "60Hz": { 60: "720p" }, "multi": { 50: "720p50", 60: "720p" } } rates["1080i"] = { "50Hz": { 50: "1080i50" }, "60Hz": { 60: "1080i" }, "multi": { 50: "1080i50", 60: "1080i" } } rates["1080p"] = { "50Hz": { 50: "1080p50" }, "60Hz": { 60: "1080p" }, "multi": { 50: "1080p50", 60: "1080p" } } rates["2160p"] = { "50Hz": { 50: "2160p50" }, "60Hz": { 60: "2160p" }, "multi": { 50: "2160p50", 60: "2160p" } } rates["2160p30"] = { "multi": { 50: "2160p25", 60: "2160p30" } } rates["PC"] = { "1024x768": { 60: "1024x768" }, # not possible on DM7025 "800x600" : { 60: "800x600" }, # also not possible "720x480" : { 60: "720x480" }, "720x576" : { 60: "720x576" }, "1280x720": { 60: "1280x720" }, "1280x720 multi": { 50: "1280x720_50", 60: "1280x720" }, "1920x1080": { 60: "1920x1080"}, "1920x1080 multi": { 50: "1920x1080", 60: "1920x1080_50" }, "1280x1024" : { 60: "1280x1024"}, "1366x768" : { 60: "1366x768"}, "1366x768 multi" : { 50: "1366x768", 60: "1366x768_50" }, "1280x768": { 60: "1280x768" }, "640x480" : { 60: "640x480" } } modes["Scart"] = ["PAL", "NTSC", "Multi"] # modes["DVI-PC"] = ["PC"] if (about.getChipSetString() in ('7366', '7376', '5272s', '7444', '7445', '7445s')): modes["HDMI"] = ["720p", "1080p", "2160p", "1080i", "576p", "576i", "480p", "480i"] widescreen_modes = {"720p", "1080p", "1080i", "2160p"} elif (about.getChipSetString() in ('7252', '7251', '7251S', '7252S', '7251s', '7252s', '72604', '7278', '7444s', '3798mv200', '3798cv200', 'hi3798mv200', 'hi3798cv200')): modes["HDMI"] = ["720p", "1080p", "2160p", "2160p30", "1080i", "576p", "576i", "480p", "480i"] widescreen_modes = {"720p", "1080p", "1080i", "2160p", "2160p30"} elif (about.getChipSetString() in ('7241', '7358', '7362', '73625', '7346', '7356', '73565', '7424', '7425', '7435', '7552', '7581', '7584', '75845', '7585', 'pnx8493', '7162', '7111', '3716mv410', 'hi3716mv410')) or (getBrandOEM() in ('azbox')): modes["HDMI"] = ["720p", "1080p", "1080i", "576p", "576i", "480p", "480i"] widescreen_modes = {"720p", "1080p", "1080i"} elif about.getChipSetString() in ('meson-6',): modes["HDMI"] = ["720p", "1080p", "1080i"] widescreen_modes = {"720p", "1080p", "1080i"} elif about.getChipSetString() in ('meson-64','S905D'): modes["HDMI"] = ["720p", "1080p", "2160p", "2160p30", "1080i"] widescreen_modes = {"720p", "1080p", "1080i", "2160p", "2160p30"} else: modes["HDMI"] = ["720p", "1080i", "576p", "576i", "480p", "480i"] widescreen_modes = {"720p", "1080i"} if getBoxType() in ('dreamone', 'dreamtwo'): modes['HDMI'] = ["1080p", "720p", "2160p", "2160p30", "1080i"] widescreen_modes = {"1080p", "720p", "1080i", "2160p", "2160p30"} print "[AVSwitch] # dreamone/dreamtwo modes set!." # if SystemInfo["Scart-YPbPr"]: # modes["Scart-YPbPr"] = modes["HDMI"] # if "DVI-PC" in modes and not getModeList("DVI-PC"): # print "[VideoHardware] remove DVI-PC because of not existing modes" # del modes["DVI-PC"] # if "YPbPr" in modes and SystemInfo["no_YPbPr"]: # del modes["YPbPr"] # # if "Scart" in modes and SystemInfo["yellow_RCA_no_scart"]: # modes["RCA"] = modes["Scart"] # del modes["Scart"] # # if "Scart" in modes and SystemInfo["no_yellow_RCA__no_scart"]: # del modes["Scart"] # def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() self.current_mode = None self.current_port = None self.readAvailableModes() self.createConfig() self.readPreferredModes() def readAvailableModes(self): try: f = open("/proc/stb/video/videomode_choices") modes = f.read()[:-1] f.close() except IOError: print "[VideoHardware] couldn't read available videomodes." modes = [ ] return modes return modes.split(' ') def readPreferredModes(self): if config.av.edid_override.value == False: if getBoxType() in ('dreamone', 'dreamtwo'): f = open('/sys/class//amhdmitx/amhdmitx0/disp_cap') modes = f.read()[:-1] f.close() self.modes_preferred = modes.splitlines() print '[AVSwitch] reading edid modes: ', self.modes_preferred else: try: f = open('/proc/stb/video/videomode_edid') modes = f.read()[:-1] f.close() self.modes_preferred = modes.split(' ') print '[AVSwitch] reading edid modes: ', self.modes_preferred except IOError: print '[AVSwitch] reading edid modes failed, using all modes' try: f = open('/proc/stb/video/videomode_preferred') modes = f.read()[:-1] f.close() self.modes_preferred = modes.split(' ') print '[AVSwitch] reading _preferred modes: ', self.modes_preferred except IOError: print '[AVSwitch] reading preferred modes failed, using all modes' self.modes_preferred = self.readAvailableModes() else: self.modes_preferred = self.readAvailableModes() print '[AVSwitch] used default modes: ', self.modes_preferred if len(self.modes_preferred) <= 2: print '[AVSwitch] preferend modes not ok, possible driver failer, len=', len(self.modes_preferred) self.modes_preferred = self.readAvailableModes() if self.modes_preferred != self.last_modes_preferred: self.last_modes_preferred = self.modes_preferred self.on_hotplug('HDMI') def is24hzAvailable(self): if getBoxType() in ('dreamone', 'dreamtwo'): self.has24pAvailable = False else: try: self.has24pAvailable = os.access("/proc/stb/video/videomode_24hz", os.W_OK) and True or False except IOError: print "[AVSwitch] failed to read video choices 24hz ." self.has24pAvailable = False SystemInfo["have24hz"] = self.has24pAvailable # check if a high-level mode with a given rate is available. def isModeAvailable(self, port, mode, rate): rate = self.rates[mode][rate] for mode in rate.values(): if mode not in self.readAvailableModes(): return False return True def isWidescreenMode(self, port, mode): return mode in self.widescreen_modes def setMode(self, port, mode, rate, force = None): print "[VideoHardware] setMode - port: %s, mode: %s, rate: %s" % (port, mode, rate) # config.av.videoport.setValue(port) # we can ignore "port" self.current_mode = mode self.current_port = port modes = self.rates[mode][rate] mode_50 = modes.get(50) mode_60 = modes.get(60) if mode_50 is None or force == 60: mode_50 = mode_60 if mode_60 is None or force == 50: mode_60 = mode_50 if getBoxType() in ('dreamone', 'dreamtwo'): f = open('/sys/class/display/mode', 'w') f.write('576i50hz') f.close() amlmode = mode + rate.lower() f = open('/sys/class/display/mode', 'w') f.write(amlmode) f.close() print '#[AVSwitch] setting videomode to::::', amlmode try: f = open("/proc/stb/video/videomode_50hz", "w") f.write(mode_50) f.close() f = open("/proc/stb/video/videomode_60hz", "w") f.write(mode_60) f.close() except IOError: try: # fallback if no possibility to setup 50/60 hz mode f = open("/proc/stb/video/videomode", "w") f.write(mode_50) f.close() except IOError: print "[AVSwitch] setting videomode failed." # if SystemInfo["have24hz"]: # try: # open("/proc/stb/video/videomode_24hz", "w").write(mode_24) # except IOError: # print "[VideoHardware] cannot open /proc/stb/video/videomode_24hz" if getBrandOEM() in ('gigablue',): try: # use 50Hz mode (if available) for booting f = open("/etc/videomode", "w") f.write(mode_50) f.close() except IOError: print "[AVSwitch] writing initial videomode to /etc/videomode failed." map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} self.setColorFormat(map[config.av.colorformat.value]) if about.getCPUString().startswith('STx'): #call setResolution() with -1,-1 to read the new scrren dimensions without changing the framebuffer resolution from enigma import gMainDC gMainDC.getInstance().setResolution(-1, -1) def saveMode(self, port, mode, rate): config.av.videoport.setValue(port) config.av.videoport.save() if port in config.av.videomode: config.av.videomode[port].setValue(mode) config.av.videomode[port].save() if mode in config.av.videorate: config.av.videorate[mode].setValue(rate) config.av.videorate[mode].save() def isPortAvailable(self, port): # fixme return True def isPortUsed(self, port): if port == "HDMI": self.readPreferredModes() return len(self.modes_preferred) != 0 else: return True def getPortList(self): return [port for port in self.modes if self.isPortAvailable(port)] # get a list with all modes, with all rates, for a given port. def getModeList(self, port): if getBoxType() in ('dreamone', 'dreamtwo'): res = [('2160p', ['50Hz', 'multi', '60Hz', 'auto']), ('1080p', ['50Hz', 'multi', '60Hz', 'auto']), ('720p', ['50Hz', 'multi', '60Hz']), ('1080i', ['50Hz', 'multi', '60Hz', 'auto']), ('576p', ['50Hz']), ('576i', ['50Hz']), ('480p', ['60Hz']), ('480i', ['60Hz'])] return res res = [] for mode in self.modes[port]: rates = [ rate for rate in self.rates[mode] if self.isModeAvailable(port, mode, rate) ] if len(rates): res.append((mode, rates)) print '################################33 %s', res return res def createConfig(self, *args): hw_type = HardwareInfo().get_device_name() has_hdmi = HardwareInfo().has_hdmi() lst = [] config.av.videomode = ConfigSubDict() config.av.autores_mode_sd = ConfigSubDict() config.av.autores_mode_hd = ConfigSubDict() config.av.autores_mode_fhd = ConfigSubDict() config.av.autores_mode_uhd = ConfigSubDict() config.av.videorate = ConfigSubDict() config.av.autores_rate_sd = ConfigSubDict() config.av.autores_rate_hd = ConfigSubDict() config.av.autores_rate_fhd = ConfigSubDict() config.av.autores_rate_uhd = ConfigSubDict() # create list of output ports portlist = self.getPortList() for port in portlist: descr = port if 'HDMI' in port: lst.insert(0, (port, descr)) else: lst.append((port, descr)) modes = self.getModeList(port) if len(modes): config.av.videomode[port] = ConfigSelection(choices = [mode for (mode, rates) in modes]) config.av.autores_mode_sd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes]) config.av.autores_mode_hd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes]) config.av.autores_mode_fhd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes]) config.av.autores_mode_uhd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes]) for (mode, rates) in modes: ratelist = [] for rate in rates: if rate in ("auto"): continue ratelist.append((rate, rate)) config.av.videorate[mode] = ConfigSelection(choices = ratelist) config.av.autores_rate_sd[mode] = ConfigSelection(choices = ratelist) config.av.autores_rate_hd[mode] = ConfigSelection(choices = ratelist) config.av.autores_rate_fhd[mode] = ConfigSelection(choices = ratelist) config.av.autores_rate_uhd[mode] = ConfigSelection(choices = ratelist) config.av.videoport = ConfigSelection(choices = lst) def setInput(self, input): INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): if not self.current_port: self.current_port = config.av.videoport.value if self.current_port in ("YPbPr", "Scart-YPbPr"): eAVSwitch.getInstance().setColorFormat(3) elif self.current_port in ("RCA"): eAVSwitch.getInstance().setColorFormat(0) else: eAVSwitch.getInstance().setColorFormat(value) def setConfiguredMode(self): port = config.av.videoport.value if port not in config.av.videomode: print "[VideoHardware] current port not available, not setting videomode" return mode = config.av.videomode[port].value if mode not in config.av.videorate: print "[VideoHardware] current mode not available, not setting videomode" return rate = config.av.videorate[mode].value self.setMode(port, mode, rate) def setAspect(self, cfgelement): print "[AVSwitch] setting aspect: %s" % cfgelement.value try: f = open("/proc/stb/video/aspect", "w") f.write(cfgelement.value) f.close() except IOError: print "[AVSwitch] setting aspect failed." def setWss(self, cfgelement): if not cfgelement.value: wss = "auto(4:3_off)" else: wss = "auto" if os.path.exists("/proc/stb/denc/0/wss"): print "[AVSwitch] setting wss: %s" % wss f = open("/proc/stb/denc/0/wss", "w") f.write(wss) f.close() def setPolicy43(self, cfgelement): print "[AVSwitch] setting policy: %s" % cfgelement.value arw = "0" try: if getBoxType() in ('dreamone', 'dreamtwo'): if cfgelement.value == "panscan" : arw = "12" if cfgelement.value == "letterbox" : arw = "11" if cfgelement.value == "bestfit" : arw = "10" open("/sys/class/video/screen_mode", "w").write(arw) else: f = open("/proc/stb/video/policy", "w") f.write(cfgelement.value) f.close() except IOError: print "[AVSwitch] setting policy43 failed." def setPolicy169(self, cfgelement): if os.path.exists("/proc/stb/video/policy2"): print "[VideoHardware] setting policy2: %s" % cfgelement.value f = open("/proc/stb/video/policy2", "w") f.write(cfgelement.value) f.close() def getOutputAspect(self): ret = (16,9) port = config.av.videoport.value if port not in config.av.videomode: print "[VideoHardware] current port not available in getOutputAspect!!! force 16:9" else: mode = config.av.videomode[port].value force_widescreen = self.isWidescreenMode(port, mode) is_widescreen = force_widescreen or config.av.aspect.value in ("16:9", "16:10") is_auto = config.av.aspect.value == "auto" if is_widescreen: if force_widescreen: pass else: aspect = {"16:9": "16:9", "16:10": "16:10"}[config.av.aspect.value] if aspect == "16:10": ret = (16,10) elif is_auto: try: aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() if aspect_str == "1": # 4:3 ret = (4,3) except IOError: pass else: # 4:3 ret = (4,3) return ret def getFramebufferScale(self): aspect = self.getOutputAspect() fb_size = getDesktop(0).size() return aspect[0] * fb_size.height(), aspect[1] * fb_size.width() def getAspectRatioSetting(self): valstr = config.av.aspectratio.value if valstr == "4_3_letterbox": val = 0 elif valstr == "4_3_panscan": val = 1 elif valstr == "16_9": val = 2 elif valstr == "16_9_always": val = 3 elif valstr == "16_10_letterbox": val = 4 elif valstr == "16_10_panscan": val = 5 elif valstr == "16_9_letterbox": val = 6 return val
SystemInfo['USETunersetup'] = SystemInfo['ForceLNBPowerChanged'] or SystemInfo[ 'ForceToneBurstChanged'] SystemInfo['CanDoTranscodeAndPIP'] = getBoxType() in ('vusolo4k', 'gbquad4k') SystemInfo['HDMIin'] = getMachineBuild() in ( 'inihdp', 'hd2400', 'et10000', 'dm7080', 'dm820', 'dm900', 'dm920', 'vuultimo4k', 'et13000', 'sf5008', 'vuuno4kse', 'vuduo4k') or getBoxType() in ('spycat4k', 'spycat4kcombo', 'gbquad4k') SystemInfo['HAVEEDIDDECODE'] = fileCheck( '/proc/stb/hdmi/raw_edid') and fileCheck('/usr/bin/edid-decode') SystemInfo['HaveRCA'] = getHaveRCA() == 'True' SystemInfo['HaveDVI'] = getHaveDVI() == 'True' SystemInfo['HaveAVJACK'] = getHaveAVJACK() == 'True' SystemInfo['HAVESCART'] = getHaveSCART() == 'True' SystemInfo['HAVESCARTYUV'] = getHaveSCARTYUV() == 'True' SystemInfo['HAVEYUV'] = getHaveYUV() == 'True' SystemInfo['HAVEHDMI'] = getHaveHDMI() == 'True' SystemInfo['HasMMC'] = fileHas( '/proc/cmdline', 'root=/dev/mmcblk') or 'mmcblk' in getMachineMtdRoot() SystemInfo['CanProc'] = SystemInfo['HasMMC'] and getBrandOEM() != 'vuplus' SystemInfo['HasHiSi'] = pathExists('/proc/hisi') SystemInfo['canMode12'] = getMachineBuild() in ( 'hd51', 'vs1500', 'h7') and ('brcm_cma=440M@328M brcm_cma=192M@768M', 'brcm_cma=520M@248M brcm_cma=200M@768M') SystemInfo['HAScmdline'] = fileCheck('/boot/cmdline.txt') SystemInfo['HasH9SD'] = getMachineBuild() in ( 'h9', 'i55plus') and pathExists('/dev/mmcblk0p1') SystemInfo['HasSDswap'] = getMachineBuild() in ( 'h9', 'i55plus') and pathExists('/dev/mmcblk0p1') SystemInfo['CanProc'] = SystemInfo['HasMMC'] and getBrandOEM() != 'vuplus' SystemInfo['canRecovery'] = getMachineBuild() in ( 'hd51', 'vs1500', 'h7',
print 'getBrandOEM=%s<' % boxbranding.getBrandOEM() print 'getOEVersion=%s<' % boxbranding.getOEVersion() print 'getDriverDate=%s<' % boxbranding.getDriverDate() print 'getImageVersion=%s<' % boxbranding.getImageVersion() print 'getImageBuild=%s<' % boxbranding.getImageBuild() print 'getImageDevBuild=%s<' % boxbranding.getImageDevBuild() print 'getImageType=%s<' % boxbranding.getImageType() print 'getImageDistro=%s<' % boxbranding.getImageDistro() print 'getImageFolder=%s<' % boxbranding.getImageFolder() print 'getImageFileSystem=%s<' % boxbranding.getImageFileSystem() print 'getImageDevBuild=%s<' % boxbranding.getImageDevBuild() print 'getImageType=%s<' % boxbranding.getImageType() print 'getMachineMake=%s<' % boxbranding.getMachineMake() print 'getImageArch=%s<' % boxbranding.getImageArch() print 'getFeedsUrl=%s<' % boxbranding.getFeedsUrl() print 'getDisplayType=%s<' % boxbranding.getDisplayType() print 'getHaveHDMI=%s<' % boxbranding.getHaveHDMI() print 'getHaveYUV=%s<' % boxbranding.getHaveYUV() print 'getHaveRCA=%s<' % boxbranding.getHaveRCA() print 'getHaveAVJACK=%s<' % boxbranding.getHaveAVJACK() print 'getHaveSCART=%s<' % boxbranding.getHaveSCART() print 'getHaveSCARTYUV=%s<' % boxbranding.getHaveSCARTYUV() print 'getHaveDVI=%s<' % boxbranding.getHaveDVI() print 'getHaveMiniTV=%s<' % boxbranding.getHaveMiniTV() print 'getHaveHDMIinHD=%s<' % boxbranding.getHaveHDMIinHD() print 'getHaveHDMIinFHD=%s<' % boxbranding.getHaveHDMIinFHD() print 'getHaveWOL=%s<' % boxbranding.getHaveWOL() print 'getHaveWWOL=%s<' % boxbranding.getHaveWWOL() print 'getHaveTranscoding1=%s<' % boxbranding.getHaveTranscoding1() print 'getHaveTranscoding2=%s<' % boxbranding.getHaveTranscoding2() print 'getHaveCI=%s<' % boxbranding.getHaveCI()
print("getBoxType=%s<" %boxbranding.getBoxType()) print("getBrandOEM=%s<" %boxbranding.getBrandOEM()) print("getOEVersion=%s<" %boxbranding.getOEVersion()) print("getDriverDate=%s<" %boxbranding.getDriverDate()) print("getImageVersion=%s<" %boxbranding.getImageVersion()) print("getImageBuild=%s<" %boxbranding.getImageBuild()) print("getImageDistro=%s<" %boxbranding.getImageDistro()) print("getImageFolder=%s<" %boxbranding.getImageFolder()) print("getImageFileSystem=%s<" %boxbranding.getImageFileSystem()) print("getImageDevBuild=%s<" %boxbranding.getImageDevBuild()) print("getImageType=%s<" %boxbranding.getImageType()) print("getMachineMake=%s<" %boxbranding.getMachineMake()) print("getImageArch=%s<" %boxbranding.getImageArch()) print("getFeedsUrl=%s<" %boxbranding.getFeedsUrl()) print("getDisplayType=%s<" %boxbranding.getDisplayType()) print("getHaveHDMI%s<" %boxbranding.getHaveHDMI()) print("getHaveYUV%s<" %boxbranding.getHaveYUV()) print("getHaveRCA%s<" %boxbranding.getHaveRCA()) print("getHaveAVJACK%s<" %boxbranding.getHaveAVJACK()) print("getHaveSCART%s<" %boxbranding.getHaveSCART()) print("getHaveSCARTYUV%s<" %boxbranding.getHaveSCARTYUV()) print("getHaveDVI%s<" %boxbranding.getHaveDVI()) print("getHaveMiniTV%s<" %boxbranding.getHaveMiniTV()) print("getHaveHDMIinHD%s<" %boxbranding.getHaveHDMIinHD()) print("getHaveHDMIinFHD%s<" %boxbranding.getHaveHDMIinFHD()) print("getHaveWOL%s<" %boxbranding.getHaveWOL()) print("getHaveWWOL%s<" %boxbranding.getHaveWWOL()) print("getHaveTranscoding1%s<" %boxbranding.getHaveTranscoding1()) print("getHaveTranscoding2%s<" %boxbranding.getHaveTranscoding2()) print("getHaveCI%s<" %boxbranding.getHaveCI()) print("getOpenFIXVersion=%s<" %boxbranding.getOpenFIXVersion())
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function from Components.config import config, ConfigSelection, ConfigSubDict, ConfigYesNo from Components.SystemInfo import SystemInfo from Tools.CList import CList import os from enigma import getBoxType, getBoxBrand from Components.About import about from boxbranding import getHaveAVJACK, getHaveHDMI, getMachineBuild, getSoCFamily brand = getBoxBrand() socfamily = getSoCFamily().replace('bcm', '').replace('hisi', '') chipsetstring = about.getChipSetString() has_hdmi = getHaveHDMI() == "True" has_scart = SystemInfo["HasScart"] has_yuv = SystemInfo["HasYPbPr"] has_rca = SystemInfo["HasComposite"] has_avjack = getHaveAVJACK() == "True" # The "VideoHardware" is the interface to /proc/stb/video. # It generates hotplug events, and gives you the list of # available and preferred modes, as well as handling the currently # selected mode. No other strict checking is done. config.av.edid_override = ConfigYesNo(default=True) class VideoHardware: rates = {} # high-level, use selectable modes.
SystemInfo["HasTranscoding"] = getHaveTranscoding( ) == "True" or getHaveMultiTranscoding() == "True" or pathExists( "/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0") SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices", "h265") SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = model in ("vusolo4k", "gbquad4k") SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth") SystemInfo["HasFrontDisplayPicon"] = model in ("et8500", "vusolo4k", "vuuno4kse", "vuduo4k", "vuduo4kse", "vuultimo4k") SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz") SystemInfo["HasHDMIpreemphasis"] = fileCheck("/proc/stb/hdmi/preemphasis") SystemInfo["HasColorimetry"] = fileCheck("/proc/stb/video/hdmi_colorimetry") SystemInfo["HasHdrType"] = fileCheck("/proc/stb/video/hdmi_hdrtype") SystemInfo["HasHDMI-CEC"] = getHaveHDMI() == "True" and fileExists( resolveFilename( SCOPE_PLUGINS, "SystemPlugins/HdmiCEC/plugin.pyo")) or fileExists( resolveFilename(SCOPE_PLUGINS, "SystemPlugins/HdmiCEC/plugin.py") ) and (fileExists("/dev/cec0") or fileExists("/dev/hdmi_cec") or fileExists("/dev/misc/hdmi_cec0")) SystemInfo["HasHDMIHDin"] = getHaveHDMIinHD() == "True" SystemInfo["HasHDMIFHDin"] = getHaveHDMIinFHD() == "True" SystemInfo[ "HasHDMIin"] = SystemInfo["HasHDMIHDin"] or SystemInfo["HasHDMIFHDin"] SystemInfo["HasYPbPr"] = getHaveYUV() == "True" SystemInfo["HasScart"] = getHaveSCART() == "True" SystemInfo["HasSVideo"] = getHaveSVIDEO() == "True" SystemInfo["HasComposite"] = getHaveRCA() == "True" SystemInfo["HasAutoVolume"] = fileExists( "/proc/stb/audio/avl_choices") and fileCheck("/proc/stb/audio/avl")