示例#1
0
    def VideoChangeDetect(self):
        global resolutionlabel
        config_port = config.av.videoport.value
        config_mode = str(config.av.videomode[config_port].value).replace(
            '\n', '')
        config_res = str(config.av.videomode[config_port].value[:-1]).replace(
            '\n', '')
        config_pol = str(config.av.videomode[config_port].value[-1:]).replace(
            '\n', '')
        config_rate = str(config.av.videorate[config_mode].value).replace(
            'Hz', '').replace('\n', '')

        f = open("/proc/stb/video/videomode")
        current_mode = f.read()[:-1].replace('\n', '')
        f.close()
        if current_mode.upper() in ('PAL', 'NTSC'):
            current_mode = current_mode.upper()

        current_pol = ''
        if 'i' in current_mode:
            current_pol = 'i'
        elif 'p' in current_mode:
            current_pol = 'p'
        current_res = current_pol and current_mode.split(
            current_pol)[0].replace('\n', '') or ""
        current_rate = current_pol and current_mode.split(
            current_pol)[0].replace(
                '\n', '') and current_mode.split(current_pol)[1].replace(
                    '\n', '') or ""

        video_height = None
        video_width = None
        video_pol = None
        video_rate = None
        if path.exists("/proc/stb/vmpeg/0/yres"):
            f = open("/proc/stb/vmpeg/0/yres", "r")
            try:
                video_height = int(f.read(), 16)
            except:
                pass
            f.close()
        if path.exists("/proc/stb/vmpeg/0/xres"):
            f = open("/proc/stb/vmpeg/0/xres", "r")
            try:
                video_width = int(f.read(), 16)
            except:
                pass
            f.close()
        if path.exists("/proc/stb/vmpeg/0/progressive"):
            f = open("/proc/stb/vmpeg/0/progressive", "r")
            try:
                video_pol = "p" if int(f.read(), 16) else "i"
            except:
                pass
            f.close()
        if path.exists("/proc/stb/vmpeg/0/framerate"):
            f = open("/proc/stb/vmpeg/0/framerate", "r")
            try:
                video_rate = int(f.read())
            except:
                pass
            f.close()

        if not video_height or not video_width or not video_pol or not video_rate:
            service = self.session.nav.getCurrentService()
            if service is not None:
                info = service.info()
            else:
                info = None

            if info:
                video_height = int(
                    info.getInfo(iServiceInformation.sVideoHeight))
                video_width = int(info.getInfo(
                    iServiceInformation.sVideoWidth))
                video_pol = ("i", "p")[info.getInfo(
                    iServiceInformation.sProgressive)]
                video_rate = int(info.getInfo(iServiceInformation.sFrameRate))

        if video_height and video_width and video_pol and video_rate:
            resolutionlabel["content"].setText(
                _("Video content: %ix%i%s %iHz") %
                (video_width, video_height, video_pol,
                 (video_rate + 500) / 1000))
            if (700 < video_width <= 720
                ) and video_height <= 480 and video_rate in (23976, 24000,
                                                             29970, 59940):
                new_res = "480"
            elif (700 < video_width <= 720
                  ) and video_height <= 576 and video_rate in (25000, 50000):
                new_res = "576"
            elif (video_width == 1280) and video_height <= 720:
                new_res = "720"
            else:
                new_res = config_res

            if video_rate != -1:
                if video_rate == 25000 and video_pol == 'i':
                    new_rate = 50000
                elif video_rate == 59940 or (
                        video_rate == 29970 and video_pol
                        == 'i') or (video_rate == 29970 and video_pol == 'p'
                                    and config.av.autores.value == 'disabled'):
                    new_rate = 60000
                elif video_rate == 23976:
                    new_rate = 24000
                elif video_rate == 29970:
                    new_rate = 30000
                else:
                    new_rate = video_rate
                new_rate = str((new_rate + 500) / 1000)
            else:
                new_rate = config_rate

            if video_pol != -1:
                new_pol = str(video_pol)
            else:
                new_pol = config_pol

            write_mode = None
            new_mode = None
            if config_mode in ('PAL', 'NTSC'):
                write_mode = config_mode
            elif config.av.autores.value == 'all' or (
                    config.av.autores.value == 'hd' and int(new_res) >= 720):
                if (config.av.autores_deinterlace.value
                        and HardwareInfo().is_nextgen()) or (
                            config.av.autores_deinterlace.value
                            and not HardwareInfo().is_nextgen()
                            and int(new_res) <= 720):
                    new_pol = new_pol.replace('i', 'p')
                if new_res + new_pol + new_rate in iAVSwitch.readAvailableModes(
                ):
                    new_mode = new_res + new_pol + new_rate
                    if new_mode == '480p24' or new_mode == '576p24':
                        new_mode = config.av.autores_480p24.value
                    if new_mode == '720p24':
                        new_mode = config.av.autores_720p24.value
                    if new_mode == '1080p24':
                        new_mode = config.av.autores_1080p24.value
                    if new_mode == '1080p25':
                        new_mode = config.av.autores_1080p25.value
                    if new_mode == '1080p30':
                        new_mode = config.av.autores_1080p30.value
                elif new_res + new_pol in iAVSwitch.readAvailableModes():
                    new_mode = new_res + new_pol
                else:
                    new_mode = config_mode + new_rate

                write_mode = new_mode
            elif config.av.autores.value == 'hd' and int(new_res) <= 576:
                if (config.av.autores_deinterlace.value
                        and HardwareInfo().is_nextgen()) or (
                            config.av.autores_deinterlace.value
                            and not HardwareInfo().is_nextgen()
                            and not config.av.autores_sd.value == '1080i'):
                    new_mode = config.av.autores_sd.value.replace(
                        'i', 'p') + new_rate
                else:
                    if new_pol in 'p':
                        new_mode = config.av.autores_sd.value.replace(
                            'i', 'p') + new_rate
                    else:
                        new_mode = config.av.autores_sd.value + new_rate

                if new_mode == '720p24':
                    new_mode = config.av.autores_720p24.value
                if new_mode == '1080p24':
                    new_mode = config.av.autores_1080p24.value
                if new_mode == '1080p25':
                    new_mode = config.av.autores_1080p25.value
                if new_mode == '1080p30':
                    new_mode = config.av.autores_1080p30.value

                write_mode = new_mode
            else:
                if path.exists('/proc/stb/video/videomode_%shz' %
                               new_rate) and config_rate == 'multi':
                    try:
                        f = open("/proc/stb/video/videomode_%shz" % new_rate,
                                 "r")
                        multi_videomode = f.read().replace('\n', '')
                        f.close()
                        if multi_videomode and (current_mode !=
                                                multi_videomode):
                            write_mode = multi_videomode
                        else:
                            write_mode = current_mode
                    except IOError:
                        write_mode = current_mode

            if write_mode and current_mode != write_mode:
                resolutionlabel["restxt"].setText(
                    _("Video mode: %s") % write_mode)
                if config.av.autores.value != "disabled" and config.av.autores_label_timeout.value != '0':
                    resolutionlabel.show()
                print "[VideoMode] setMode - port: %s, mode: %s" % (
                    config_port, write_mode)
                f = open("/proc/stb/video/videomode", "w")
                f.write(write_mode)
                f.close()

        iAVSwitch.setAspect(config.av.aspect)
        iAVSwitch.setWss(config.av.wss)
        iAVSwitch.setPolicy43(config.av.policy_43)
        iAVSwitch.setPolicy169(config.av.policy_169)

        self.delay = False
        self.detecttimer.stop()
from Tools.HardwareInfo import HardwareInfo

SystemInfo = {}


#FIXMEE...
def getNumVideoDecoders():
    idx = 0
    while fileExists("/dev/dvb/adapter0/video%d" % (idx), 'f'):
        idx += 1
    return idx


SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
SystemInfo[
    "PIPAvailable"] = SystemInfo["NumVideoDecoders"] > 1 and HardwareInfo(
    ).get_device_name() != "spark7162" and HardwareInfo().get_device_name(
    ) != "sagemcom88" and HardwareInfo().get_device_name(
    ) != "esi88" and HardwareInfo().get_device_name(
    ) != "nbox" and HardwareInfo().get_device_name(
    ) != "dsi87" and HardwareInfo().get_device_name(
    ) != "adb2850" and HardwareInfo().get_device_name() != "uhd88"
SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance(
).canMeasureFrontendInputPower()


def countFrontpanelLEDs():
    leds = 0
    if fileExists("/proc/stb/fp/led_set_pattern"):
        leds += 1

    while fileExists("/proc/stb/fp/led%d_pattern" % leds):
示例#3
0
	def getUserfriendlyDeviceName(self, dev, phys):
		dev, part = self.splitDeviceName(dev)
		description = "External Storage %s" % dev
		have_model_descr = False
		try:
			description = readFile("/sys" + phys + "/model")
			have_model_descr = True
		except IOError, s:
			print "couldn't read model: ", s
		from Tools.HardwareInfo import HardwareInfo
		if dev.find('sr') == 0 and dev[2].isdigit():
			devicedb = DEVICEDB_SR
		else:
			devicedb = DEVICEDB
		for physdevprefix, pdescription in devicedb.get(HardwareInfo().device_name,{}).items():
			if phys.startswith(physdevprefix):
				if have_model_descr:
					description = pdescription + ' - ' + description
				else:
					description = pdescription
		# not wholedisk and not partition 1
		if part and part != 1:
			description += " (Partition %d)" % part
		return description

	def addMountedPartition(self, device, desc):
		already_mounted = False
		for x in self.partitions[:]:
			if x.mountpoint == device:
				already_mounted = True
示例#4
0
        leds += 1

    while fileExists("/proc/stb/fp/led%d_pattern" % leds):
        leds += 1

    return leds


SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck(
    "/proc/stb/video/zapping_mode")
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["Fan"] = fileCheck("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm")
SystemInfo["StandbyLED"] = fileCheck("/proc/stb/power/standbyled")
SystemInfo["WakeOnLAN"] = fileCheck("/proc/stb/power/wol") or fileCheck(
    "/proc/stb/fp/wol")
SystemInfo["HasExternalPIP"] = not HardwareInfo().get_device_model(
).startswith("et9") and fileCheck("/proc/stb/vmpeg/1/external")
SystemInfo["VideoDestinationConfigurable"] = fileExists(
    "/proc/stb/vmpeg/0/dst_left")
SystemInfo["hasPIPVisibleProc"] = fileCheck("/proc/stb/vmpeg/1/visible")
SystemInfo["VFD_scroll_repeats"] = fileCheck("/proc/stb/lcd/scroll_repeats")
SystemInfo["VFD_scroll_delay"] = fileCheck("/proc/stb/lcd/scroll_delay")
SystemInfo["VFD_initial_scroll_delay"] = fileCheck(
    "/proc/stb/lcd/initial_scroll_delay")
SystemInfo["VFD_final_scroll_delay"] = fileCheck(
示例#5
0
    while fileExists('/proc/stb/fp/led%d_pattern' % leds):
        leds += 1

    return leds


SystemInfo['12V_Output'] = Misc_Options.getInstance().detected_12V_output()
SystemInfo['ZapMode'] = fileCheck('/proc/stb/video/zapmode') or fileCheck(
    '/proc/stb/video/zapping_mode')
SystemInfo['NumFrontpanelLEDs'] = countFrontpanelLEDs()
SystemInfo['FrontpanelDisplay'] = fileExists('/dev/dbox/oled0') or fileExists(
    '/dev/dbox/lcd0')
SystemInfo['OledDisplay'] = fileExists('/dev/dbox/oled0')
SystemInfo['LcdDisplay'] = fileExists('/dev/dbox/lcd0')
SystemInfo['FBLCDDisplay'] = fileCheck('/proc/stb/fb/sd_detach')
SystemInfo['DeepstandbySupport'] = HardwareInfo().has_deepstandby()
SystemInfo['Fan'] = fileCheck('/proc/stb/fp/fan')
SystemInfo['FanPWM'] = SystemInfo['Fan'] and fileCheck('/proc/stb/fp/fan_pwm')
SystemInfo['StandbyPowerLed'] = fileExists('/proc/stb/power/standbyled')
SystemInfo['LEDButtons'] = getBoxType() == 'vuultimo'
SystemInfo['WakeOnLAN'] = fileCheck('/proc/stb/power/wol') or fileCheck(
    '/proc/stb/fp/wol')
SystemInfo['HDMICEC'] = (
    fileExists('/dev/hdmi_cec')
    or fileExists('/dev/misc/hdmi_cec0')) and fileExists(
        '/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo')
SystemInfo['SABSetup'] = fileExists(
    '/usr/lib/enigma2/python/Plugins/SystemPlugins/SABnzbd/plugin.pyo')
SystemInfo['SeekStatePlay'] = False
SystemInfo['GraphicLCD'] = getBoxType() in ('vuultimo', 'xpeedlx3', 'et10000',
                                            'mutant2400', 'quadbox2400',
示例#6
0
class AVSwitch:
    hw_type = HardwareInfo().get_device_name()
    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["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 hw_type in ('elite', 'premium', 'premium+', 'ultra', "me", "minime"):
        config.av.edid_override = True

    if (about.getChipSetString()
            in ('7366', '7376', '5272s', '7252', '7251', '7251s')):
        modes["HDMI"] = [
            "720p", "1080p", "2160p", "1080i", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"720p", "1080p", "1080i", "2160p"}
    elif (about.getChipSetString()
          in ('7241', '7358', '7362', '73625', '7346', '7356', '73565', '7424',
              '7425', '7435', '7552', 'pnx8493', '7162',
              '7111')) or (hw_type in ('elite', 'premium', 'premium+', 'ultra',
                                       "me", "minime")):
        modes["HDMI"] = [
            "720p", "1080p", "1080i", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"720p", "1080p", "1080i"}
    else:
        modes["HDMI"] = ["720p", "1080i", "576p", "576i", "480p", "480i"]
        widescreen_modes = {"720p", "1080i"}

    modes["YPbPr"] = modes["HDMI"]
    if getBoxType() in ('dm500hd', 'dm800', 'vuuno', 'vusolo', 'vusolo2',
                        'vuultimo', 'vuduo', 'vuduo2'):
        modes["Scart-YPbPr"] = modes["HDMI"]

    # if modes.has_key("DVI-PC") and not getModeList("DVI-PC"):
    # 	print "remove DVI-PC because of not existing modes"
    # 	del modes["DVI-PC"]
    if modes.has_key("YPbPr") and getBoxType() in (
            'mutant11', 'xpeedlxpro', 'mbtwinplus', 'mutant51', 'ax51',
            'twinboxlcdci', 'singleboxlcd', 'formuler4', 'zgemmah5',
            'zgemmai55', 'sf98', 'odinplus', 'zgemmaslc', '9900lx', '9910lx',
            'vusolo4k', 'et7x00mini', 'evomini', 'evominiplus', 'zgemmahs',
            'zgemmah2s', 'zgemmah2h', 't2cable', 'xpeedlxcs2', 'xpeedlxcc',
            'osmini', 'osminiplus', 'gbx1', 'gbx2', 'gbx3', 'sf3038', 'spycat',
            'bwidowx', 'bwidowx2', 'fegasusx3', 'fegasusx5s', 'fegasusx5t',
            'force2', 'force2plus', 'optimussos', 'tmnanose', 'tmnanosem2',
            'tmnanocombo', 'zgemmash1', 'zgemmash2', 'zgemmas2s', 'zgemmass',
            'mago', 'enibox', 'sf108', 'x1plus', 'xcombo', 'mutant1100',
            'mutant1200', 'mutant1265', 'mutant1500', 'mutant500c', 'et4x00',
            'et7500', 'et7000', 'et8500', 'et8500s', 'xp1000mk', 'xp1000max',
            'xp1000plus', 'sf8', 'tm2t', 'tmsingle', 'vusolo2', 'tmnano',
            'iqonios300hd', 'iqonios300hdv2', 'classm', 'axodin', 'axodinc',
            'genius', 'evo', 'galaxym6', 'geniuse3hd', 'evoe3hd', 'axase3',
            'axase3c', 'dm500hdv2', 'dm500hd', 'dm800', 'mixosf7', 'mixoslumi',
            'mixosf5mini', 'gi9196lite', 'ixusszero', 'optimussos1',
            'enfinity', 'marvel1', 'bre2ze', 'sezam1000hd', 'mbmini',
            'atemio5x00', 'xpeedlx1', 'xpeedlx2', 'vusolose', 'gbipbox',
            'formuler3', 'optimussos3plus', 'force1plus', 'vuzero',
            'vizyonvita') or (about.getModelString() == 'ini-3000'):
        del modes["YPbPr"]
    if modes.has_key("Scart") and getBoxType() in (
            'vusolo4k', 'fusionhdse', 'fusionhd', 'force2', 'force2plus',
            'optimussos', 'tmnanose', 'tmnanosecombo', 'gbx1', 'gbx2', 'gbx3',
            'zgemmai55', 'mutant1500'):
        del modes["Scart"]

    if getBoxType() in ('mutant2400'):
        f = open("/proc/stb/info/board_revision", "r").read()
        if f >= "2":
            del modes["YPbPr"]

    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 "couldn't read available videomodes."
            self.modes_available = []
            return
        self.modes_available = 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 "reading preferred modes failed, using all modes"
            self.modes_preferred = self.modes_available

        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 port == "DVI":
                if hw_type in ('elite', 'premium', 'premium+', 'ultra', "me",
                               "minime"):
                    if mode not in self.modes_preferred and not config.av.edid_override.value:
                        print "no, not preferred"
                        return False
            if mode not in self.modes_available:
                return False
        return True

    def isWidescreenMode(self, port, mode):
        return mode in self.widescreen_modes

    def setMode(self, port, mode, rate, force=None):
        print "[VideoMode] 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

        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."


#		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):
        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 "current port not available, not setting videomode"
            return

        mode = config.av.videomode[port].value

        if mode not in config.av.videorate:
            print "current mode not available, not setting videomode"
            return

        rate = config.av.videorate[mode].value
        self.setMode(port, mode, rate)

    def setAspect(self, cfgelement):
        print "[VideoMode] 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"
        if os.path.exists("/proc/stb/denc/0/wss"):
            print "[VideoMode] setting wss: %s" % wss
            f = open("/proc/stb/denc/0/wss", "w")
            f.write(wss)
            f.close()

    def setPolicy43(self, cfgelement):
        print "[VideoMode] 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 "[VideoMode] 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 "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 setAspectRatio(self, value):
        pass

    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
示例#7
0
                                                  choices=[("12h"), ("24h")])
config.plugins.VFD_ini.recDisplay = ConfigSelection(default="False",
                                                    choices=[
                                                        ("True", _("yes")),
                                                        ("False", _("no"))
                                                    ])
config.plugins.VFD_ini.recClockBlink = ConfigSelection(
    default="off",
    choices=[("off", _("Off")), ("on_off", _("On/Off")),
             ("brightness", _("Brightness level"))])
config.plugins.VFD_ini.ClockLevel1 = ConfigSlider(default=1, limits=(0, 10))
config.plugins.VFD_ini.ClockLevel2 = ConfigSlider(default=4, limits=(1, 10))

MyRecLed = False
use_oled = False
if HardwareInfo().get_device_model() in ("sf8008", "gbmv200", "viper4k"):
    use_oled = True


def vfd_write(text):
    if use_oled:
        try:
            open("/dev/dbox/oled0", "w").write(text)
        except:
            pass
    else:
        try:
            open("/dev/dbox/lcd0", "w").write(text)
        except:
            pass
SystemInfo["HasBypassEdidChecking"] = fileCheck("/proc/stb/hdmi/bypass_edid_checking")
SystemInfo["HasColorspace"] = fileCheck("/proc/stb/video/hdmi_colorspace")
SystemInfo["HasColorspaceSimple"] = SystemInfo["HasColorspace"] and getBoxType() in ("vusolo4k","vuuno4k","vuuno4kse","vuultimo4k","vuduo4k")
SystemInfo["HasMultichannelPCM"] = fileCheck("/proc/stb/audio/multichannel_pcm")
SystemInfo["HasMMC"] = fileExists("/proc/cmdline") and "root=/dev/mmcblk" in open("/proc/cmdline","r").read()
SystemInfo["HasTranscoding"] = pathExists("/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0")
SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices","h265")
SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = getBoxType() in ("vusolo4k","gbquad4k")
SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth")
SystemInfo["HasFrontDisplayPicon"] = getBoxType() in ("vusolo4k","et8500")
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["Has2160p"] = fileHas("/proc/stb/video/videomode_preferred","2160p50")
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"] = HardwareInfo().has_hdmi() and fileExists("/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo") and (fileExists("/dev/cec0") or fileExists("/dev/hdmi_cec") or fileExists("/dev/misc/hdmi_cec0"))
SystemInfo["HasYPbPr"] = getBoxType() in ("dm8000","et5x00","et6x00","et9x00","et10000","formuler1","mbtwinplus","spycat","vusolo","vuduo","vuduo2","vuultimo")
SystemInfo["HasScart"] = getBoxType() in ("dm8000","et4x00","et6x00","et8000","et9x00","et10000","formuler1","hd1100","hd1200","hd1265","hd2400","vusolo","vusolo2","vuduo","vuduo2","vuultimo","vuuno","xp1000")
SystemInfo["HasSVideo"] = getBoxType() == "dm8000"
SystemInfo["HasComposite"] = getBoxType() not in ("dm900","dm920","dreamone","i55","gbquad4k","gbue4k","hd1500","osnino","osninoplus","purehd","purehdse","revo4k","vusolo4k","vuzero4k")
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")
SystemInfo["hasXcoreVFD"] = getBoxType() in ("osmega","spycat4k","spycat4kmini","spycat4kcombo") and fileCheck("/sys/module/brcmstb_%s/parameters/pt6302_cgram" % getBoxType())
SystemInfo["HasOfflineDecoding"] = getBoxType() not in ("osmini","osminiplus","et7000mini","et11000","mbmicro","mbtwinplus","mbmicrov2","et7x00","et8500")
SystemInfo["HasRootSubdir"] = fileHas("/proc/cmdline", "rootsubdir=")
SystemInfo["canMultiBoot"] = SystemInfo["HasRootSubdir"] and (1, 4, "mmcblk0", False) or fileHas("/proc/cmdline", "_4.boxmode=") and (1, 4, "mmcblk0", False) or getBoxType() in ("gbue4k","gbquad4k") and (3, 3, "mmcblk0", True) or getBoxType() == "e4hdultra" and (1, 4, "mmcblk0", False) or getBoxType() in ("osmio4k","osmio4kplus") and (1, 4, "mmcblk1", True)
SystemInfo["canMode12"] = fileHas("/proc/cmdline", "_4.boxmode=1 ") and '192M' or fileHas("/proc/cmdline", "_4.boxmode=12") and '192M'
示例#9
0
# -*- coding: utf-8 -*-
from Plugins.Plugin import PluginDescriptor
from enigma import iPlayableService, evfd
from Components.ServiceEventTracker import ServiceEventTracker
from Components.Console import Console
from Components.ActionMap import ActionMap
from Components.config import *
from Components.ConfigList import ConfigList, ConfigListScreen
from Components.Sources.StaticText import StaticText
from Tools.HardwareInfo import HardwareInfo
from Screens.Screen import Screen
import gettext
#Version 140128.3
stb = HardwareInfo().get_device_name()+++

try:
	DisplayType = evfd.getInstance().getVfdType()
	if DisplayType != 10:
		DisplayType = None
except:
	DisplayType = None
DisplayTypevfd = DisplayType

if DisplayTypevfd is None:
	if stb.lower() == 'hs7110':
		DisplayType = 10
	else:
		DisplayType = None
config.plugins.vfdicon = ConfigSubsection()
config.plugins.vfdicon.standbyredled = ConfigSlider(default=7, limits=(1, 7))
#config.plugins.vfdicon.dstandbyredled = ConfigSlider(default=1, limits=(1, 7))
示例#10
0
    def VideoChangeDetect(self):
        global resolutionlabel
        config_port = config.av.videoport.value
        config_mode = str(config.av.videomode[config_port].value).replace(
            '\n', '')
        config_res = str(config.av.videomode[config_port].value[:-1]).replace(
            '\n', '')
        config_pol = str(config.av.videomode[config_port].value[-1:]).replace(
            '\n', '')
        config_rate = str(config.av.videorate[config_mode].value).replace(
            'Hz', '').replace('\n', '')

        f = open("/proc/stb/video/videomode")
        current_mode = f.read()[:-1].replace('\n', '')
        f.close()
        if current_mode.upper() in ('PAL', 'NTSC'):
            current_mode = current_mode.upper()

        current_pol = ''
        if 'i' in current_mode:
            current_pol = 'i'
        elif 'p' in current_mode:
            current_pol = 'p'
        current_res = current_pol and current_mode.split(
            current_pol)[0].replace('\n', '') or ""
        current_rate = current_pol and current_mode.split(
            current_pol)[0].replace(
                '\n', '') and current_mode.split(current_pol)[1].replace(
                    '\n', '') or ""

        video_height = None
        video_width = None
        video_pol = None
        video_rate = None
        if path.exists("/proc/stb/vmpeg/0/yres"):
            try:
                f = open("/proc/stb/vmpeg/0/yres", "r")
                video_height = int(f.read(), 16)
                f.close()
            except:
                video_height = 0
        if path.exists("/proc/stb/vmpeg/0/xres"):
            try:
                f = open("/proc/stb/vmpeg/0/xres", "r")
                video_width = int(f.read(), 16)
                f.close()
            except:
                video_width = 0
        if path.exists("/proc/stb/vmpeg/0/progressive"):
            try:
                f = open("/proc/stb/vmpeg/0/progressive", "r")
                video_pol = "p" if int(f.read(), 16) else "i"
                f.close()
            except:
                video_pol = "i"
        if path.exists("/proc/stb/vmpeg/0/framerate"):
            f = open("/proc/stb/vmpeg/0/framerate", "r")
            try:
                video_rate = int(f.read())
            except:
                video_rate = 50
            f.close()

        if not video_height or not video_width or not video_pol or not video_rate:
            service = self.session.nav.getCurrentService()
            if service is not None:
                info = service.info()
            else:
                info = None

            if info:
                video_height = int(
                    info.getInfo(iServiceInformation.sVideoHeight))
                video_width = int(info.getInfo(
                    iServiceInformation.sVideoWidth))
                video_pol = ("i", "p")[info.getInfo(
                    iServiceInformation.sProgressive)]
                video_rate = int(info.getInfo(iServiceInformation.sFrameRate))

        if (video_height and video_width and video_pol
                and video_rate) or (config.av.smart1080p.value != 'false'):
            resolutionlabel["content"].setText(
                _("Video content: %ix%i%s %iHz") %
                (video_width, video_height, video_pol,
                 (video_rate + 500) / 1000))
            if video_height != -1:
                if video_height > 720 or video_width > 1280:
                    new_res = "1080"
                elif (576 < video_height <= 720) or video_width > 1024:
                    new_res = "720"
                elif (480 < video_height <=
                      576) or video_width > 720 or video_rate in (25000, 23976,
                                                                  24000):
                    new_res = "576"
                else:
                    new_res = "480"
            else:
                new_res = config_res

            if video_rate != -1:
                if video_rate == 25000 and video_pol == 'i':
                    new_rate = 50000
                elif video_rate == 59940 or (
                        video_rate == 29970 and video_pol
                        == 'i') or (video_rate == 29970 and video_pol == 'p'
                                    and config.av.autores.value == 'disabled'):
                    new_rate = 60000
                elif video_rate == 23976:
                    new_rate = 24000
                elif video_rate == 29970:
                    new_rate = 30000
                else:
                    new_rate = video_rate
                new_rate = str((new_rate + 500) / 1000)
            else:
                new_rate = config_rate

            if video_pol != -1:
                new_pol = str(video_pol)
            else:
                new_pol = config_pol

            write_mode = None
            new_mode = None
            if config_mode in ('PAL', 'NTSC'):
                write_mode = config_mode
            elif config.av.autores.value == 'all' or (
                    config.av.autores.value == 'hd' and int(new_res) >= 720):
                if (config.av.autores_deinterlace.value
                        and HardwareInfo().is_nextgen()) or (
                            config.av.autores_deinterlace.value
                            and not HardwareInfo().is_nextgen()
                            and int(new_res) <= 720):
                    new_pol = new_pol.replace('i', 'p')
                if new_res + new_pol + new_rate in iAVSwitch.modes_available:
                    new_mode = new_res + new_pol + new_rate
                    if new_mode == '480p24' or new_mode == '576p24':
                        new_mode = config.av.autores_480p24.value
                    if new_mode == '720p24':
                        new_mode = config.av.autores_720p24.value
                    if new_mode == '1080p24':
                        new_mode = config.av.autores_1080p24.value
                    if new_mode == '1080p25':
                        new_mode = config.av.autores_1080p25.value
                    if new_mode == '1080p30':
                        new_mode = config.av.autores_1080p30.value
                elif new_res + new_pol in iAVSwitch.modes_available:
                    new_mode = new_res + new_pol
                else:
                    new_mode = config_mode + new_rate

                write_mode = new_mode
            elif config.av.autores.value == 'hd' and int(new_res) <= 576:
                if (config.av.autores_deinterlace.value
                        and HardwareInfo().is_nextgen()) or (
                            config.av.autores_deinterlace.value
                            and not HardwareInfo().is_nextgen()
                            and not config.av.autores_sd.value == '1080i'):
                    new_mode = config.av.autores_sd.value.replace(
                        'i', 'p') + new_rate
                else:
                    if new_pol in 'p':
                        new_mode = config.av.autores_sd.value.replace(
                            'i', 'p') + new_rate
                    else:
                        new_mode = config.av.autores_sd.value + new_rate

                if new_mode == '720p24':
                    new_mode = config.av.autores_720p24.value
                if new_mode == '1080p24':
                    new_mode = config.av.autores_1080p24.value
                if new_mode == '1080p25':
                    new_mode = config.av.autores_1080p25.value
                if new_mode == '1080p30':
                    new_mode = config.av.autores_1080p30.value

                write_mode = new_mode
            else:
                if path.exists('/proc/stb/video/videomode_%shz' %
                               new_rate) and config_rate == 'multi':
                    f = open("/proc/stb/video/videomode_%shz" % new_rate, "r")
                    multi_videomode = f.read().replace('\n', '')
                    f.close()
                    if multi_videomode and (current_mode != multi_videomode):
                        write_mode = multi_videomode
                    else:
                        write_mode = config_mode + new_rate

            # workaround for bug, see http://www.lonasdigital.com/reportes-de-fallos-1304/
            # always use a fixed resolution and frame rate   (e.g. 1080p50 if supported) for TV or .ts files
            # always use a fixed resolution and correct rate (e.g. 1080p24/p50/p60 for all other videos
            if config.av.smart1080p.value != 'false':
                ref = self.session.nav.getCurrentlyPlayingServiceReference()
                if ref is not None:
                    try:
                        mypath = ref.getPath()
                    except:
                        mypath = ''
                else:
                    mypath = ''
                # no frame rate information available, check if filename (or directory name) contains a hint
                # (allow user to force a frame rate this way):
                if (mypath.find('p24.') >= 0) or (mypath.find('24p.') >= 0):
                    new_rate = '24'
                elif (mypath.find('p25.') >= 0) or (mypath.find('25p.') >= 0):
                    new_rate = '25'
                elif (mypath.find('p30.') >= 0) or (mypath.find('30p.') >= 0):
                    new_rate = '30'
                elif (mypath.find('p50.') >= 0) or (mypath.find('50p.') >= 0):
                    new_rate = '50'
                elif (mypath.find('p60.') >= 0) or (mypath.find('60p.') >= 0):
                    new_rate = '60'
                elif new_rate == 'multi':
                    new_rate = ''  # omit frame rate specifier, e.g. '1080p' instead of '1080p50' if there is no clue
                if mypath != '':
                    if mypath.endswith('.ts'):
                        print "DEBUG VIDEOMODE/ playing .ts file"
                        new_rate = '50'  # for .ts files
                    else:
                        print "DEBUG VIDEOMODE/ playing other (non .ts) file"
                        # new_rate from above for all other videos
                else:
                    print "DEBUG VIDEOMODE/ no path or no service reference, presumably live TV"
                    new_rate = '50'  # for TV / or no service reference, then stay at 1080p50

                new_rate = new_rate.replace('25', '50')
                new_rate = new_rate.replace('30', '60')

                if (config.av.smart1080p.value == '1080p50') or (
                        config.av.smart1080p.value == 'true'
                ):  # for compatibility with old ConfigEnableDisable
                    write_mode = '1080p' + new_rate
                elif config.av.smart1080p.value == '2160p50':
                    write_mode = '2160p' + new_rate
                elif config.av.smart1080p.value == '1080i50':
                    if new_rate == '24':
                        write_mode = '1080p24'  # instead of 1080i24
                    else:
                        write_mode = '1080i' + new_rate
                elif config.av.smart1080p.value == '720p50':
                    write_mode = '720p' + new_rate
                print "[VideoMode] smart1080p mode, selecting ", write_mode

            if write_mode and current_mode != write_mode and self.bufferfull:
                # first we read now the real available values for every stb,
                # before we try to write the new mode
                changeResolution = False
                try:
                    if path.exists("/proc/stb/video/videomode_choices"):
                        vf = open("/proc/stb/video/videomode_choices")
                        values = vf.readline().replace("\n", "").split(" ", -1)
                        for x in values:
                            if x == write_mode:
                                try:
                                    f = open("/proc/stb/video/videomode", "w")
                                    f.write(write_mode)
                                    f.close()
                                    changeResolution = True
                                except Exception, e:
                                    print("[VideoMode] write_mode exception:" +
                                          str(e))

                        if not changeResolution:
                            print "[VideoMode] setMode - port: %s, mode: %s is not available" % (
                                config_port, write_mode)
                            resolutionlabel["restxt"].setText(
                                _("Video mode: %s not available") % write_mode)
                            # we try to go for not available 1080p24/1080p30/1080p60 to change to 1080p from 60hz_choices if available
                            # TODO: can we make it easier, or more important --> smaller ?
                            # should we outsourced that way, like two new "def ..."
                            # or some other stuff, not like this?
                            if (write_mode == "1080p24") or (
                                    write_mode == "1080p30") or (write_mode
                                                                 == "1080p60"):
                                for x in values:
                                    if x == "1080p":
                                        try:
                                            f = open(
                                                "/proc/stb/video/videomode",
                                                "w")
                                            f.write(x)
                                            f.close()
                                            changeResolution = True
                                        except Exception, e:
                                            print(
                                                "[VideoMode] write_mode exception:"
                                                + str(e))
                                if not changeResolution:
                                    print "[VideoMode] setMode - port: %s, mode: 1080p is also not available" % config_port
                                    resolutionlabel["restxt"].setText(
                                        _("Video mode: 1080p also not available"
                                          ))
                                else:
                                    print "[VideoMode] setMode - port: %s, mode: %s" % (
                                        config_port, x)
                                    resolutionlabel["restxt"].setText(
                                        _("Video mode: %s") % x)
                            if (write_mode == "2160p24") or (
                                    write_mode == "2160p30") or (write_mode
                                                                 == "2160p60"):
                                for x in values:
                                    if x == "2160p":
                                        try:
                                            f = open(
                                                "/proc/stb/video/videomode",
                                                "w")
                                            f.write(x)
                                            f.close()
                                            changeResolution = True
                                        except Exception, e:
                                            print(
                                                "[VideoMode] write_mode exception:"
                                                + str(e))
                                if not changeResolution:
                                    print "[VideoMode] setMode - port: %s, mode: 2160p is also not available" % config_port
                                    resolutionlabel["restxt"].setText(
                                        _("Video mode: 2160p also not available"
                                          ))
                                else:
                                    print "[VideoMode] setMode - port: %s, mode: %s" % (
                                        config_port, x)
                                    resolutionlabel["restxt"].setText(
                                        _("Video mode: %s") % x)
                        else:
                            resolutionlabel["restxt"].setText(
                                _("Video mode: %s") % write_mode)
                            print "[VideoMode] setMode - port: %s, mode: %s" % (
                                config_port, write_mode)
                        if config.av.autores.value != "disabled" and config.av.autores_label_timeout.value != '0':
                            resolutionlabel.show()
                        vf.close()
示例#11
0
        number_of_leds += 1
    return number_of_leds


SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
SystemInfo["PIPAvailable"] = SystemInfo["NumVideoDecoders"] > 1
SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance(
).canMeasureFrontendInputPower()
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck(
    "/proc/stb/video/zapping_mode")
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["Fan"] = fileCheck("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm")
SystemInfo["StandbyLED"] = fileCheck("/proc/stb/power/standbyled")
SystemInfo["PowerOffDisplay"] = HardwareInfo().get_device_model(
) not in "formuler1" and fileCheck("/proc/stb/power/vfd") or fileCheck(
    "/proc/stb/lcd/vfd")
SystemInfo["WakeOnLAN"] = not HardwareInfo().get_device_model().startswith(
    "et8000") and fileCheck("/proc/stb/power/wol") or fileCheck(
        "/proc/stb/fp/wol")
SystemInfo["HasExternalPIP"] = not HardwareInfo().get_device_model(
).startswith("et9") and fileCheck("/proc/stb/vmpeg/1/external")
SystemInfo["VideoDestinationConfigurable"] = fileExists(
    "/proc/stb/vmpeg/0/dst_left")
SystemInfo["hasPIPVisibleProc"] = fileCheck("/proc/stb/vmpeg/1/visible")
SystemInfo["VFD_scroll_repeats"] = not HardwareInfo().get_device_model(
示例#12
0
def countFrontpanelLEDs():
    leds = 0
    if fileExists("/proc/stb/fp/led_set_pattern"):
        leds += 1

    while fileExists("/proc/stb/fp/led%d_pattern" % leds):
        leds += 1

    return leds


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() in (
    "ultimo4k", "uno4kse", "duo4k")
SystemInfo["WOWLSupport"] = HardwareInfo().get_vu_device_name() in ("ultimo4k",
                                                                    "duo4k")
SystemInfo["ScrambledPlayback"] = "PVR" in open(
    "/proc/stb/tsmux/ci0_input_choices").read()
SystemInfo["FastChannelChange"] = fileExists("/proc/stb/frontend/fbc/fcc")
SystemInfo["MiniTV"] = fileExists("/proc/stb/lcd/live_enable")
SystemInfo["DisableUsbRecord"] = HardwareInfo().get_vu_device_name() in (
    "solo4k", "uno4kse", "zero4k", "duo4k")
SystemInfo["DefaultAniSpeed"] = HardwareInfo().get_vu_device_name() in (
    "uno4k", "uno4kse", "zero4k", "duo4k") and 25 or 20
SystemInfo["DefaultFullHDSkin"] = HardwareInfo().get_vu_device_name() in (
    "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k")
SystemInfo["PVRSupport"] = HardwareInfo().get_vu_device_name() not in [
示例#13
0
文件: Menu.py 项目: wslee2/enigma2
from Components.config import configfile
from Components.PluginComponent import plugins
from Components.config import config
from Components.SystemInfo import SystemInfo

from Tools.BoundFunction import boundFunction
from Tools.Directories import resolveFilename, SCOPE_SKIN

import xml.etree.cElementTree

from Screens.Setup import Setup, getSetupTitle

# read the menu
from Tools.HardwareInfo import HardwareInfo

model = HardwareInfo().get_device_name()

# for ci menu deletion of softcam / ci item -- iqon
if model in ("tmnanosem2", "force2eco"):
	mdom = xml.etree.cElementTree.parse(resolveFilename(SCOPE_SKIN, 'eco_menu.xml'))
else:
	mdom = xml.etree.cElementTree.parse(resolveFilename(SCOPE_SKIN, 'menu.xml'))


class MenuUpdater:
	def __init__(self):
		self.updatedMenuItems = {}

	def addMenuItem(self, id, pos, text, module, screen, weight):
		if not self.updatedMenuAvailable(id):
			self.updatedMenuItems[id] = []
示例#14
0
文件: SystemInfo.py 项目: trunca/pena
) in ('vusolo4k')
SystemInfo["HasMultichannelPCM"] = fileCheck(
    "/proc/stb/audio/multichannel_pcm")
SystemInfo["HasMMC"] = getBoxType() in ('vusolo4k', 'hd51', 'hd52', 'gbquad4k')
SystemInfo["HasSwap"] = pathExists("/dev/mmcblk0p10")
SystemInfo["HasMultiBoot"] = fileCheck(
    "/boot/STARTUP_1") and getMachineBuild() not in ('gb7252')
SystemInfo["HasMultiBootGB"] = SystemInfo["HasSwap"] and fileCheck(
    "/boot/STARTUP_1") and getMachineBuild() in ('gb7252')
SystemInfo["CommonInterfaceCIDelay"] = fileCheck("/proc/stb/tsmux/rmx_delay")
SystemInfo["CanDoTranscodeAndPIP"] = getBoxType() in ('vusolo4k')
SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth")
SystemInfo["HasFrontDisplayPicon"] = getBoxType() in ("vusolo4k", "et8500")
SystemInfo["HasHDMIpreemphasis"] = fileCheck("/proc/stb/hdmi/preemphasis")
SystemInfo["HasColorimetry"] = fileCheck("/proc/stb/video/hdmi_colorimetry")
SystemInfo["HasHDMI-CEC"] = HardwareInfo().has_hdmi() and fileExists(
    "/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo"
) and pathExists("/dev/hdmi_cec") or pathExists("/dev/misc/hdmi_cec0")
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(
示例#15
0
SystemInfo["HasMMC"] = fileExists(
    "/proc/cmdline") and "root=/dev/mmcblk" in open("/proc/cmdline",
                                                    "r").read()
SystemInfo["HasTranscoding"] = pathExists("/proc/stb/encoder/0") or fileCheck(
    "/dev/bcm_enc0")
SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices",
                                       "h265")
SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = False
SystemInfo["HasColordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth")
SystemInfo["HasFrontDisplayPicon"] = False
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["Has2160p"] = False
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"] = HardwareInfo().has_hdmi() and fileExists(
    "/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo") and (
        fileExists("/dev/cec0") or fileExists("/dev/hdmi_cec")
        or fileExists("/dev/misc/hdmi_cec0"))
SystemInfo["HasYPbPr"] = getBoxBrand() == "edisionargus" or getBoxType() in (
    "adb_box", "atevio7500", "fortis_hdbox", "hl101", "hs7420", "hs7429",
    "octagon1008", "tf7700", "ufs912", "ufs913", "cuberevo", "cuberevo_mini",
    "cuberevo_mini2", "cuberevo_2000hd", "cuberevo_3000hd")
SystemInfo["HasScart"] = getBoxType() not in ("hs7110", "hs7119")
SystemInfo["HasSVideo"] = getBoxType() == "cuberevo"
SystemInfo["HasComposite"] = getBoxType() != "cuberevo_250hd"
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")
示例#16
0
    def updateStatus(self):
        print("[TVCharts] Status Update ...")
        self.DBStatusTimer.stop()

        if not config.plugins.tvcharts.enabled.value or Screens.Standby.inStandby:
            return

        # Get Channelname
        sref = self.session.nav.getCurrentlyPlayingServiceReference()
        if sref is not None:
            ref = eServiceReference(sref.toString())
            ref.setName("")
            serviceHandler = eServiceCenter.getInstance()
            info = serviceHandler.info(ref)
            channel_name = info and info.getName(ref).replace(
                '\xc2\x86', '').replace('\xc2\x87', '').decode(
                    "utf-8", "ignore").encode("utf-8") or ""
            self.serviceref = ref.toString()
        else:
            channel_name = ""
            self.serviceref = ""

        # Get Event Info
        service = self.session.nav.getCurrentService()
        info = service and service.info()
        event = info and info.getEvent(0)
        event_name = event and event.getEventName() or ""
        event_description = ""
        event_begin = 0

        if event is not None:
            curEvent = parseEvent(event)
            event_begin = int(
                curEvent[0]) + (config.recording.margin_before.getValue() * 60)
            event_description = event.getExtendedDescription()

        # Get Box Info
        self.BoxID = iNetwork.getAdapterAttribute("eth0", "mac")
        self.DeviceName = HardwareInfo().get_device_name()
        try:
            from enigma import getEnigmaVersionString
            from boxbranding import getImageVersion, getImageBuild
            self.EnigmaVersion = getEnigmaVersionString()
            self.ImageVersion = getImageVersion() + '.' + getImageBuild()
        except:
            self.EnigmaVersion = about.getEnigmaVersionString()
            self.ImageVersion = about.getVersionString()

        # Get TimerList
        self.timerlist = ""
        if config.plugins.tvcharts.submittimers.value and self.LastTimerlistUpdate <= (
                time() - 1800):
            self.LastTimerlistUpdate = time()
            try:
                for timer in self.recordtimer.timer_list:
                    if timer.disabled == 0 and timer.justplay == 0:
                        self.timerlist += "%s|%s|%s|%s|%s|%s|%s\n" % (
                            timer.eit,
                            str(
                                int(timer.begin) +
                                (config.recording.margin_before.getValue() *
                                 60)),
                            str(
                                int(timer.end) -
                                (config.recording.margin_after.getValue() *
                                 60)), str(timer.service_ref), timer.name,
                            timer.service_ref.getServiceName().replace(
                                '\xc2\x86', '').replace('\xc2\x87', '').decode(
                                    "utf-8",
                                    "ignore").encode("utf-8"), timer.repeated)
            except Exception:
                print("[TVCharts] Error loading timers!")

        # Get Pluginlist
        if config.plugins.tvcharts.submitplugins.value and self.pluginlist == "":
            try:
                os_system(
                    "opkg list_installed | grep enigma2-plugin- > /tmp/plugins.txt"
                )
                for plugin in open('/tmp/plugins.txt', 'r'):
                    self.pluginlist += plugin[0:plugin.find(' - ')] + "\n"
                os_system("rm -f /tmp/plugins.txt")
            except Exception:
                print("[TVCharts] Error loading plugins!")

        # Status Update
        getPage(
            url=b'http://www.dreambox-plugins.de/feeds/TVCharts/status.php',
            agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)",
            timeout=60,
            method='POST',
            headers={
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            postdata=urlencode({
                'boxid': self.BoxID,
                'devicename': self.DeviceName,
                'imageversion': self.ImageVersion,
                'enigmaversion': self.EnigmaVersion,
                'lastchannel': channel_name,
                'lastevent': event_name,
                'eventdescr': event_description,
                'lastbegin': event_begin,
                'lastserviceref': self.serviceref,
                'timerlist': self.timerlist,
                'pluginlist': self.pluginlist
            })).addErrback(self.updateError)

        # Restart Timer
        self.DBStatusTimer.start(900000, True)
示例#17
0
        part = devname[3:]
        for p in part:
            if not p.isdigit():
                return devname, 0
        return dev, part and int(part) or 0

    def getUserfriendlyDeviceName(self, dev, phys):
        dev, part = self.splitDeviceName(dev)
        description = _("External Storage %s") % dev
        try:
            description = readFile("/sys" + phys + "/model")
        except IOError, s:
            print "couldn't read model: ", s
        from Tools.HardwareInfo import HardwareInfo
        for physdevprefix, pdescription in DEVICEDB.get(
                HardwareInfo().device_name, {}).items():
            if phys.startswith(physdevprefix):
                description = pdescription
        # not wholedisk and not partition 1
        if part and part != 1:
            description += _(" (Partition %d)") % part
        return description

    def addMountedPartition(self, device, desc):
        for x in self.partitions:
            if x.mountpoint == device:
                #already_mounted
                return
        self.partitions.append(Partition(mountpoint=device, description=desc))

    def removeMountedPartition(self, mountpoint):
示例#18
0
def getHardwareTypeString():
    return HardwareInfo().get_device_string()
示例#19
0
        leds += 1

    return leds


SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck(
    "/proc/stb/video/zapping_mode")
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists(
    "/dev/dbox/lcd0")
SystemInfo["OledDisplay"] = fileExists("/dev/dbox/oled0") or getBoxType() in (
    'osminiplus')
SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0")
SystemInfo["FBLCDDisplay"] = fileCheck("/proc/stb/fb/sd_detach")
SystemInfo["DeepstandbySupport"] = HardwareInfo().has_deepstandby()
SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm")
SystemInfo["StandbyPowerLed"] = fileExists("/proc/stb/power/standbyled")
SystemInfo["LEDButtons"] = getBoxType() == 'vuultimo'
SystemInfo["WakeOnLAN"] = fileCheck("/proc/stb/power/wol") or fileCheck(
    "/proc/stb/fp/wol")
SystemInfo["HDMICEC"] = (
    fileExists("/dev/hdmi_cec")
    or fileExists("/dev/misc/hdmi_cec0")) and fileExists(
        "/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
SystemInfo["SABSetup"] = fileExists(
    "/usr/lib/enigma2/python/Plugins/SystemPlugins/SABnzbd/plugin.pyo")
SystemInfo["SeekStatePlay"] = False
SystemInfo["GraphicLCD"] = getBoxType() in ('vuultimo', 'xpeedlx3', 'et10000',
                                            'mutant2400', 'quadbox2400',
示例#20
0
    def getImagesList(self):
        def getImages(path, files):
            for file in [
                    x for x in files
                    if os.path.splitext(x)[1] == ".zip" and model in x
            ]:
                try:
                    if checkimagefiles([
                            x.split(os.sep)[-1]
                            for x in zipfile.ZipFile(file).namelist()
                    ]):
                        if "Downloaded Images" not in self.imagesList:
                            self.imagesList["Downloaded Images"] = {}
                        self.imagesList["Downloaded Images"][file] = {
                            'link': file,
                            'name': file.split(os.sep)[-1]
                        }
                except:
                    pass

        model = HardwareInfo().get_machine_name()

        if not self.imagesList:
            if not self.jsonlist:
                try:
                    self.jsonlist = json.load(
                        urllib2.urlopen(
                            'http://downloads.openpli.org/json/%s' % model))
                except:
                    pass
            self.imagesList = dict(self.jsonlist) if self.jsonlist else {}

            for media in ['/media/%s' % x for x in os.listdir('/media')] + [
                    '/media/net/%s' % x for x in os.listdir('/media/net')
            ] if os.path.exists('/media/net') else []:
                if not (SystemInfo['HasMMC']
                        and "/mmc" in media) and os.path.isdir(media):
                    getImages(media, [
                        os.path.join(media, x) for x in os.listdir(media)
                        if os.path.splitext(x)[1] == ".zip" and model in x
                    ])
                    if "downloaded_images" in os.listdir(media):
                        media = os.path.join(media, "downloaded_images")
                        if os.path.isdir(media) and not os.path.islink(
                                media) and not os.path.ismount(media):
                            getImages(media, [
                                os.path.join(media, x)
                                for x in os.listdir(media) if
                                os.path.splitext(x)[1] == ".zip" and model in x
                            ])
                            for dir in [
                                    dir for dir in [
                                        os.path.join(media, dir)
                                        for dir in os.listdir(media)
                                    ] if os.path.isdir(dir)
                                    and os.path.splitext(dir)[1] == ".unzipped"
                            ]:
                                shutil.rmtree(dir)

        list = []
        for catagorie in reversed(sorted(self.imagesList.keys())):
            if catagorie in self.expanded:
                list.append(
                    ChoiceEntryComponent('expanded',
                                         ((str(catagorie)), "Expander")))
                for image in reversed(sorted(
                        self.imagesList[catagorie].keys())):
                    list.append(
                        ChoiceEntryComponent(
                            'verticalline',
                            ((str(self.imagesList[catagorie][image]['name'])),
                             str(self.imagesList[catagorie][image]['link']))))
            else:
                for image in self.imagesList[catagorie].keys():
                    list.append(
                        ChoiceEntryComponent('expandable',
                                             ((str(catagorie)), "Expander")))
                    break
        if list:
            self["list"].setList(list)
            if self.setIndex:
                self["list"].moveToIndex(
                    self.setIndex if self.setIndex < len(list) else len(list) -
                    1)
                if self["list"].l.getCurrentSelection()[0][1] == "Expander":
                    self.setIndex -= 1
                    if self.setIndex:
                        self["list"].moveToIndex(self.setIndex if self.setIndex
                                                 < len(list) else len(list) -
                                                 1)
                self.setIndex = 0
            self.selectionChanged()
        else:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("Cannot find images - please try later"),
                type=MessageBox.TYPE_ERROR,
                timeout=3)