Esempio n. 1
0
def getStbArch():
    if about.getChipSetString() in ('7366', '7376', '5272s', '7252', '7251', '7251S', '7252', '7252S'):
        return 'armv7ahf'
    elif about.getChipSetString() in 'pnx8493':
        return 'armv7a-vfp'
    elif about.getChipSetString() in ('meson-6', 'meson-64'):
        return 'cortexa9hf'
    elif about.getChipSetString() in ('7162', '7111'):
        return 'sh40'
    else:
        return 'mipsel'
Esempio n. 2
0
	def modeSelect(self, mode):
		ratesList = self.listRates(mode)
		print "ratesList:", ratesList
		if self.port == "DVI" and mode in ("720p", "1080i", "1080p") and (about.getChipSetString().find('7358') != -1 or about.getChipSetString().find('7356') != -1):
			self.rate = "multi"
			self.hw.setMode(port = self.port, mode = mode, rate = "multi")
		elif self.port == "DVI" and mode in ("720p", "1080i"):
			self.rate = "multi"
			self.hw.setMode(port = self.port, mode = mode, rate = "multi")
		elif self.port == "DVI" and mode in ("720p", "1080i", "1080p") and (about.getChipSetString().find('7405') != -1):
			self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])		  
		else:
			self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])
Esempio n. 3
0
    def populate(self):
        self["lab1"] = StaticText(_("openATV"))
        self["lab2"] = StaticText(_("By openATV Image Team"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(_("Support at") + " www.opena.tv")
        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(),
                                             getMachineName())

        if path.exists('/proc/stb/info/chipset'):
            AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

        AboutText += _("CPU:\t%s") % about.getCPUString() + "\n"
        AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

        AboutText += _("Version:\t%s") % getImageVersion() + "\n"
        AboutText += _("Build:\t%s") % getImageBuild() + "\n"
        AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s") % driversdate + "\n"

        AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Frontprocessor version: %s") % fp_version
            AboutText += fp_version + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System temperature:\t%s") % tempinfo.replace(
                '\n', '') + mark + "C\n"

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            f = open('/proc/stb/fp/temp_sensor_avs', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("Processor temperature:\t%s") % tempinfo.replace(
                '\n', '') + mark + "C\n"

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 4
0
	def imageInfo(self):
		AboutText = _("OpenHDF Full-Image Backupscript\n")
		AboutText += _("Support at") + " www.hdfreaks.cc\n\n"
		AboutText += _("[Image Info's]\n")
		AboutText += _("Model: %s %s\n") % (getMachineBrand(), getMachineName())
		AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d", localtime(self.START))

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset: BCM%s") % about.getChipSetString().lower().replace('\n','').replace('bcm','') + "\n"

		#AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"
		AboutText += _("Version: %s") % getImageVersion() + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
		AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))

		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"
		AboutText += _("[Enigma2 Settings]\n")
		AboutText += commands.getoutput("cat /etc/enigma2/settings")
		AboutText += _("\n[Installed Plugins]\n")
		AboutText += commands.getoutput("opkg list_installed | grep enigma2-plugin-")

		return AboutText
Esempio n. 5
0
    def populate(self):
        self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
        self["lab2"] = StaticText(_("By Team ViX"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(
            _("Support at") + " www.world-of-satellite.com")

        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(),
                                             getMachineName())

        if path.exists('/proc/stb/info/chipset'):
            AboutText += _("Chipset:\tBCM%s\n") % about.getChipSetString()

        AboutText += _("CPU:\t%s\n") % about.getCPUString()
        AboutText += _("CPU Speed:\t%s\n") % about.getCPUSpeedString()
        AboutText += _("Cores:\t%s\n") % about.getCpuCoresString()

        AboutText += _("Version:\t%s\n") % getImageVersion()
        AboutText += _("Build:\t%s\n") % getImageBuild()

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s\n") % driversdate
        AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()

        AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString(
        ).replace("GStreamer", "")
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()

        AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
        AboutText += _("Last update:\t%s\n\n") % getEnigmaVersionString()

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Frontprocessor version: %d") % fp_version
            AboutText += fp_version + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value') and getBoxType(
        ) not in ('gbquad'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in (
                'gbquad'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System temperature: %s%sC\n\n") % (
                tempinfo.replace('\n', ''), mark)

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 6
0
    def populate(self):
        self["lab1"] = StaticText(_("openATV"))
        self["lab2"] = StaticText(_("By openATV Image Team"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(_("Support at") + " www.opena.tv")
        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

        if path.exists("/proc/stb/info/chipset"):
            AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

        AboutText += _("CPU:\t%s") % about.getCPUString() + "\n"
        AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

        AboutText += _("Version:\t%s") % getImageVersion() + "\n"
        AboutText += _("Build:\t%s") % getImageBuild() + "\n"
        AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = "-".join((year, month, day))
        AboutText += _("Drivers:\t%s") % driversdate + "\n"

        AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Frontprocessor version: %s") % fp_version
            AboutText += fp_version + "\n"

        tempinfo = ""
        if path.exists("/proc/stb/sensors/temp0/value"):
            f = open("/proc/stb/sensors/temp0/value", "r")
            tempinfo = f.read()
            f.close()
        elif path.exists("/proc/stb/fp/temp_sensor"):
            f = open("/proc/stb/fp/temp_sensor", "r")
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace("\n", "")) > 0:
            mark = str("\xc2\xb0")
            AboutText += _("System temperature:\t%s") % tempinfo.replace("\n", "") + mark + "C\n"

        tempinfo = ""
        if path.exists("/proc/stb/fp/temp_sensor_avs"):
            f = open("/proc/stb/fp/temp_sensor_avs", "r")
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace("\n", "")) > 0:
            mark = str("\xc2\xb0")
            AboutText += _("Processor temperature:\t%s") % tempinfo.replace("\n", "") + mark + "C\n"

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 7
0
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s\n") % about.getChipSetString()

		AboutText += _("CPU:\t%s\n") % about.getCPUString()
		AboutText += _("CPU speed:\t%s\n") % about.getCPUSpeedString()
		AboutText += _("Cores:\t%s\n") % about.getCpuCoresString()
		imageSubBuild = ""
		if getImageType() != 'release':
			imageSubBuild = ".%s" % getImageDevBuild()
		AboutText += _("Build:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title())
		AboutText += _("Skin name:\t%s\n") % config.skin.primary_skin.value[0:-9]

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()

		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()

		AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Last update:\t%s\n\n") % getEnigmaVersionString()

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature: %s%sC\n\n") % (tempinfo.replace('\n', ''), mark)

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 8
0
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")
		if getMachineBrand() == 'Vu+':
			self["lab3"] = StaticText(_("Support at") + " www.vuplus-support.com")
		elif getMachineBrand() == 'Xtrend':
			self["lab3"] = StaticText(_("Support at") + " www.xtrend-support.com")
		elif getMachineBrand() == 'Odin':
			self["lab3"] = StaticText(_("Support at") + " www.odin-support.com")

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n"

		AboutText += _("CPU:\t%s") % about.getCPUString() + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

		AboutText += _("Version:\t%s") % getImageVersion() + "\n"
		AboutText += _("Build:\t%s") % getImageBuild() + "\n"
		AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s") % driversdate + "\n"

		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature: %s") % tempinfo.replace('\n', '') + mark + "C\n\n"

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 9
0
	def populate(self):
		self["lab1"] = StaticText(_("ViX4E2PROJECT"))
		self["lab2"] = StaticText(_("By ViX4 Antony"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("www.ViX4.com"))

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\t%s\n") % about.getChipSetString()

		AboutText += _("CPU:\t%s\n") % about.getCPUString()
		AboutText += _("CPU Speed:\t%s\n") % about.getCPUSpeedString()
		AboutText += _("Cores/Threads:\t%s\n") % about.getCpuCoresString()

		AboutText += _("Version:\t%s\n") % getImageVersion()
		AboutText += _("Build:\t%s\n") % getImageBuild()
		
		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
		
		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()

		AboutText += _("Last update:\t%s\n\n") % getEnigmaVersionString()

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature: %s%sC\n\n") % (tempinfo.replace('\n', ''), mark)

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 10
0
 def populate(self):
     EGAMIVersion = _('EGAMI %s') % about.getImageVersionString()
     self['lab1'] = Label(EGAMIVersion)
     model = None
     AboutText = ''
     AboutText += _('Model:\t%s %s\n') % (getMachineBrand(),
                                          getMachineName())
     if path.exists('/proc/stb/info/chipset'):
         AboutText += _('Chipset:\tBCM%s\n') % about.getChipSetString()
     AboutText += _('CPU:\t%s\n') % about.getCPUString()
     AboutText += _('CPU speed:\t%s\n') % about.getCPUSpeedString()
     AboutText += _('Cores:\t%s\n') % about.getCpuCoresString()
     AboutText += _('Version:\t%s') % EGAMIVersion + '\n'
     AboutText += _('Kernel:\t%s') % about.getKernelVersionString() + '\n'
     AboutText += _('Oe-Core:\t%s') % about.getEnigmaVersionString() + '\n'
     AboutText += _(
         'Skin name:\t%s\n') % config.skin.primary_skin.value[0:-9]
     string = getDriverDate()
     year = string[0:4]
     month = string[4:6]
     day = string[6:8]
     driversdate = '-'.join((year, month, day))
     AboutText += _('Drivers:\t%s') % driversdate + '\n'
     fp_version = getFPVersion()
     if fp_version is None:
         fp_version = ''
     elif fp_version != 0:
         fp_version = _('Front panel:\t%s') % str(fp_version)
         AboutText += fp_version + '\n'
     AboutText += _('Python:\t%s\n') % about.getPythonVersionString()
     AboutText += _('GStreamer:\t%s') % about.getGStreamerVersionString(
     ).replace('GStreamer', '') + '\n'
     AboutText += _('MoDerator:\tRedouane\n') + '\n'
     tempinfo = ''
     if path.exists('/proc/stb/sensors/temp0/value') and getBoxType(
     ) not in 'gbquad':
         f = open('/proc/stb/sensors/temp0/value', 'r')
         tempinfo = f.read()
         f.close()
     elif path.exists(
             '/proc/stb/fp/temp_sensor') and getBoxType() not in 'gbquad':
         f = open('/proc/stb/fp/temp_sensor', 'r')
         tempinfo = f.read()
         f.close()
     if tempinfo and int(tempinfo.replace('\n', '')) > 0:
         mark = str('\xc2\xb0')
         AboutText += _('System temperature: %s') % tempinfo.replace(
             '\n', '') + mark + 'C\n\n'
     AboutText += _('Installed:\t%s\n') % about.getFlashDateString()
     AboutText += _('Last update:\t%s') % getEnigmaVersionString() + '\n\n'
     AboutText += _('WWW:\t%s') % about.getImageUrlString()
     self['AboutScrollLabel'] = ScrollLabel(AboutText)
Esempio n. 11
0
	def populate(self):
		self["lab1"] = StaticText(_("openSWF"))
		self["lab2"] = StaticText(_("Mod Sodo"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.star7arab.com")
		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s") % about.getChipSetString().lower().replace('\n','').replace('bcm','') + "\n"

		AboutText += _("CPU:\t%s") % about.getCPUString() + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

		AboutText += _("Version:\t%s") % getImageVersionString() + "\n"
		AboutText += _("Build:\t%s") % getBuildVersionString() + "\n"
		AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"
                AboutText += _("OpenGL : BroadCom 2.0") + "\n"

		string = getDriverDateString()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s") % driversdate + "\n"

		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n','')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature: %s") % tempinfo.replace('\n','') + mark + "C\n\n"

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 12
0
	def setPolicy43(self, cfgelement):
		print "[VideoMode] setting policy: %s" % cfgelement.value
		arw = "0"
		try:
			if about.getChipSetString() in ('meson-6', 'meson-64'):
				if cfgelement.value == "panscan" : arw = "11"
				if cfgelement.value == "letterbox" : arw = "12"
				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 "setting policy43 failed."
Esempio n. 13
0
	def setPolicy43(self, cfgelement):
		print "[AVSwitch] setting policy: %s" % cfgelement.value
		arw = "0"
		try:
			if about.getChipSetString() in ('meson-6', 'meson-64'):
				if cfgelement.value == "panscan" : arw = "11"
				if cfgelement.value == "letterbox" : arw = "12"
				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."
Esempio n. 14
0
 def populate(self):
     EGAMIVersion = _('EGAMI %s') % about.getImageVersionString()
     self['lab1'] = Label(EGAMIVersion)
     model = None
     AboutText = ''
     AboutText += _('Model:\t%s %s\n') % (getMachineBrand(), getMachineName())
     if path.exists('/proc/stb/info/chipset'):
         AboutText += _('Chipset:\tBCM%s\n') % about.getChipSetString()
     AboutText += _('CPU:\t%s\n') % about.getCPUString()
     AboutText += _('CPU speed:\t%s\n') % about.getCPUSpeedString()
     AboutText += _('Cores:\t%s\n') % about.getCpuCoresString()
     AboutText += _('Version:\t%s') % EGAMIVersion + '\n'
     AboutText += _('Kernel:\t%s') % about.getKernelVersionString() + '\n'
     AboutText += _('Oe-Core:\tOe-Alliance 3.4') + '\n'
     AboutText += _('Moderator:\tRedouane') + '\n'
     AboutText += _('Image Type:\t%s\n') % getImageType().title()
     AboutText += _('Skin name:\t%s\n') % config.skin.primary_skin.value[0:-9]
     string = getDriverDate()
     year = string[0:4]
     month = string[4:6]
     day = string[6:8]
     driversdate = '-'.join((year, month, day))
     AboutText += _('Drivers:\t%s') % driversdate + '\n'
     fp_version = getFPVersion()
     if fp_version is None:
         fp_version = ''
     elif fp_version != 0:
         fp_version = _('Front panel:\t%s') % str(fp_version)
         AboutText += fp_version + '\n'
     AboutText += _('Python:\t%s\n') % about.getPythonVersionString()
     AboutText += _('GStreamer:\t%s') % about.getGStreamerVersionString().replace('GStreamer', '') + '\n\n'
     tempinfo = ''
     if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in 'gbquad':
         f = open('/proc/stb/sensors/temp0/value', 'r')
         tempinfo = f.read()
         f.close()
     elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in 'gbquad':
         f = open('/proc/stb/fp/temp_sensor', 'r')
         tempinfo = f.read()
         f.close()
     if tempinfo and int(tempinfo.replace('\n', '')) > 0:
         mark = str('\xc2\xb0')
         AboutText += _('System temperature: %s') % tempinfo.replace('\n', '') + mark + 'C\n\n'
     AboutText += _('Installed:\t%s\n') % about.getFlashDateString()
     AboutText += _('Last update:\t%s') % getEnigmaVersionString() + '\n\n'
     AboutText += _('WWW:\t%s') % about.getImageUrlString()
     self['AboutScrollLabel'] = ScrollLabel(AboutText)
     return
Esempio n. 15
0
	def populate(self, bootLoaderInfo):
		self.list = []

		self.list.append(self.makeHeadingInfoEntry(_("Model:"), "%s %s" % (getMachineBrand(), getMachineName())))

		self.list.append(self.makeEmptyEntry())

		if path.exists('/proc/stb/info/chipset'):
			self.list.append(self.makeInfoEntry(_("Chipset:"), "BCM%s" % about.getChipSetString()))

		self.list.append(self.makeInfoEntry(_("CPU:"), about.getCPUString()))
		self.list.append(self.makeInfoEntry(_("CPU Speed:"), about.getCPUSpeedString()))
		self.list.append(self.makeInfoEntry(_("Cores:"), str(about.getCpuCoresString())))

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		self.list.append(self.makeInfoEntry(_("Drivers:"), driversdate))
		self.list.append(self.makeInfoEntry(_("Image:"), about.getImageVersionString()))
		self.list.append(self.makeInfoEntry(_("Kernel:"), about.getKernelVersionString()))
		self.list.append(self.makeInfoEntry(_("Oe-Core:"), about.getEnigmaVersionString()))
		self.list.append(self.makeInfoEntry(_("Bootloader:"), bootLoaderInfo))

		fp_version = getFPVersion()
		if fp_version is not None:
			self.list.append(self.makeInfoEntry(_("Front Panel:"), "%d" % fp_version))

		self.list.append(self.makeEmptyEntry())
		self.list.append(self.makeInfoEntry(_("Last Upgrade:"), about.getLastUpdateString()))
		self.list.append(self.makeEmptyEntry())
		self.list.append(self.makeInfoEntry(_("WWW:"), about.getImageUrlString()))

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			tempinfo = file('/proc/stb/sensors/temp0/value').read()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			tempinfo = file('/proc/stb/fp/temp_sensor').read()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			self.list.append(self.makeInfoEntry(_("System temperature:"), tempinfo.replace('\n', '') + mark + "C"))

		self.list.append(self.makeInfoEntry(_("GStreamer:"), about.getGStreamerVersionString().replace("GStreamer", "").strip()))
		self.list.append(self.makeInfoEntry(_("Python:"), about.getPythonVersionString()))

		self["list"].updateList(self.list)
Esempio n. 16
0
 def populate(self):
     EGAMIVersion = _("EGAMI %s") % about.getImageVersionString()
     self["lab1"] = Label(EGAMIVersion)
     model = None
     AboutText = ""
     AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())
     if path.exists("/proc/stb/info/chipset"):
         AboutText += _("Chipset:\tBCM%s\n") % about.getChipSetString()
     AboutText += _("CPU:\t%s\n") % about.getCPUString()
     AboutText += _("CPU Speed:\t%s\n") % about.getCPUSpeedString()
     AboutText += _("Cores:\t%s\n") % about.getCpuCoresString()
     AboutText += _("Version:\t%s") % EGAMIVersion + "\n"
     AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"
     AboutText += _("Oe-Core:\t%s") % about.getEnigmaVersionString() + "\n"
     AboutText += _("Image Type:\t%s\n") % getImageType().title()
     AboutText += _("Image Coder:\tSODO\n")
     string = getDriverDate()
     year = string[0:4]
     month = string[4:6]
     day = string[6:8]
     driversdate = "-".join((year, month, day))
     AboutText += _("Drivers:\t%s") % driversdate + "\n"
     fp_version = getFPVersion()
     if fp_version is None:
         fp_version = ""
     elif fp_version != 0:
         fp_version = _("Front panel:\t%s") % str(fp_version)
         AboutText += fp_version + "\n"
     AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
     AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString().replace("GStreamer", "") + "\n\n"
     tempinfo = ""
     if path.exists("/proc/stb/sensors/temp0/value") and getBoxType() not in "gbquad":
         f = open("/proc/stb/sensors/temp0/value", "r")
         tempinfo = f.read()
         f.close()
     elif path.exists("/proc/stb/fp/temp_sensor") and getBoxType() not in "gbquad":
         f = open("/proc/stb/fp/temp_sensor", "r")
         tempinfo = f.read()
         f.close()
     if tempinfo and int(tempinfo.replace("\n", "")) > 0:
         mark = str("\xc2\xb0")
         AboutText += _("System temperature: %s") % tempinfo.replace("\n", "") + mark + "C\n\n"
     AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
     AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"
     AboutText += _("WWW:\t%s") % about.getImageUrlString()
     self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 17
0
 def setPolicy43(self, cfgelement):
     print '[VideoHardware] setting policy: %s' % cfgelement.value
     arw = '0'
     try:
         if about.getChipSetString() in 'meson-6':
             if cfgelement.value == 'panscan':
                 arw = '11'
             if cfgelement.value == 'letterbox':
                 arw = '12'
             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 '[VideoHardware] setting policy43 failed.'
Esempio n. 18
0
 def setPolicy43(self, cfgelement):
     print '[VideoHardware] setting policy: %s' % cfgelement.value
     arw = '0'
     try:
         if about.getChipSetString() in ('meson-6', 'meson-64'):
             if cfgelement.value == 'panscan':
                 arw = '11'
             if cfgelement.value == 'letterbox':
                 arw = '12'
             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 '[VideoHardware] setting policy43 failed.'
Esempio n. 19
0
 def populate(self):
     self['lab1'] = StaticText(
         _('Version:\t%s') % getImageVersion() + _(' %s') % getImageBuild())
     self['lab2'] = StaticText(_('By REDOUANE'))
     model = None
     AboutText = ''
     self['lab3'] = StaticText(_('Support at') + ' www.pkteam.pl')
     AboutText += _('Model:\t%s %s\n') % (getMachineBrand(),
                                          getMachineName())
     if path.exists('/proc/stb/info/chipset'):
         AboutText += _('Chipset:\tBCM%s') % about.getChipSetString() + '\n'
     AboutText += _('CPU:\t%s') % about.getCPUString() + '\n'
     AboutText += _('Cores:\t%s') % about.getCpuCoresString() + '\n'
     AboutText += _('Version:\t%s') % getImageVersion() + '\n'
     AboutText += _('Build:\t%s') % getImageBuild() + '\n'
     AboutText += _('Kernel:\t%s') % about.getKernelVersionString() + '\n'
     AboutText += _('OPENGL:\tGLS BroadCom V2.0') + '\n'
     string = getDriverDate()
     year = string[0:4]
     month = string[4:6]
     day = string[6:8]
     driversdate = '-'.join((year, month, day))
     AboutText += _('Drivers:\t%s') % driversdate + '\n'
     AboutText += _('Last update:\t%s') % getEnigmaVersionString() + '\n\n'
     fp_version = getFPVersion()
     if fp_version is None:
         fp_version = ''
     elif fp_version != 0:
         fp_version = _('Frontprocessor version: %d') % fp_version
         AboutText += fp_version + '\n'
     tempinfo = ''
     if path.exists('/proc/stb/sensors/temp0/value'):
         f = open('/proc/stb/sensors/temp0/value', 'r')
         tempinfo = f.read()
         f.close()
     elif path.exists('/proc/stb/fp/temp_sensor'):
         f = open('/proc/stb/fp/temp_sensor', 'r')
         tempinfo = f.read()
         f.close()
     if tempinfo and int(tempinfo.replace('\n', '')) > 0:
         mark = str('\xc2\xb0')
         AboutText += _('System temperature: %s') % tempinfo.replace(
             '\n', '') + mark + 'C\n\n'
     self['AboutScrollLabel'] = ScrollLabel(AboutText)
Esempio n. 20
0
 def populate(self):
     self['lab1'] = StaticText(_('Version:\t%s') % getImageVersion() + _(' %s') % getImageBuild())
     self['lab2'] = StaticText(_('By REDOUANE'))
     model = None
     AboutText = ''
     self['lab3'] = StaticText(_('Support at') + ' www.pkteam.pl')
     AboutText += _('Model:\t%s %s\n') % (getMachineBrand(), getMachineName())
     if path.exists('/proc/stb/info/chipset'):
         AboutText += _('Chipset:\tBCM%s') % about.getChipSetString() + '\n'
     AboutText += _('CPU:\t%s') % about.getCPUString() + '\n'
     AboutText += _('Cores:\t%s') % about.getCpuCoresString() + '\n'
     AboutText += _('Version:\t%s') % getImageVersion() + '\n'
     AboutText += _('Build:\t%s') % getImageBuild() + '\n'
     AboutText += _('Kernel:\t%s') % about.getKernelVersionString() + '\n'
     AboutText += _('OPENGL:\tGLS BroadCom V2.0') + '\n'
     string = getDriverDate()
     year = string[0:4]
     month = string[4:6]
     day = string[6:8]
     driversdate = '-'.join((year, month, day))
     AboutText += _('Drivers:\t%s') % driversdate + '\n'
     AboutText += _('Last update:\t%s') % getEnigmaVersionString() + '\n\n'
     fp_version = getFPVersion()
     if fp_version is None:
         fp_version = ''
     elif fp_version != 0:
         fp_version = _('Frontprocessor version: %d') % fp_version
         AboutText += fp_version + '\n'
     tempinfo = ''
     if path.exists('/proc/stb/sensors/temp0/value'):
         f = open('/proc/stb/sensors/temp0/value', 'r')
         tempinfo = f.read()
         f.close()
     elif path.exists('/proc/stb/fp/temp_sensor'):
         f = open('/proc/stb/fp/temp_sensor', 'r')
         tempinfo = f.read()
         f.close()
     if tempinfo and int(tempinfo.replace('\n', '')) > 0:
         mark = str('\xc2\xb0')
         AboutText += _('System temperature: %s') % tempinfo.replace('\n', '') + mark + 'C\n\n'
     self['AboutScrollLabel'] = ScrollLabel(AboutText)
Esempio n. 21
0
	def __init__(self, session):
		Screen.__init__(self, session)

		AboutText = _("Hardware: ") + about.getHardwareTypeString() + "\n"
		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset: BCM%s") % about.getChipSetString().lower().replace('\n','').replace('bcm','') + "\n"
		AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"
		AboutText += _("Drivers: ") + about.getDriversVersionString() + "\n"
		AboutText += _("Image: ") + about.getImageVersionString() + "\n"
		AboutText += _("Kernel Version: ") + about.getKernelVersionString() + "\n"
		
		EnigmaVersion = _("GUI: ") + about.getEnigmaVersionString()
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		AboutText += EnigmaVersion + "\n"

		ImageVersion = _("Last Upgrade: ") + about.getLastUpdateString()
		
		magicVersion = "magic " + about.getImageVersionString()
		
		self["magicVersion"] = Label(magicVersion)
		AboutText += ImageVersion + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		else:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		self["FPVersion"] = StaticText(fp_version)

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n','')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System Temperature:") + " " + tempinfo.replace('\n','') + mark + "C\n\n"

		self["TranslationHeader"] = StaticText(_("Translation:"))

		# don't remove the string out of the _(), or it can't be "translated" anymore.
		# TRANSLATORS: Add here whatever should be shown in the "translator" about screen, up to 6 lines (use \n for newline)
		info = _("TRANSLATOR_INFO")

		if info == _("TRANSLATOR_INFO"):
			info = ""

		infolines = _("").split("\n")
		infomap = {}
		for x in infolines:
			l = x.split(': ')
			if len(l) != 2:
				continue
			(type, value) = l
			infomap[type] = value

		translator_name = infomap.get("Language-Team", "none")
		if translator_name == "none":
			translator_name = infomap.get("Last-Translator", "")

		self["FPVersion"] = StaticText(fp_version)

		self["TunerHeader"] = StaticText(_("Detected NIMs:"))

		nims = nimmanager.nimList()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")

		self["HDDHeader"] = StaticText(_("Detected HDD:"))

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += "%s\n(%s, %d GB %s)" % (hdd.model(), hdd.capacity(), hdd.free()/1024, _("free"))
				else:
					hddinfo += "%s\n(%s, %d MB %s)" % (hdd.model(), hdd.capacity(), hdd.free(), _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
	
		ImageUrl = _("WWW: ") + about.getImageUrlString()
		self["ImageUrl"] = StaticText(ImageUrl)
		AboutText += ImageUrl + "\n"
		
		self["AboutScrollLabel"] = ScrollLabel(AboutText)

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"], 
			{
				"cancel": self.close,
				"ok": self.close,
				"green": self.showTranslationInfo,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})
Esempio n. 22
0
File: About.py Progetto: trunca/pena
    def __init__(self, session):
        Screen.__init__(self, session)
        hddsplit = skin.parameters.get("AboutHddSplit", 0)

        #AboutHddSplit = 0
        #try:
        #	hddsplit = skin.parameters.get("AboutHddSplit",(0))[0]
        #except:
        #	hddsplit = AboutHddSplit

        if boxtype == 'gb800solo':
            BoxName = "GigaBlue HD 800SOLO"
        elif boxtype == 'gb800se':
            BoxName = "GigaBlue HD 800SE"
        elif boxtype == 'gb800ue':
            BoxName = "GigaBlue HD 800UE"
        elif boxtype == 'gbquad':
            BoxName = "GigaBlue Quad"
        elif boxtype == 'gbquad4k':
            BoxName = "GigaBlue Quad 4k"
        elif boxtype == 'gbue4k':
            BoxName = "GigaBlue UE 4k"
        elif boxtype == 'gbquadplus':
            BoxName = "GigaBlue HD Quadplus"
        elif boxtype == 'gb800seplus':
            BoxName = "GigaBlue HD 800SEplus"
        elif boxtype == 'gb800ueplus':
            BoxName = "GigaBlue HD 800UEplus"
        elif boxtype == 'gbipbox':
            BoxName = "GigaBlue IP Box"
        elif boxtype == 'gbultra':
            BoxName = "GigaBlue HD Ultra"
        elif boxtype == 'gbultraue':
            BoxName = "GigaBlue HD Ultra UE"
        elif boxtype == 'gbultraueh':
            BoxName = "GigaBlue HD Ultra UEh"
        elif boxtype == 'gbultrase':
            BoxName = "GigaBlue HD Ultra SE"
        elif boxtype == 'gbx1':
            BoxName = "GigaBlue X1"
        elif boxtype == 'gbx2':
            BoxName = "GigaBlue X2"
        elif boxtype == 'gbx3':
            BoxName = "GigaBlue X3"
        elif boxtype == 'gbx3h':
            BoxName = "GigaBlue X3h"
        elif boxtype == 'spycat':
            BoxName = "XCORE Spycat"
        elif boxtype == 'quadbox2400':
            BoxName = "AX Quadbox HD2400"
        else:
            BoxName = about.getHardwareTypeString()

        self.setTitle(_("About") + " " + BoxName)

        ImageType = about.getImageTypeString()
        self["ImageType"] = StaticText(ImageType)

        Boxserial = popen('cat /proc/stb/info/sn').read().strip()
        serial = ""
        if Boxserial != "":
            serial = ":Serial : " + Boxserial

        AboutHeader = _("About") + " " + BoxName
        self["AboutHeader"] = StaticText(AboutHeader)

        AboutText = BoxName + " - " + ImageType + serial + "\n"

        #AboutText += _("Hardware: ") + about.getHardwareTypeString() + "\n"
        #AboutText += _("CPU: ") + about.getCPUInfoString() + "\n"
        #AboutText += _("Installed: ") + about.getFlashDateString() + "\n"
        #AboutText += _("Image: ") + about.getImageTypeString() + "\n"

        CPUinfo = _("CPU: ") + about.getCPUInfoString()
        self["CPUinfo"] = StaticText(CPUinfo)
        AboutText += CPUinfo + "\n"

        CPUspeed = _("Speed: ") + about.getCPUSpeedString()
        self["CPUspeed"] = StaticText(CPUspeed)
        #AboutText += "(" + about.getCPUSpeedString() + ")\n"

        ChipsetInfo = _("Chipset: ") + about.getChipSetString()
        self["ChipsetInfo"] = StaticText(ChipsetInfo)
        AboutText += ChipsetInfo + "\n"

        AboutText += _(
            "Enigma (re)starts: %d\n") % config.misc.startCounter.value

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        else:
            fp_version = _("Frontprocessor version: %s") % fp_version
            #AboutText += fp_version +"\n"
        self["FPVersion"] = StaticText(fp_version)

        AboutText += "\n"

        KernelVersion = _("Kernel version: ") + about.getKernelVersionString()
        self["KernelVersion"] = StaticText(KernelVersion)
        AboutText += KernelVersion + "\n"

        if getMachineBuild() == 'gb7252':
            b = popen('cat /proc/stb/info/version').read().strip()
            driverdate = str(b[0:4] + '-' + b[4:6] + '-' + b[6:8] + ' ' +
                             b[8:10] + ':' + b[10:12] + ':' + b[12:14])
            AboutText += _("DVB drivers: ") + driverdate + "\n"
        else:
            AboutText += _("DVB drivers: ") + self.realDriverDate() + "\n"
            #AboutText += _("DVB drivers: ") + about.getDriverInstalledDate() + "\n"

        ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
        self["ImageVersion"] = StaticText(ImageVersion)
        AboutText += ImageVersion + "\n"

        EnigmaVersion = _(
            "GUI Build: ") + about.getEnigmaVersionString() + "\n"
        self["EnigmaVersion"] = StaticText(EnigmaVersion)
        #AboutText += EnigmaVersion

        #AboutText += _("Enigma (re)starts: %d\n") % config.misc.startCounter.value

        FlashDate = _("Flashed: ") + about.getFlashDateString()
        self["FlashDate"] = StaticText(FlashDate)
        AboutText += FlashDate + "\n"

        EnigmaSkin = _("Skin: ") + config.skin.primary_skin.value[0:-9]
        self["EnigmaSkin"] = StaticText(EnigmaSkin)
        AboutText += EnigmaSkin + "\n"

        AboutText += _(
            "Python version: ") + about.getPythonVersionString() + "\n"

        GStreamerVersion = _("GStreamer: ") + about.getGStreamerVersionString(
        ).replace("GStreamer", "")
        self["GStreamerVersion"] = StaticText(GStreamerVersion)
        AboutText += GStreamerVersion + "\n"

        twisted = popen('opkg list-installed  |grep -i python-twisted-core'
                        ).read().strip().split(' - ')[1]
        AboutText += "Python-Twisted: " + str(twisted) + "\n"

        AboutText += "\n"
        self["TunerHeader"] = StaticText(_("Detected NIMs:"))
        #AboutText += _("Detected NIMs:") + "\n"

        nims = nimmanager.nimList()
        for count in range(len(nims)):
            if count < 4:
                self["Tuner" + str(count)] = StaticText(nims[count])
            else:
                self["Tuner" + str(count)] = StaticText("")
            AboutText += nims[count] + "\n"

        self["HDDHeader"] = StaticText(_("Detected HDD:"))

        AboutText += "\n"
        #AboutText +=  _("Detected HDD:") + "\n"
        hddlist = harddiskmanager.HDDList()
        hddinfo = ""
        if hddlist:
            formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s:(%s, %.1f %sB %s)"
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += "\n"
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += formatstring % (hdd.model(), hdd.capacity(),
                                               hdd.free() / 1024.0, "G",
                                               _("free"))
                else:
                    hddinfo += formatstring % (hdd.model(), hdd.capacity(),
                                               hdd.free(), "M", _("free"))
        else:
            hddinfo = _("none")
        self["hddA"] = StaticText(hddinfo)
        AboutText += hddinfo

        #AboutText += "\n\n" + _("Network Info")
        #for x in about.GetIPsFromNetworkInterfaces():
        #	AboutText += "\n" + iNetwork.getFriendlyAdapterDescription(x[0]) + " :" + "/dev/" + x[0] + " " + x[1]

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
        self["key_green"] = Button(_("Translations"))
        self["key_red"] = Button(_("Latest Commits"))
        self["key_yellow"] = Button(_("Troubleshoot"))
        self["key_blue"] = Button(_("Memory Info"))
        self["key_info"] = Button(_("Contact Info"))
        self["actions"] = ActionMap(
            ["ColorActions", "SetupActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "red": self.showCommits,
                "green": self.showTranslationInfo,
                "blue": self.showMemoryInfo,
                "info": self.showContactInfo,
                "yellow": self.showTroubleshoot,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
Esempio n. 23
0
#!/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.
Esempio n. 24
0
    def populate(self):
        self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
        self["lab2"] = StaticText(_("By Team ViX"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(
            _("Support at") + " www.world-of-satellite.com")

        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(),
                                             getMachineName())

        if about.getChipSetString() != _("unavailable"):
            if SystemInfo["HasHiSi"]:
                AboutText += _("Chipset:\tHiSilicon %s\n"
                               ) % about.getChipSetString().upper()
            elif about.getIsBroadcom():
                AboutText += _("Chipset:\tBroadcom %s\n"
                               ) % about.getChipSetString().upper()
            else:
                AboutText += _(
                    "Chipset:\t%s\n") % about.getChipSetString().upper()

        AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(),
                                              about.getCPUSpeedString(),
                                              about.getCpuCoresString())
        imageSubBuild = ""
        if getImageType() != 'release':
            imageSubBuild = ".%s" % getImageDevBuild()
        AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(
        ), getImageBuild(), imageSubBuild, getImageType().title())

        if SystemInfo["canMultiBoot"]:
            image = GetCurrentImage()
            bootmode = ""
            part = ""
            if SystemInfo["canMode12"]:
                bootmode = "bootmode = %s" % GetCurrentImageMode()
            if SystemInfo["HasHiSi"]:
                if image != 0:
                    part = "%s%s" % (SystemInfo["canMultiBoot"][2], image * 2)
                    image += 1
                else:
                    part = "MMC"
                    image += 1
            AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(
                image) + " " + part + " " + bootmode + "\n"

        if getMachineName() in ('ET8500') and path.exists('/proc/mtd'):
            self.dualboot = self.dualBoot()
            if self.dualboot:
                AboutText += _("ET8500 Multiboot: Installed\n")

        skinWidth = getDesktop(0).size().width()
        skinHeight = getDesktop(0).size().height()

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s\n") % driversdate
        AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
        AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString(
        ).replace("GStreamer ", "")
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
        AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
        AboutText += _("Last update:\t%s\n") % getEnigmaVersionString()
        AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
        AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _(
            "  (%s x %s)") % (skinWidth, skinHeight) + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/sensors/temp/value'):
            f = open('/proc/stb/sensors/temp/value', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            f = open('/proc/stb/fp/temp_sensor_avs', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                f = open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                         'r')
                tempinfo = f.read()
                tempinfo = tempinfo[:-4]
                f.close()
            except:
                tempinfo = ""
        elif path.exists('/proc/hisi/msp/pm_cpu'):
            try:
                for line in open('/proc/hisi/msp/pm_cpu').readlines():
                    line = [x.strip() for x in line.strip().split(":")]
                    if line[0] in ("Tsensor"):
                        temp = line[1].split("=")
                        temp = line[1].split(" ")
                        tempinfo = temp[2]
            except:
                tempinfo = ""
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("Processor temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"
        AboutLcdText = AboutText.replace('\t', ' ')

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("FP version:\t%s") % fp_version
            AboutText += fp_version + "\n"

        bootloader = ""
        if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
            f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
            bootloader = f.readline().replace('\x00', '').replace('\n', '')
            f.close()
            AboutText += _("Bootloader:\t%s\n") % (bootloader)

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 25
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["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 ('7241', '7358', '7362', '7346', '7356', '7424', '7425', '7435',
                '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().startswith('vu') or (getBoxType() in ('dm500hd', 'dm800')):
        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 (
            'et4x00', 'xp1000', 'tm2t', 'tmsingle', 'vusolo2', 'tmnano',
            'iqonios300hd', 'odinm7', 'e3hd', 'dm500hdv2', 'dm500hd', 'dm800',
            'ebox7358', 'eboxlumi', 'ebox5100', 'ixusszero', 'optimussos1',
            'enfinity', 'uniboxhd1'):
        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

        mode_etc = None
        if os.path.exists('/proc/stb/video/videomode_50hz') and getBoxType(
        ) not in ('gb800solo', 'gb800se', 'gb800ue'):
            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 ('gb800solo', 'gb800se', 'gb800ue'):
            f = open("/proc/stb/video/videomode_60hz", "w")
            f.write(mode_60)
            f.close()
        try:
            mode_etc = modes.get(int(rate[:2]))
            f = open("/proc/stb/video/videomode", "w")
            f.write(mode_etc)
            f.close()
        except:  # not support 50Hz, 60Hz for 1080p
            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 "setting 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)
        # self.updateAspect(None)

    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)
        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
Esempio n. 26
0
    def imageInfo(self):
        AboutText = _("Full Image Backup ")
        AboutText += _("By openATV Image Team") + "\n"
        AboutText += _("Support at") + " www.opena.tv\n\n"
        AboutText += _("[Image Info]\n")
        AboutText += _("Model: %s %s\n") % (getMachineBrand(),
                                            getMachineName())
        AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d",
                                                       localtime(self.START))

        if path.exists('/proc/stb/info/chipset'):
            AboutText += _("Chipset: BCM%s") % about.getChipSetString().lower(
            ).replace('\n', '').replace('bcm', '') + "\n"

        AboutText += _("CPU: %s") % about.getCPUString() + "\n"
        AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"

        AboutText += _("Version: %s") % getImageVersionString() + "\n"
        AboutText += _("Build: %s") % getBuildVersionString() + "\n"
        AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n"

        string = getDriverDateString()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s") % driversdate + "\n"

        AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

        AboutText += _("[Enigma2 Settings]\n")
        AboutText += commands.getoutput("cat /etc/enigma2/settings")
        AboutText += _("\n\n[User - bouquets (TV)]\n")
        try:
            f = open("/etc/enigma2/bouquets.tv", "r")
            lines = f.readlines()
            f.close()
            for line in lines:
                if line.startswith("#SERVICE:"):
                    bouqet = line.split()
                    if len(bouqet) > 3:
                        bouqet[3] = bouqet[3].replace('"', '')
                        f = open("/etc/enigma2/" + bouqet[3], "r")
                        userbouqet = f.readline()
                        AboutText += userbouqet.replace('#NAME ', '')
                        f.close()
        except:
            AboutText += "Error reading bouquets.tv"

        AboutText += _("\n[User - bouquets (RADIO)]\n")
        try:
            f = open("/etc/enigma2/bouquets.radio", "r")
            lines = f.readlines()
            f.close()
            for line in lines:
                if line.startswith("#SERVICE:"):
                    bouqet = line.split()
                    if len(bouqet) > 3:
                        bouqet[3] = bouqet[3].replace('"', '')
                        f = open("/etc/enigma2/" + bouqet[3], "r")
                        userbouqet = f.readline()
                        AboutText += userbouqet.replace('#NAME ', '')
                        f.close()
        except:
            AboutText += "Error reading bouquets.radio"

        AboutText += _("\n[Installed Plugins]\n")
        AboutText += commands.getoutput(
            "opkg list_installed | grep enigma2-plugin-")

        return AboutText
Esempio n. 27
0
class AVSwitch:
    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 about.getChipSetString() in ('5272s', '7251', '7251s', '7252', '7252s',
                                    '7366', '7376', '7444s', '72604'):
        modes["HDMI"] = [
            "720p", "1080p", "2160p", "1080i", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"720p", "1080p", "2160p", "1080i"}
    elif about.getChipSetString() in ('7241', '7356', '73565', '7358', '7362',
                                      '73625', '7424', '7435', '7425', '7552'):
        modes["HDMI"] = [
            "720p", "1080p", "1080i", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"720p", "1080p", "1080i"}
    else:
        modes["HDMI"] = [
            "720p", "1080p", "2160p", "1080i", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"720p", "1080p", "2160p", "1080i"}

    modes["YPbPr"] = modes["HDMI"]

    if getBrandOEM() == 'vuplus' and getBoxType() not in (
            'vusolo4k', 'vuuno4k', 'vuuno4kse', 'vuzero4k', 'vuultimo4k'):
        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"]

    # Machines that do not have component video (red, green and blue RCA sockets).
    no_YPbPr = ('dm500hd', 'dm500hdv2', 'dm800', 'dm520', 'dm525', 'dm7080',
                'dm820', 'dm900', 'e3hd', 'ebox7358', 'eboxlumi', 'ebox5100',
                'enfinity', 'et4x00', 'formuler4turbo', 'gbquad4k', 'gbue4k',
                'gbx1', 'gbx3', 'iqonios300hd', 'ixusszero', 'mbmicro',
                'mbmicrov2', 'mbtwinplus', 'mutant11', 'mutant51',
                'mutant500c', 'mutant1200', 'mutant1500', 'odimm7',
                'optimussos1', 'osmega', 'osmini', 'osminiplus', 'osnino',
                'sf128', 'sf138', 'sf4008', 'tm2t', 'tmnano', 'tmnano2super',
                'tmnano3t', 'tmnanose', 'tmnanosecombo', 'tmnanoseplus',
                'tmnanosem2', 'tmnanosem2plus', 'tmnanom3', 'tmsingle',
                'tmtwin4k', 'uniboxhd1', 'vusolo2', 'vuzero4k', 'vusolo4k',
                'vuuno4k', 'vuuno4kse', 'vuultimo4k', 'xp1000')

    # Machines that have composite video (yellow RCA socket) but do not have Scart.
    yellow_RCA_no_scart = ('formuler1', 'formuler1tc', 'formuler4turbo',
                           'gb800ueplus', 'gbultraue', 'mbmicro', 'mbmicrov2',
                           'mbtwinplus', 'mutant11', 'mutant500c', 'osmega',
                           'osmini', 'osminiplus', 'sf138', 'tmnano',
                           'tmnanose', 'tmnanosecombo', 'tmnanosem2',
                           'tmnanoseplus', 'tmnanosem2plus', 'tmnano2super',
                           'tmnano3t', 'xpeedlx3')

    # Machines that have neither yellow RCA nor Scart sockets
    no_yellow_RCA__no_scart = ('dm900', 'et5x00', 'et6x00', 'gbquad',
                               'gbquad4k', 'gbue4k', 'gbx1', 'gbx3',
                               'ixussone', 'mutant51', 'mutant1500', 'osnino',
                               'sf4008', 'tmnano2t', 'tmnanom3', 'tmtwin4k',
                               'vuzero4k', 'vusolo4k', 'vuuno4k', 'vuuno4kse',
                               'vuultimo4k')

    if "YPbPr" in modes and getBoxType() in no_YPbPr:
        del modes["YPbPr"]

    if "Scart" in modes and getBoxType() in yellow_RCA_no_scart:
        modes["RCA"] = modes["Scart"]
        del modes["Scart"]

    if "Scart" in modes and getBoxType() in 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 ('gbquadplus', 'gb800solo', 'gb800se', 'gb800ue',
                  'gb800ueplus'):
            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 ('gbquadplus', 'gb800solo', 'gb800se', 'gb800ue',
                  'gb800ueplus'):
            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"
        if os.path.exists("/proc/stb/denc/0/wss"):
            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
Esempio n. 28
0
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

        if about.getChipSetString() in ('7111'):
            config.av.bypass_edid_checking = ConfigSelection(
                choices={
                    "00000000": _("off"),
                    "00000001": _("on")
                },
                default="00000001")
        else:
            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()
Esempio n. 29
0
def InitAVSwitch():
	if getBoxType() == 'vuduo' or getBoxType().startswith('ixuss'):
		config.av.yuvenabled = ConfigBoolean(default=False)
	else:
		config.av.yuvenabled = ConfigBoolean(default=True)
	config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))  # Make openATV compatible with some plugins who still use config.av.osd_alpha
	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 = ConfigEnableDisable()
	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)

	# SD - 480 / 576, standard definition
	# ED - 720, enhanced definition
	# HD - 1080, high definition

	# Supported conversions:
	#    * -> 1080i60, 720p60, 480i60, 480p60
	# *?50 -> 1080i50, 720p50, 576i50, 576p50
	# *p25 -> 1080i50, 720p50, 576i50, 576p50 (1080p25 ?)
	# *p30 -> 1080p30
	# *p24 -> 1080p24

	if iAVSwitch.supports1080p:
		conv_60 = ["1080p", "1080i", "720p", "480p", "480i"]
		conv_50 = ["1080p50", "1080i50", "720p50", "576p", "576i"] + conv_60
	else:
		conv_60 = ["1080i", "720p", "480p", "480i"]
		conv_50 = ["1080i50", "720p50", "576p", "576i"] + conv_60
	conv_30 = ["1080p30"] + conv_60
	conv_24 = ["1080p24"] + conv_60

	config.av.autores_sd24 = ConfigSelection(choices=conv_24)
	config.av.autores_sd25 = ConfigSelection(choices=conv_50)
	config.av.autores_sd30 = ConfigSelection(choices=conv_30)
	config.av.autores_sd50i = ConfigSelection(choices=conv_50)
	config.av.autores_sd50p = ConfigSelection(choices=conv_50)
	config.av.autores_sd60i = ConfigSelection(choices=conv_60)
	config.av.autores_sd60p = ConfigSelection(choices=conv_60)
	config.av.autores_ed24 = ConfigSelection(choices=conv_24)
	config.av.autores_ed25 = ConfigSelection(choices=conv_50)
	config.av.autores_ed30 = ConfigSelection(choices=conv_30)
	config.av.autores_ed50 = ConfigSelection(choices=conv_50)
	config.av.autores_ed60 = ConfigSelection(choices=conv_60)
	config.av.autores_hd24 = ConfigSelection(choices=conv_24)
	config.av.autores_hd25 = ConfigSelection(choices=conv_50)
	config.av.autores_hd30 = ConfigSelection(choices=conv_30)
	config.av.autores_hd50 = ConfigSelection(choices=conv_50)
	config.av.autores_hd60 = ConfigSelection(choices=conv_60)

	# some boxes do not support YPbPr
	try:
		config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="yuv")
	except:
		config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="cvbs")

	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 == "YPbPr" or getMachineBuild() == 'inihdx':
			iAVSwitch.setColorFormat(3)
		else:
			if getBoxType() == 'et6x00':
				colmap = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}
			elif getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus' or getBoxType().startswith('et'):
				colmap = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
			else:
				colmap = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
			iAVSwitch.setColorFormat(colmap[configElement.value])
	config.av.colorformat.addNotifier(setColorFormat)

	def setAspectRatio(configElement):
		iAVSwitch.setAspectRatio({
			"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
		}[configElement.value])

	iAVSwitch.setInput("ENCODER")  # init on startup
	if (getBoxType() in (
		'gbquad', 'gbquadplus', 'et5x00', 'ixussone', 'ixusszero', 'axodin', 'axodinc',
		'starsatlx', 'geniuse3hd', 'evoe3hd', 'axase3', 'axase3c', 'omtimussos1', 'omtimussos2',
		'gb800seplus', 'gb800ueplus')) or about.getModelString() == 'et6000':
		detected = False
	else:
		detected = eAVSwitch.getInstance().haveScartSwitch()

	SystemInfo["ScartSwitch"] = detected

	if os.path.exists("/proc/stb/hdmi/bypass_edid_checking"):
		f = open("/proc/stb/hdmi/bypass_edid_checking", "r")
		can_edidchecking = f.read().strip().split(" ")
		f.close()
	else:
		can_edidchecking = False

	SystemInfo["Canedidchecking"] = can_edidchecking

	if can_edidchecking:
		def setEDIDBypass(configElement):
			try:
				f = open("/proc/stb/hdmi/bypass_edid_checking", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		if about.getChipSetString() in ('7111'):
			config.av.bypass_edid_checking = ConfigSelection(choices={
					"00000000": _("off"),
					"00000001": _("on")},
					default = "00000001")
		else:
			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 os.path.exists("/proc/stb/audio/3d_surround_choices"):
		f = open("/proc/stb/audio/3d_surround_choices", "r")
		can_3dsurround = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround = False

	SystemInfo["Can3DSurround"] = can_3dsurround

	if can_3dsurround:
		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 os.path.exists("/proc/stb/audio/3d_surround_speaker_position_choices"):
		f = open("/proc/stb/audio/3d_surround_speaker_position_choices", "r")
		can_3dsurround_speaker = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround_speaker = False

	SystemInfo["Can3DSpeaker"] = can_3dsurround_speaker

	if can_3dsurround_speaker:
		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 os.path.exists("/proc/stb/audio/avl_choices"):
		f = open("/proc/stb/audio/avl_choices", "r")
		can_autovolume = f.read().strip().split(" ")
		f.close()
	else:
		can_autovolume = False

	SystemInfo["CanAutoVolume"] = can_autovolume

	if can_autovolume:
		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()

	try:
		can_pcm_multichannel = os.access("/proc/stb/audio/multichannel_pcm", os.W_OK)
	except:
		can_pcm_multichannel = False

	SystemInfo["supportPcmMultichannel"] = can_pcm_multichannel
	if can_pcm_multichannel:
		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)

	try:
		f = open("/proc/stb/audio/ac3_choices", "r")
		choices = f.read().strip()
		f.close()
		can_downmix_ac3 = "downmix" in choices
	except:
		can_downmix_ac3 = False

	SystemInfo["CanDownmixAC3"] = can_downmix_ac3
	if can_downmix_ac3:
		def setAC3Downmix(configElement):
			f = open("/proc/stb/audio/ac3", "w")
			print "[AVSwitch] setting AC3 to %s" % configElement.value and "downmix" or "passthrough"
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
			if SystemInfo.get("supportPcmMultichannel", False) and not configElement.value:
				SystemInfo["CanPcmMultichannel"] = True
			else:
				SystemInfo["CanPcmMultichannel"] = False
				if can_pcm_multichannel:
					config.av.pcm_multichannel.setValue(False)
		config.av.downmix_ac3 = ConfigYesNo(default=True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	try:
		f = open("/proc/stb/audio/aac_choices", "r")
		choices = f.read().strip()
		f.close()
		can_downmix_aac = "downmix" in choices
	except:
		can_downmix_aac = False

	SystemInfo["CanDownmixAAC"] = can_downmix_aac
	if can_downmix_aac:
		def setAACDownmix(configElement):
			f = open("/proc/stb/audio/aac", "w")
			print "[AVSwitch] setting AAC to %s" % configElement.value and "downmix" or "passthrough"
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_aac = ConfigYesNo(default=True)
		config.av.downmix_aac.addNotifier(setAACDownmix)

	if os.path.exists("/proc/stb/audio/aac_transcode_choices"):
		f = open("/proc/stb/audio/aac_transcode_choices", "r")
		can_aactranscode = f.read().strip().split(" ")
		f.close()
	else:
		can_aactranscode = False

	SystemInfo["CanAACTranscode"] = can_aactranscode

	if can_aactranscode:
		def setAACTranscode(configElement):
			f = open("/proc/stb/audio/aac_transcode", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
		config.av.transcodeaac = ConfigSelection(choices=choice_list, default="off")
		config.av.transcodeaac.addNotifier(setAACTranscode)
	else:
		config.av.transcodeaac = ConfigNothing()

	if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
		def setScaler_sharpness(config):
			myval = int(config.value)
			try:
				print "[VideoMode] 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 "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()
Esempio n. 30
0
	def populate(self):
		self["lab1"] = StaticText(_("openHDF by HDF Image Team"))
		self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n"

		cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'"
		cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'"
		try:
			res = popen(cmd).read()
			res2 = popen(cmd2).read()
		except:
			res = ""
			res2 = ""
		cpuMHz = ""
		bogoMIPS = ""
		if res:
			cpuMHz = "" + res.replace("\n", "") + " MHz"
		if res2:
			bogoMIPS = "" + res2.replace("\n", "") 
			
		AboutText += _("CPU:\t%s") % about.getCPUString() + "\n"
		AboutText += _("Clock Speed:\t%s") % cpuMHz + "\n"
		AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

		AboutText += _("HDF Version:\t%s") % getImageVersion() + "\n"
		AboutText += _("HDF Build:\t%s") % getImageBuild() + "\n"
		AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s") % driversdate + "\n"

		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n"
		
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %s") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System Temp:\t%s") % tempinfo.replace('\n', '') + mark + "C\n"
	
		tempinfo = ""
		if path.exists('/proc/stb/fp/temp_sensor_avs'):
			f = open('/proc/stb/fp/temp_sensor_avs', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("Processor Temp:\t%s") % tempinfo.replace('\n', '') + mark + "C\n"
		AboutLcdText = AboutText.replace('\t', ' ')

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 31
0
    def populate(self):
        self["lab1"] = StaticText(_("openHDF by HDF Image Team"))
        self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
        model = None
        AboutText = ""
        self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(),
                                             getMachineName())
        #AboutText += _("Boxtype:\t%s\n") % getBoxType()

        if path.exists('/proc/stb/info/chipset'):
            AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n"

        cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'"
        cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'"
        try:
            res = popen(cmd).read()
            res2 = popen(cmd2).read()
        except:
            res = ""
            res2 = ""
        cpuMHz = ""

        bootloader = ""
        if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
            f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
            bootloader = f.readline().replace('\x00', '').replace('\n', '')
            f.close()
        BootLoaderVersion = 0
        try:
            if bootloader:
                AboutText += _("Bootloader:\t%s\n") % (bootloader)
                BootLoaderVersion = int(bootloader[1:])
        except:
            BootLoaderVersion = 0

        if getMachineBuild() in ('vusolo4k'):
            cpuMHz = "1,5 GHz"
        elif getMachineBuild() in ('hd52', 'hd51', 'sf4008'):
            try:
                import binascii
                f = open(
                    '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency',
                    'rb')
                clockfrequency = f.read()
                f.close()
                cpuMHz = "%s MHz" % str(
                    round(
                        int(binascii.hexlify(clockfrequency), 16) / 1000000,
                        1))
            except:
                cpuMHz = "1,7 GHz"
        else:
            if path.exists('/proc/cpuinfo'):
                f = open('/proc/cpuinfo', 'r')
                temp = f.readlines()
                f.close()
                try:
                    for lines in temp:
                        lisp = lines.split(': ')
                        if lisp[0].startswith('cpu MHz'):
                            #cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
                            cpuMHz = "   (" + str(
                                int(float(lisp[1].replace('\n',
                                                          '')))) + " MHz)"
                            break
                except:
                    pass

        bogoMIPS = ""
        if res:
            cpuMHz = "" + res.replace("\n", "") + " MHz"
        if res2:
            bogoMIPS = "" + res2.replace("\n", "")

        if getMachineBuild() in ('vusolo4k', 'hd51', 'hd52', 'sf4008'):
            AboutText += _(
                "CPU:\t") + "ARM Dual core " + " (" + cpuMHz + ")" + "\n"
        else:
            AboutText += _(
                "CPU:\t%s") % about.getCPUString() + " (" + cpuMHz + ")" + "\n"
        dMIPS = 0
        if getMachineBuild() in ('vusolo4k'):
            dMIPS = "10.500"
        elif getMachineBuild() in ('hd52', 'hd51', 'sf4008'):
            dMIPS = "12.000"
        if getMachineBuild() in ('vusolo4k', 'hd51', 'hd52', 'sf4008'):
            AboutText += _("DMIPS:\t") + dMIPS + "\n"
        else:
            AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"
        AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
        AboutText += _("HDF Version:\tV%s") % getImageVersion(
        ) + " - Build # " + getImageBuild() + "\n"
        AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString(
        ) + " (" + getBoxType() + ")" + "\n"
        imagestarted = ""
        bootname = ''
        if path.exists('/boot/bootname'):
            f = open('/boot/bootname', 'r')
            bootname = f.readline().split('=')[1]
            f.close()

        if path.exists('/boot/STARTUP'):
            f = open('/boot/STARTUP', 'r')
            f.seek(22)
            image = f.read(1)
            f.close()
            if bootname: bootname = "   (%s)" % bootname
            AboutText += _(
                "Image started:\t%s") % "STARTUP_" + image + bootname + "\n"

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s") % driversdate + "\n"
        AboutText += _(
            "GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
        AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n"
        AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
        AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
        AboutText += _("Network:")
        for x in about.GetIPsFromNetworkInterfaces():
            AboutText += "\t" + x[0] + ": " + x[1] + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Frontprocessor version: %s") % fp_version
            AboutText += fp_version + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/sensors/temp/value'):
            f = open('/proc/stb/sensors/temp/value', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System Temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            f = open('/proc/stb/fp/temp_sensor_avs', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("CPU Temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"
        AboutLcdText = AboutText.replace('\t', ' ')

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 32
0
	def __init__(self, session):
		Screen.__init__(self, session)


		AboutText = _("Model: %s %s") % (getMachineBrand(), getMachineName()) + "\n"
		AboutText += _("Image: ") + about.getImageTypeString() + "\n"
		AboutText += _("Kernel version: ") + about.getKernelVersionString() + "\n"                             
                if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset: %s") % about.getChipSetString() + "\n"
                AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"
                AboutText += _("Version: %s") % getImageVersion() + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
                string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers: %s") % driversdate + "\n"
                EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		AboutText += EnigmaVersion + "\n"

		GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString()
		self["GStreamerVersion"] = StaticText(GStreamerVersion)
		AboutText += GStreamerVersion + "\n"

		ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
		self["ImageVersion"] = StaticText(ImageVersion)
		AboutText += ImageVersion + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		else:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		self["FPVersion"] = StaticText(fp_version)

		self["TunerHeader"] = StaticText(_("Detected NIMs:"))
		AboutText += "\n" + _("Detected NIMs:") + "\n"

		nims = nimmanager.nimList()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")
			AboutText += nims[count] + "\n"

		self["HDDHeader"] = StaticText(_("Detected HDD:"))
		AboutText += "\n" + _("Detected HDD:") + "\n"

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += "%s\n(%s, %.1f GB %s)" % (hdd.model(), hdd.capacity(), hdd.free()/1024., _("free"))
				else:
					hddinfo += "%s\n(%s, %d MB %s)" % (hdd.model(), hdd.capacity(), hdd.free(), _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		AboutText += hddinfo
		self["AboutScrollLabel"] = ScrollLabel(AboutText)
		self["key_green"] = Button(_("Translations"))
		self["key_red"] = Button(_("Latest Commits"))
		self["key_yellow"] = Button(_("Memory Info"))

		self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"red": self.showCommits,
				"green": self.showTranslationInfo,
				"yellow": self.showMemoryInfo,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			}, -2)
Esempio n. 33
0
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")}, 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 os.path.exists("/proc/stb/hdmi/bypass_edid_checking"):
		f = open("/proc/stb/hdmi/bypass_edid_checking", "r")
		can_edidchecking = f.read().strip().split(" ")
		f.close()
	else:
		can_edidchecking = False

	SystemInfo["Canedidchecking"] = can_edidchecking

	if can_edidchecking:
		def setEDIDBypass(configElement):
			try:
				f = open("/proc/stb/hdmi/bypass_edid_checking", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		if about.getChipSetString() in ('7111'):
			config.av.bypass_edid_checking = ConfigSelection(choices={
					"00000000": _("off"),
					"00000001": _("on")},
					default = "00000001")
		else:
			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 os.path.exists("/proc/stb/video/hdmi_colorspace"):
		f = open("/proc/stb/video/hdmi_colorspace", "r")
		have_colorspace = f.read().strip().split(" ")
		f.close()
	else:
		have_colorspace = False

	SystemInfo["havecolorspace"] = have_colorspace

	if have_colorspace:
		def setHDMIColorspace(configElement):
			try:
				f = open("/proc/stb/video/hdmi_colorspace", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmicolorspace = ConfigSelection(choices={
				"Edid(auto)": _("Auto"),
				"Hdmi_Rgb": _("RGB"),
				"444": _("YCbCr444"),
				"422": _("YCbCr422"),
				"420": _("YCbCr420")},
				default = "Edid(auto)")
		config.av.hdmicolorspace.addNotifier(setHDMIColorspace)
	else:
		config.av.hdmicolorspace = ConfigNothing()

	if os.path.exists("/proc/stb/video/hdmi_colorimetry"):
		f = open("/proc/stb/video/hdmi_colorimetry", "r")
		have_colorimetry = f.read().strip().split(" ")
		f.close()
	else:
		have_colorimetry = False

	SystemInfo["havecolorimetry"] = have_colorimetry

	if have_colorimetry:
		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 os.path.exists("/proc/stb/video/hdmi_colordepth"):
		f = open("/proc/stb/video/hdmi_colordepth", "r")
		have_HdmiColordepth = f.read().strip().split(" ")
		f.close()
	else:
		have_HdmiColordepth = False

	SystemInfo["havehdmicolordepth"] = have_HdmiColordepth

	if have_HdmiColordepth:
		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 os.path.exists("/proc/stb/hdmi/audio_source"):
		f = open("/proc/stb/hdmi/audio_source", "r")
		can_audiosource = f.read().strip().split(" ")
		f.close()
	else:
		can_audiosource = False

	SystemInfo["Canaudiosource"] = can_audiosource

	if can_audiosource:
		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 os.path.exists("/proc/stb/audio/3d_surround_choices"):
		f = open("/proc/stb/audio/3d_surround_choices", "r")
		can_3dsurround = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround = False

	SystemInfo["Can3DSurround"] = can_3dsurround

	if can_3dsurround:
		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 os.path.exists("/proc/stb/audio/3d_surround_speaker_position_choices"):
		f = open("/proc/stb/audio/3d_surround_speaker_position_choices", "r")
		can_3dsurround_speaker = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround_speaker = False

	SystemInfo["Can3DSpeaker"] = can_3dsurround_speaker

	if can_3dsurround_speaker:
		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 os.path.exists("/proc/stb/audio/avl_choices"):
		f = open("/proc/stb/audio/avl_choices", "r")
		can_autovolume = f.read().strip().split(" ")
		f.close()
	else:
		can_autovolume = False

	SystemInfo["CanAutoVolume"] = can_autovolume

	if can_autovolume:
		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()

	try:
		can_pcm_multichannel = os.access("/proc/stb/audio/multichannel_pcm", os.W_OK)
	except:
		can_pcm_multichannel = False

	SystemInfo["supportPcmMultichannel"] = can_pcm_multichannel
	if can_pcm_multichannel:
		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)

	try:
		f = open("/proc/stb/audio/ac3_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_ac3 = "downmix" in file
	except:
		can_downmix_ac3 = False

	SystemInfo["CanDownmixAC3"] = can_downmix_ac3
	if can_downmix_ac3:
		def setAC3Downmix(configElement):
			f = open("/proc/stb/audio/ac3", "w")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
			if SystemInfo.get("supportPcmMultichannel", False) and not configElement.value:
				SystemInfo["CanPcmMultichannel"] = True
			else:
				SystemInfo["CanPcmMultichannel"] = False
				if can_pcm_multichannel:
					config.av.pcm_multichannel.setValue(False)
		config.av.downmix_ac3 = ConfigYesNo(default = True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	try:
		f = open("/proc/stb/audio/aac_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_aac = "downmix" in file
	except:
		can_downmix_aac = False

	SystemInfo["CanDownmixAAC"] = can_downmix_aac
	if can_downmix_aac:
		def setAACDownmix(configElement):
			f = open("/proc/stb/audio/aac", "w")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_aac = ConfigYesNo(default = True)
		config.av.downmix_aac.addNotifier(setAACDownmix)

	if os.path.exists("/proc/stb/audio/aac_transcode_choices"):
		f = open("/proc/stb/audio/aac_transcode_choices", "r")
		can_aactranscode = f.read().strip().split(" ")
		f.close()
	else:
		can_aactranscode = False

	SystemInfo["CanAACTranscode"] = can_aactranscode

	if can_aactranscode:
		def setAACTranscode(configElement):
			f = open("/proc/stb/audio/aac_transcode", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
		config.av.transcodeaac = ConfigSelection(choices = choice_list, default = "off")
		config.av.transcodeaac.addNotifier(setAACTranscode)
	else:
		config.av.transcodeaac = ConfigNothing()

	if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_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()
Esempio n. 34
0
	def __init__(self, session):
		Screen.__init__(self, session)
		hddsplit, = skin.parameters.get("AboutHddSplit", (0,))

		AboutText = _("Model: %s %s") % (getMachineBrand(), getMachineName()) + "\n"
		AboutText += _("Image: ") + about.getImageTypeString() + "\n"
		AboutText += _("Kernel version: ") + about.getKernelVersionString() + "\n"                             
                if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset: %s") % about.getChipSetString() + "\n"
                AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"
                AboutText += _("Version: %s") % getImageVersion() + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
		if path.exists('/proc/stb/info/release') and getBoxType() in ('et7000', 'et7500', 'et8500'):
			realdriverdate = open("/proc/stb/info/release", 'r')
			for line in realdriverdate:
				tmp = line.strip()
				AboutText += _("Drivers: %s") % tmp + "\n"
			realdriverdate.close()
		else:
			string = getDriverDate()
			year = string[0:4]
			month = string[4:6]
			day = string[6:8]
			driversdate = '-'.join((year, month, day))
			AboutText += _("Drivers: %s") % driversdate + "\n"
                EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		AboutText += EnigmaVersion + "\n"
		AboutText += _("Enigma (re)starts: %d\n") % config.misc.startCounter.value

		GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString().replace("GStreamer","")
		self["GStreamerVersion"] = StaticText(GStreamerVersion)
		AboutText += GStreamerVersion + "\n"

		ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
		self["ImageVersion"] = StaticText(ImageVersion)
		AboutText += ImageVersion + "\n"

		AboutText += _("Python version: ") + about.getPythonVersionString() + "\n" + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = "" 
		else:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		self["FPVersion"] = StaticText(fp_version)
		
		skinWidth = getDesktop(0).size().width()
		skinHeight = getDesktop(0).size().height()
		AboutText += _("Skin Name: %s") % config.skin.primary_skin.value[0:-9] + _("  (%s x %s)") % (skinWidth, skinHeight) + "\n"

		if path.exists('/etc/enigma2/EtRcType'):
		        rfp = open('/etc/enigma2/EtRcType', "r")
		        Remote = rfp.read()
			rfp.close
                        AboutText += _("Remote control type") + _(": ") + Remote + "\n"
                else:
                        AboutText += _("Remote control type") + _(": ") + iRcTypeControl.getBoxType() 
                        
                if path.exists('/proc/stb/ir/rc/type'):
		        fp = open('/proc/stb/ir/rc/type', "r")
		        RcID = fp.read()
			fp.close
                        AboutText += _("Remote control ID") + _(": ") + RcID 
		
                self["TunerHeader"] = StaticText(_("Detected NIMs:"))
		AboutText += "\n" + _("Detected NIMs:") + "\n"

		nims = nimmanager.nimList()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")
			AboutText += nims[count] + "\n"

		self["HDDHeader"] = StaticText(_("Detected HDD:"))
		AboutText += "\n" + _("Detected HDD:") + "\n"

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)"
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free()/1024, "G", _("free"))
				else:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free()/1024, "M", _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		AboutText += hddinfo
		self["AboutScrollLabel"] = ScrollLabel(AboutText)
		
                self["key_green"] = Button(_("Translations"))
		self["key_red"] = Button(_("Latest Commits"))
		self["key_yellow"] = Button(_("Memory Info"))
		self["key_blue"] = Button(_("%s ") % getMachineName() + _("picture"))
                
                self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"red": self.showCommits,
				"green": self.showTranslationInfo,
				"yellow": self.showMemoryInfo,
				"blue": self.showModelPic,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			}, -2)
Esempio n. 35
0
def getAboutText():
    AboutText = ''
    AboutText += _('Model:\t%s %s\n') % (getMachineBrand(), getMachineName())
    if path.exists('/proc/stb/info/chipset'):
        AboutText += _('Chipset:\t%s') % about.getChipSetString() + '\n'
    cpuMHz = ''
    if getBoxType() in 'vusolo4k':
        cpuMHz = '   (1,5 GHz)'
    elif path.exists('/proc/cpuinfo'):
        f = open('/proc/cpuinfo', 'r')
        temp = f.readlines()
        f.close()
        try:
            for lines in temp:
                lisp = lines.split(': ')
                if lisp[0].startswith('cpu MHz'):
                    cpuMHz = '   (' + str(int(float(lisp[1].replace('\n', '')))) + ' MHz)'
                    break

        except:
            pass

    AboutText += _('CPU:\t%s') % about.getCPUString() + cpuMHz + '\n'
    AboutText += _('Cores:\t%s') % about.getCpuCoresString() + '\n'
    AboutText += _('Version:\t%s') % getImageVersion() + '\n'
    AboutText += _('Build:\t%s') % getImageBuild() + '\n'
    AboutText += _('Kernel:\t%s') % about.getKernelVersionString() + '\n'
    string = getDriverDate()
    year = string[0:4]
    month = string[4:6]
    day = string[6:8]
    driversdate = '-'.join((year, month, day))
    AboutText += _('Drivers:\t%s') % driversdate + '\n'
    AboutText += _('GStreamer:\t%s') % about.getGStreamerVersionString() + '\n'
    AboutText += _('Python:\t%s') % about.getPythonVersionString() + '\n'
    AboutText += _('Skin name:\t%s\n') % config.skin.primary_skin.value[0:-9]
    AboutText += _('Installed:\t%s') % about.getFlashDateString() + '\n'
    AboutText += _('Last update:\t%s') % getEnigmaVersionString() + '\n'
    fp_version = getFPVersion()
    if fp_version is None:
        fp_version = ''
    elif fp_version != 0:
        fp_version = _('Frontprocessor version: %s') % fp_version
        AboutText += fp_version + '\n'
    tempinfo = ''
    if path.exists('/proc/stb/sensors/temp0/value'):
        f = open('/proc/stb/sensors/temp0/value', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/fp/temp_sensor'):
        f = open('/proc/stb/fp/temp_sensor', 'r')
        tempinfo = f.read()
        f.close()
    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _('System temperature:\t%s') % tempinfo.replace('\n', '').replace(' ', '') + mark + 'C\n'
    tempinfo = ''
    if path.exists('/proc/stb/fp/temp_sensor_avs'):
        f = open('/proc/stb/fp/temp_sensor_avs', 'r')
        tempinfo = f.read()
        f.close()
    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _('Processor temperature:\t%s') % tempinfo.replace('\n', '').replace(' ', '') + mark + 'C\n'
    AboutLcdText = AboutText.replace('\t', ' ')
    return (AboutText, AboutLcdText)
Esempio n. 36
0
    def populate(self):
        def netspeed():
            netspeed = ""
            for line in popen('ethtool eth0 |grep Speed', 'r'):
                line = line.strip().split(":")
                line = line[1].replace(' ', '')
                netspeed += line
                return str(netspeed)

        def netspeed_eth1():
            netspeed = ""
            for line in popen('ethtool eth1 |grep Speed', 'r'):
                line = line.strip().split(":")
                line = line[1].replace(' ', '')
                netspeed += line
                return str(netspeed)

        def netspeed_ra0():
            netspeed = ""
            for line in popen('iwconfig ra0 | grep Bit | cut -c 20-30', 'r'):
                line = line.strip()
                netspeed += line
                return str(netspeed)

        def netspeed_wlan0():
            netspeed = ""
            for line in popen('iwconfig wlan0 | grep Bit | cut -c 20-30', 'r'):
                line = line.strip()
                netspeed += line
                return str(netspeed)

        def netspeed_wlan1():
            netspeed = ""
            for line in popen('iwconfig wlan1 | grep Bit | cut -c 20-30', 'r'):
                line = line.strip()
                netspeed += line
                return str(netspeed)

        def freeflash():
            freeflash = ""
            for line in popen(
                    "df -mh / | grep -v '^Filesystem' | awk '{print $4}'",
                    'r'):
                line = line.strip()
                freeflash += line
                return str(freeflash)

        self["lab1"] = StaticText(_("openHDF"))
        self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
        model = None
        AboutText = ""
        self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
        AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (
            getMachineBrand(), getMachineName(), getBrandOEM())

        if path.exists('/proc/stb/info/chipset'):
            AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

        cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'"
        cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'"
        try:
            res = popen(cmd).read()
            res2 = popen(cmd2).read()
        except:
            res = ""
            res2 = ""
        cpuMHz = ""

        bootloader = ""
        if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
            f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
            bootloader = f.readline().replace('\x00', '').replace('\n', '')
            f.close()
        BootLoaderVersion = 0
        try:
            if bootloader:
                AboutText += _("Bootloader:\t%s\n") % (bootloader)
                BootLoaderVersion = int(bootloader[1:])
        except:
            BootLoaderVersion = 0

        if getMachineBuild() in ('vusolo4k', 'gbx34k'):
            cpuMHz = "   (1,5 GHz)"
        elif getMachineBuild() in ('u41', 'u42'):
            cpuMHz = "   (1,0 GHz)"
        elif getMachineBuild() in ('vuuno4k', 'dm900', 'gb7252', 'dags7252'):
            cpuMHz = "   (1,7 GHz)"
        elif getMachineBuild() in ('formuler1tc', 'formuler1', 'triplex'):
            cpuMHz = "   (1,3 GHz)"
        elif getMachineBuild() in ('u5', 'u51', 'u52', 'u53', 'u5pvr', 'h9',
                                   'sf8008', 'sf8008s', 'sf8008t', 'hd60',
                                   "hd61", 'i55plus'):
            cpuMHz = "   (1,6 GHz)"
        elif getMachineBuild() in ('sf5008', 'et13000', 'et1x000', 'hd52',
                                   'hd51', 'sf4008', 'vs1500', 'h7', 'osmio4k',
                                   'osmio4kplus', 'osmini4k'):
            try:
                import binascii
                f = open(
                    '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency',
                    'rb')
                clockfrequency = f.read()
                f.close()
                cpuMHz = "%s MHz" % str(
                    round(
                        int(binascii.hexlify(clockfrequency), 16) // 1000000,
                        1))
            except:
                cpuMHz = "1,7 GHz"
        else:
            if path.exists('/proc/cpuinfo'):
                f = open('/proc/cpuinfo', 'r')
                temp = f.readlines()
                f.close()
                try:
                    for lines in temp:
                        lisp = lines.split(': ')
                        if lisp[0].startswith('cpu MHz'):
                            #cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
                            cpuMHz = "   (" + str(
                                int(float(lisp[1].replace('\n',
                                                          '')))) + " MHz)"
                            break
                except:
                    pass

        bogoMIPS = ""
        if res:
            cpuMHz = "" + res.replace("\n", "") + " MHz"
        if res2:
            bogoMIPS = "" + res2.replace("\n", "")

        if getMachineBuild() in ('vusolo4k', 'hd51', 'hd52', 'sf4008', 'dm900',
                                 'h7', 'gb7252', '8100s'):
            AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
        else:
            AboutText += _(
                "CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n"
        dMIPS = 0
        if getMachineBuild() in ('vusolo4k'):
            dMIPS = "10.500"
        elif getMachineBuild() in ('hd52', 'hd51', 'sf4008', 'dm900', 'h7',
                                   'gb7252', '8100s'):
            dMIPS = "12.000"
        if getMachineBuild() in ('vusolo4k', 'hd51', 'hd52', 'sf4008', 'dm900',
                                 'h7', 'gb7252', '8100s'):
            AboutText += _("DMIPS:\t") + dMIPS + "\n"
        else:
            AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/sensors/temp/value'):
            f = open('/proc/stb/sensors/temp/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                f = open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                         'r')
                tempinfo = f.read()
                tempinfo = tempinfo[:-4]
                f.close()
            except:
                tempinfo = ""

        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System Temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            f = open('/proc/stb/fp/temp_sensor_avs', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/power/avs'):
            f = open('/proc/stb/power/avs', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                f = open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                         'r')
                tempinfo = f.read()
                tempinfo = tempinfo[:-4]
                f.close()
            except:
                tempinfo = ""
        elif path.exists('/proc/hisi/msp/pm_cpu'):
            try:
                for line in open('/proc/hisi/msp/pm_cpu').readlines():
                    line = [x.strip() for x in line.strip().split(":")]
                    if line[0] in ("Tsensor"):
                        temp = line[1].split("=")
                        temp = line[1].split(" ")
                        tempinfo = temp[2]
            except:
                tempinfo = ""
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("CPU Temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"

        AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
        AboutText += _("HDF Version:\tV%s") % getImageVersion(
        ) + " Build #" + getImageBuild() + " based on " + getOEVersion() + "\n"
        AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString(
        ) + " (" + getBoxType() + ")" + "\n"

        if path.isfile("/etc/issue"):
            version = open("/etc/issue").readlines()[-2].upper().strip()[:-6]
            if path.isfile("/etc/image-version"):
                build = self.searchString("/etc/image-version", "^build=")
                version = "%s #%s" % (version, build)
            AboutText += _("Image:\t%s") % version + "\n"

        imagestarted = ""
        bootname = ''
        if path.exists('/boot/bootname'):
            f = open('/boot/bootname', 'r')
            bootname = f.readline().split('=')[1]
            f.close()
        if SystemInfo["HasRootSubdir"]:
            image = find_rootfssubdir("STARTUP")
            AboutText += _("Selected Image:\t%s"
                           ) % "STARTUP_" + image[-1:] + bootname + "\n"
        elif getMachineBuild() in ('gbmv200', 'cc1', 'sf8008', 'ustym4kpro',
                                   'beyonwizv2', "viper4k"):
            if path.exists('/boot/STARTUP'):
                f = open('/boot/STARTUP', 'r')
                f.seek(5)
                image = f.read(4)
                if image == "emmc":
                    image = "1"
                elif image == "usb0":
                    f.seek(13)
                    image = f.read(1)
                    if image == "1":
                        image = "2"
                    elif image == "3":
                        image = "3"
                    elif image == "5":
                        image = "4"
                    elif image == "7":
                        image = "5"
                f.close()
                if bootname:
                    bootname = "   (%s)" % bootname
                AboutText += _(
                    "Partition:\t%s") % "STARTUP_" + image + bootname + "\n"
            else:
                f = open('/boot/STARTUP', 'r')
                f.seek(22)
                image = f.read(1)
                f.close()
                if bootname:
                    bootname = "   (%s)" % bootname
                AboutText += _(
                    "Partition:\t%s") % "STARTUP_" + image + bootname + "\n"

        if SystemInfo["HaveMultiBoot"]:
            MyFlashDate = about.getFlashDateString()
            if path.isfile("/etc/filesystems"):
                AboutText += _("Flashed:\t%s") % MyFlashDate + "\n"
                #AboutText += _("Flashed:\tMultiboot active\n")
        else:
            AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32'
        gstcmd2 = os.system(gstcmd)
        #return (gstcmd2)
        AboutText += _("Drivers:\t%s") % driversdate + "\n"
        AboutText += _(
            "GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
        AboutText += _("Free Flash:\t%s\n") % freeflash()
        AboutText += _("Skin:\t%s (%s x %s)\n") % (
            config.skin.primary_skin.value.split('/')[0],
            getDesktop(0).size().width(), getDesktop(0).size().height())
        AboutText += _("Last update:\t%s") % getEnigmaVersionString(
        ) + " to Build #" + getImageBuild() + "\n"
        AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
        AboutText += _("Uptime") + ":\t" + about.getBoxUptime() + "\n"
        if SystemInfo["WakeOnLAN"]:
            if fileCheck("/proc/stb/power/wol"):
                WOLmode = open("/proc/stb/power/wol").read()[:-1]
            if fileCheck("/proc/stb/fp/wol"):
                WOLmode = open("/proc/stb/fp/wol").read()[:-1]
            AboutText += _("WakeOnLAN:\t%s\n") % WOLmode
        AboutText += _("Network:")
        eth0 = about.getIfConfig('eth0')
        eth1 = about.getIfConfig('eth1')
        ra0 = about.getIfConfig('ra0')
        wlan0 = about.getIfConfig('wlan0')
        wlan1 = about.getIfConfig('wlan1')
        if 'addr' in eth0:
            for x in about.GetIPsFromNetworkInterfaces():
                AboutText += "\t" + str(x[0]) + ": " + str(
                    x[1]) + " (" + netspeed() + ")\n"
        elif 'addr' in eth1:
            for x in about.GetIPsFromNetworkInterfaces():
                AboutText += "\t" + str(x[0]) + ": " + str(
                    x[1]) + " (" + netspeed_eth1() + ")\n"
        elif 'addr' in ra0:
            for x in about.GetIPsFromNetworkInterfaces():
                AboutText += "\t" + str(x[0]) + ": " + str(
                    x[1]) + " (~" + netspeed_ra0() + ")\n"
        elif 'addr' in wlan0:
            for x in about.GetIPsFromNetworkInterfaces():
                AboutText += "\t" + str(x[0]) + ": " + str(
                    x[1]) + " (~" + netspeed_wlan0() + ")\n"
        elif 'addr' in wlan1:
            for x in about.GetIPsFromNetworkInterfaces():
                AboutText += "\t" + str(x[0]) + ": " + str(
                    x[1]) + " (~" + netspeed_wlan1() + ")\n"
        else:
            for x in about.GetIPsFromNetworkInterfaces():
                AboutText += "\t" + str(x[0]) + ": " + str(x[1]) + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Frontprocessor:\tVersion %s") % fp_version
            AboutText += fp_version + "\n"

        AboutLcdText = AboutText.replace('\t', ' ')

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 37
0
    def populate(self):
        self["lab1"] = StaticText(_("Open Black Hole"))
        self["lab2"] = StaticText(_("From the BH Team"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(
            _("Support at %s") % "www.vuplus-community.net")

        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(),
                                             getMachineName())

        if about.getChipSetString() != _("unavailable"):
            if SystemInfo["HasHiSi"]:
                AboutText += _("Chipset:\tHiSilicon %s\n"
                               ) % about.getChipSetString().upper()
            elif about.getIsBroadcom():
                AboutText += _("Chipset:\tBroadcom %s\n"
                               ) % about.getChipSetString().upper()
            else:
                AboutText += _(
                    "Chipset:\t%s\n") % about.getChipSetString().upper()

        AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(),
                                              about.getCPUSpeedString(),
                                              about.getCpuCoresString())
        imageSubBuild = ""
        if getImageType() != 'release':
            imageSubBuild = ".%s" % getImageDevBuild()
        AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(
        ), getImageBuild(), imageSubBuild, getImageType().title())

        if SystemInfo["HasH9SD"]:
            if "rootfstype=ext4" in open(
                    '/sys/firmware/devicetree/base/chosen/bootargs',
                    'r').read():
                part = "        - SD card in use for Image root \n"
            else:
                part = "        - eMMC slot in use for Image root \n"
            AboutText += _("%s") % part

        if SystemInfo["canMultiBoot"]:
            slot = image = GetCurrentImage()
            part = "eMMC slot %s" % slot
            bootmode = ""
            if SystemInfo["canMode12"]:
                bootmode = "bootmode = %s" % GetCurrentImageMode()
            print "[About] HasHiSi = %s, slot = %s" % (SystemInfo["HasHiSi"],
                                                       slot)
            if SystemInfo["HasHiSi"] and "sda" in SystemInfo["canMultiBoot"][
                    slot]['root']:
                if slot > 4:
                    image -= 4
                else:
                    image -= 1
                part = "SDcard slot %s (%s) " % (
                    image, SystemInfo["canMultiBoot"][slot]['root'])
            AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(
                slot) + "  " + part + " " + bootmode + "\n"

        skinWidth = getDesktop(0).size().width()
        skinHeight = getDesktop(0).size().height()

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s\n") % driversdate
        AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
        AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString(
        ).replace("GStreamer ", "")
        AboutText += _("FFmpeg:\t%s\n") % about.getFFmpegVersionString(
        ).replace("FFmpeg ", "")
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
        AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
        AboutText += _("Last update:\t%s\n") % getEnigmaVersionString()
        AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
        AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _(
            "  (%s x %s)") % (skinWidth, skinHeight) + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            with open('/proc/stb/sensors/temp0/value', 'r') as f:
                tempinfo = f.read()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            with open('/proc/stb/fp/temp_sensor', 'r') as f:
                tempinfo = f.read()
        elif path.exists('/proc/stb/sensors/temp/value'):
            with open('/proc/stb/sensors/temp/value', 'r') as f:
                tempinfo = f.read()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            with open('/proc/stb/fp/temp_sensor_avs', 'r') as f:
                tempinfo = f.read()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                with open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                          'r') as f:
                    tempinfo = f.read()
                    tempinfo = tempinfo[:-4]
            except:
                tempinfo = ""
        elif path.exists('/proc/hisi/msp/pm_cpu'):
            try:
                tempinfo = search(
                    'temperature = (\d+) degree',
                    open("/proc/hisi/msp/pm_cpu").read()).group(1)
            except:
                tempinfo = ""
        if tempinfo and int(tempinfo) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("Processor temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"
        AboutLcdText = AboutText.replace('\t', ' ')

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("FP version:\t%s") % fp_version
            AboutText += fp_version + "\n"

        bootloader = ""
        if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
            f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
            bootloader = f.readline().replace('\x00', '').replace('\n', '')
            f.close()
            AboutText += _("Bootloader:\t%s\n") % (bootloader)

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 38
0
File: About.py Progetto: ssh1/stbgui
	def __init__(self, session):
		Screen.__init__(self, session)

		hddsplit, = skin.parameters.get("AboutHddSplit", (0,))

		#AboutHddSplit = 0
		#try:
		#	hddsplit = skin.parameters.get("AboutHddSplit",(0))[0]
		#except:
		#	hddsplit = AboutHddSplit

		if boxtype == 'gb800solo':
			BoxName = "GigaBlue HD 800SOLO"
		elif boxtype == 'gb800se':
			BoxName = "GigaBlue HD 800SE"
		elif boxtype == 'gb800ue':
			BoxName = "GigaBlue HD 800UE"
		elif boxtype == 'gbquad':
			BoxName = "GigaBlue HD Quad"
		elif boxtype == 'gbquadplus':
			BoxName = "GigaBlue HD Quadplus"
		elif boxtype == 'gb800seplus':
			BoxName = "GigaBlue HD 800SEplus"
		elif boxtype == 'gb800ueplus':
			BoxName = "GigaBlue HD 800UEplus"
		elif boxtype == 'gbipbox':
			BoxName = "GigaBlue IP Box"
		elif boxtype == 'gbultra':
			BoxName = "GigaBlue HD Ultra"
		elif boxtype == 'gbultraue':
			BoxName = "GigaBlue HD Ultra UE"
		elif boxtype == 'gbultrase':
			BoxName = "GigaBlue HD Ultra SE"
		elif boxtype == 'gbx1':
			BoxName = "GigaBlue X1"
		elif boxtype == 'gbx3':
			BoxName = "GigaBlue X3"
		elif boxtype == 'spycat':
			BoxName = "XCORE Spycat"
		elif boxtype == 'quadbox2400':
			BoxName = "AX Quadbox HD2400"
		else:
			BoxName = about.getHardwareTypeString()

		ImageType = about.getImageTypeString()
		self["ImageType"] = StaticText(ImageType)

		AboutHeader = ImageType + " - " + BoxName
		self["AboutHeader"] = StaticText(AboutHeader)

		AboutText = AboutHeader + "\n"

		#AboutText += _("Hardware: ") + about.getHardwareTypeString() + "\n"
		#AboutText += _("CPU: ") + about.getCPUInfoString() + "\n"
		#AboutText += _("Installed: ") + about.getFlashDateString() + "\n"
		#AboutText += _("Image: ") + about.getImageTypeString() + "\n"

		CPUinfo = _("CPU: ") + about.getCPUInfoString() + "\n"
		self["CPUinfo"] = StaticText(CPUinfo)
		AboutText += CPUinfo + "\n"

		CPUspeed = _("Speed: ") + about.getCPUSpeedString() + "\n"
		self["CPUspeed"] = StaticText(CPUspeed)
		AboutText += CPUspeed + "\n"

		ChipsetInfo = _("Chipset: ") + about.getChipSetString() + "\n"
		self["ChipsetInfo"] = StaticText(ChipsetInfo)
		AboutText += ChipsetInfo + "\n"

		KernelVersion = _("Kernel version: ") + about.getKernelVersionString() + "\n"
		self["KernelVersion"] = StaticText(KernelVersion)
		AboutText += KernelVersion + "\n"

		EnigmaVersion = _("GUI Build: ") + about.getEnigmaVersionString()
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		AboutText += EnigmaVersion + "\n"
		AboutText += _("Enigma (re)starts: %d\n") % config.misc.startCounter.value

		GStreamerVersion = _("GStreamer: ") + about.getGStreamerVersionString().replace("GStreamer","")
		self["GStreamerVersion"] = StaticText(GStreamerVersion)
		AboutText += GStreamerVersion + "\n"

		FlashDate = _("Flashed: ") + about.getFlashDateString()
		self["FlashDate"] = StaticText(FlashDate)
		AboutText += FlashDate + "\n"

		ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
		self["ImageVersion"] = StaticText(ImageVersion)
		AboutText += ImageVersion + "\n"

		AboutText += _("DVB drivers: ") + about.getDriverInstalledDate() + "\n"

		AboutText += _("Python version: ") + about.getPythonVersionString() + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		else:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		self["FPVersion"] = StaticText(fp_version)

		self["TunerHeader"] = StaticText(_("Detected NIMs:"))
		AboutText += "\n" + _("Detected NIMs:") + "\n"

		nims = nimmanager.nimList()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")
			AboutText += nims[count] + "\n"

		self["HDDHeader"] = StaticText(_("Detected HDD:"))
		AboutText += "\n" + _("Detected HDD:") + "\n"

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)"
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free()/1024, "G", _("free"))
				else:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free()/1024, "M", _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		AboutText += hddinfo
		self["AboutScrollLabel"] = ScrollLabel(AboutText)
		self["key_green"] = Button(_("Translations"))
		self["key_red"] = Button(_("Latest Commits"))
		self["key_blue"] = Button(_("Memory Info"))

		self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"red": self.showCommits,
				"green": self.showTranslationInfo,
				"blue": self.showMemoryInfo,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})
Esempio n. 39
0
def getAboutText():
	AboutText = ""
	AboutText += _("Model:\t\t%s %s\n") % (getMachineBrand(), getMachineName())
	AboutText += _("OEM Model:\t\t%s\n") % getMachineBuild()

	bootloader = ""
	if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
		f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
		bootloader = f.readline().replace('\x00', '').replace('\n', '')
		f.close()
		AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

	if path.exists('/proc/stb/info/chipset'):
		AboutText += _("Chipset:\t\t%s") % about.getChipSetString() + "\n"

	cpuMHz = ""
	if getMachineBuild() in ('u41','u42','u43'):
		cpuMHz = _("   (1.0 GHz)")
	elif getMachineBuild() in ('dags72604','vusolo4k','vuultimo4k','vuzero4k','gb72604'):
		cpuMHz = _("   (1.5 GHz)")
	elif getMachineBuild() in ('formuler1tc','formuler1', 'triplex', 'tiviaraplus'):
		cpuMHz = _("   (1.3 GHz)")
	elif getMachineBuild() in ('gbmv200','u51','u5','u53','u532','u533','u52','u54','u55','u56','u5pvr','h9','h9combo','h10','cc1','sf8008','sf8008m','hd60','hd61','i55plus','ustym4kpro','beyonwizv2','viper4k','v8plus','multibox'):
		cpuMHz = _("   (1.6 GHz)")
	elif getMachineBuild() in ('vuuno4kse','vuuno4k','dm900','dm920', 'gb7252', 'dags7252','xc7439','8100s'):
		cpuMHz = _("   (1.7 GHz)")
	elif getMachineBuild() in ('alien5',):
		cpuMHz = _("   (2.0 GHz)")
	elif getMachineBuild() in ('vuduo4k',):
		cpuMHz = _("   (2.1 GHz)")
	elif getMachineBuild() in ('sf5008','et13000','et1x000','hd52','hd51','sf4008','vs1500','h7','osmio4k','osmio4kplus','osmini4k'):
		try:
			import binascii
			f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb')
			clockfrequency = f.read()
			f.close()
			cpuMHz = _("   (%s MHz)") % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1))
		except:
			cpuMHz = _("   (1.7 GHz)")
	else:
		if path.exists('/proc/cpuinfo'):
			f = open('/proc/cpuinfo', 'r')
			temp = f.readlines()
			f.close()
			try:
				for lines in temp:
					lisp = lines.split(': ')
					if lisp[0].startswith('cpu MHz'):
						#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
						cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
						break
			except:
				pass

	AboutText += _("CPU:\t\t%s") % about.getCPUString() + cpuMHz + "\n"
	AboutText += _("Cores:\t\t%s") % about.getCpuCoresString() + "\n"

	imagestarted = ""
	bootname = ''
	if path.exists('/boot/bootname'):
		f = open('/boot/bootname', 'r')
		bootname = f.readline().split('=')[1]
		f.close()
	if SystemInfo["HasRootSubdir"]:
		image = find_rootfssubdir("STARTUP")
		AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + image[-1:] + bootname + "\n"
	elif getMachineBuild() in ('gbmv200','cc1','sf8008','sf8008m','ustym4kpro','beyonwizv2',"viper4k"):
		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(5)
			image = f.read(4)
			if image == "emmc":
				image = "1"
			elif image == "usb0":
				f.seek(13)
				image = f.read(1)
				if image == "1":
					image = "2"
				elif image == "3":
					image = "3"
				elif image == "5":
					image = "4"
				elif image == "7":
					image = "5"
			f.close()
			if bootname: bootname = "   (%s)" %bootname 
			AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + image + bootname + "\n"
	elif getMachineBuild() in ('osmio4k','osmio4kplus','osmini4k'):
		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(38)
			image = f.read(1) 
			f.close()
			if bootname: bootname = "   (%s)" %bootname 
			AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + image + bootname + "\n"
	elif path.exists('/boot/STARTUP'):
		f = open('/boot/STARTUP', 'r')
		f.seek(22)
		image = f.read(1) 
		f.close()
		if bootname: bootname = "   (%s)" %bootname 
		AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + image + bootname + "\n"
	elif path.exists('/boot/cmdline.txt'):
		f = open('/boot/cmdline.txt', 'r')
		f.seek(38)
		image = f.read(1) 
		f.close()
		if bootname: bootname = "   (%s)" %bootname 
		AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + image + bootname + "\n"

	AboutText += _("Version:\t\t%s") % getImageVersion() + "\n"
	AboutText += _("Build:\t\t%s") % getImageBuild() + "\n"
	AboutText += _("Kernel:\t\t%s") % about.getKernelVersionString() + "\n"

	string = getDriverDate()
	year = string[0:4]
	month = string[4:6]
	day = string[6:8]
	driversdate = '-'.join((year, month, day))
	AboutText += _("Drivers:\t\t%s") % MyDateConverter(driversdate) + "\n"

	AboutText += _("GStreamer:\t\t%s") % about.getGStreamerVersionString() + "\n"
	AboutText += _("Python:\t\t%s") % about.getPythonVersionString() + "\n"

	MyFlashDate = about.getFlashDateString()
	if MyFlashDate != _("unknown"):
		AboutText += _("Installed:\t\t%s") % MyFlashDate + "\n"

	AboutText += _("Last update:\t\t%s") % MyDateConverter(getEnigmaVersionString()) + "\n"

	fp_version = getFPVersion()
	if fp_version is None:
		fp_version = ""
	elif fp_version != 0:
		fp_version = _("Frontprocessor version: %s") % fp_version
		AboutText += fp_version + "\n"

	tempinfo = ""
	if path.exists('/proc/stb/sensors/temp0/value'):
		f = open('/proc/stb/sensors/temp0/value', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/fp/temp_sensor'):
		f = open('/proc/stb/fp/temp_sensor', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/sensors/temp/value'):
		f = open('/proc/stb/sensors/temp/value', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		AboutText += _("System temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

	tempinfo = ""
	if path.exists('/proc/stb/fp/temp_sensor_avs'):
		f = open('/proc/stb/fp/temp_sensor_avs', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/power/avs'):
		f = open('/proc/stb/power/avs', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
		try:
			f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
			tempinfo = f.read()
			tempinfo = tempinfo[:-4]
			f.close()
		except:
			tempinfo = ""
	elif path.exists('/proc/hisi/msp/pm_cpu'):
		try:
			for line in open('/proc/hisi/msp/pm_cpu').readlines():
				line = [x.strip() for x in line.strip().split(":")]
				if line[0] in ("Tsensor"):
					temp = line[1].split("=")
					temp = line[1].split(" ")
					tempinfo = temp[2]
					if getMachineBuild() in ('u41','u42','u43'):
						tempinfo = str(int(tempinfo) - 15)
		except:
			tempinfo = ""
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		AboutText += _("Processor temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"
	AboutLcdText = AboutText.replace('\t', ' ')

	return AboutText, AboutLcdText
Esempio n. 40
0
def getAboutText():
	AboutText = ""
	AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

	if path.exists('/proc/stb/info/chipset'):
		AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

	cpuMHz = ""
	if getMachineBuild() in ('vusolo4k', 'hd51'):
		cpuMHz = "   (1,5 GHz)"
	elif getMachineBuild() in ('hd52'):
		cpuMHz = "   (1,7 GHz)"
	else:
		if path.exists('/proc/cpuinfo'):
			f = open('/proc/cpuinfo', 'r')
			temp = f.readlines()
			f.close()
			try:
				for lines in temp:
					lisp = lines.split(': ')
					if lisp[0].startswith('cpu MHz'):
						#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
						cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
						break
			except:
				pass

	AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
	AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

	AboutText += _("Version:\t%s") % getImageVersion() + "\n"
	AboutText += _("Build:\t%s") % getImageBuild() + "\n"
	AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

	string = getDriverDate()
	year = string[0:4]
	month = string[4:6]
	day = string[6:8]
	driversdate = '-'.join((year, month, day))
	AboutText += _("Drivers:\t%s") % driversdate + "\n"

	AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
	AboutText += _("Python:\t%s") % about.getPythonVersionString() + "\n"

	AboutText += _("Installed:\t%s") % about.getFlashDateString() + "\n"
	AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n"

	fp_version = getFPVersion()
	if fp_version is None:
		fp_version = ""
	elif fp_version != 0:
		fp_version = _("Frontprocessor version: %s") % fp_version
		AboutText += fp_version + "\n"

	tempinfo = ""
	if path.exists('/proc/stb/sensors/temp0/value'):
		f = open('/proc/stb/sensors/temp0/value', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/fp/temp_sensor'):
		f = open('/proc/stb/fp/temp_sensor', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/sensors/temp/value'):
		f = open('/proc/stb/sensors/temp/value', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		AboutText += _("System temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

	tempinfo = ""
	if path.exists('/proc/stb/fp/temp_sensor_avs'):
		f = open('/proc/stb/fp/temp_sensor_avs', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		AboutText += _("Processor temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"
	AboutLcdText = AboutText.replace('\t', ' ')

	return AboutText, AboutLcdText
Esempio n. 41
0
	def populate(self):
		self["lab1"] = StaticText(_("openHDF by HDF Image Team"))
		self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
		AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (getMachineBrand(), getMachineName(), getBrandOEM())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n"

		cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'"
		cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'"
		try:
			res = popen(cmd).read()
			res2 = popen(cmd2).read()
		except:
			res = ""
			res2 = ""
		cpuMHz = ""

		bootloader = ""
		if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
			f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
			bootloader = f.readline().replace('\x00', '').replace('\n', '')
			f.close()
		BootLoaderVersion = 0
		try:
			if bootloader:
				AboutText += _("Bootloader:\t%s\n") % (bootloader)
				BootLoaderVersion = int(bootloader[1:])
		except:
			BootLoaderVersion = 0

		if getMachineBuild() in ('vusolo4k'):
			cpuMHz = "   (1,5 GHz)"
		elif getMachineBuild() in ('vuuno4k','dm900','gb7252','dags7252'):
			cpuMHz = "   (1,7 GHz)"
		elif getMachineBuild() in ('formuler1tc','formuler1','triplex'):
			cpuMHz = "   (1,3 GHz)"
		elif getMachineBuild() in ('u5','u51','u52','u53','u5pvr','h9','sf8008'):
			cpuMHz = "   (1,6 GHz)"
		elif getMachineBuild() in ('et1x000','hd52','hd51','sf4008','vs1500','h7','8100s'):
			try:
				import binascii
				f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb')
				clockfrequency = f.read()
				f.close()
				cpuMHz = "%s MHz" % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1))
			except:
				cpuMHz = "1,7 GHz"
		else:
			if path.exists('/proc/cpuinfo'):
				f = open('/proc/cpuinfo', 'r')
				temp = f.readlines()
				f.close()
				try:
					for lines in temp:
						lisp = lines.split(': ')
						if lisp[0].startswith('cpu MHz'):
							#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
							cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
							break
				except:
					pass

		bogoMIPS = ""
		if res:
			cpuMHz = "" + res.replace("\n", "") + " MHz"
		if res2:
			bogoMIPS = "" + res2.replace("\n", "")

		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'):
			AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
		else:
			AboutText += _("CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n"
		dMIPS = 0
		if getMachineBuild() in ('vusolo4k'):
			dMIPS = "10.500"
		elif getMachineBuild() in ('hd52','hd51','sf4008','dm900','h7','gb7252','8100s'):
			dMIPS = "12.000"
		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'):
			AboutText += _("DMIPS:\t") + dMIPS + "\n"
		else:
			AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
		AboutText += _("HDF Version:\tV%s") % getImageVersion() + " Build #" + getImageBuild() + " based on " + getOEVersion() + "\n"
		AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString() + " (" + getBoxType() + ")" + "\n"
		imagestarted = ""
		bootname = ''
		if path.exists('/boot/bootname'):
			f = open('/boot/bootname', 'r')
			bootname = f.readline().split('=')[1]
			f.close()
		if getMachineBuild() in ('cc1','sf8008'):
			if path.exists('/boot/STARTUP'):
				f = open('/boot/STARTUP', 'r')
				f.seek(5)
				image = f.read(4)
				if image == "emmc":
					image = "1"
				elif image == "usb0":
					f.seek(13)
					image = f.read(1)
					if image == "1":
						image = "2"
					elif image == "3":
						image = "3"
					elif image == "5":
						image = "4"
					elif image == "7":
						image = "5"
				f.close()
				if bootname: bootname = "   (%s)" %bootname 
				AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"
		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(22)
			image = f.read(1)
			f.close()
			if bootname: bootname = "   (%s)" %bootname
			AboutText += _("Image started:\t%s") % "STARTUP_" + image + bootname + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32'
		gstcmd2 = os.system(gstcmd)
		#return (gstcmd2)
		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		#AboutText += _("GStreamer:\t%s") % gstcmd2 + "\n"
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + " to Build #" + getImageBuild() + "\n"
		AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		AboutText += _("Network:")
		for x in about.GetIPsFromNetworkInterfaces():
			AboutText += "\t" + x[0] + ": " + x[1] + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor:\tVersion %s") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/sensors/temp/value'):
			f = open('/proc/stb/sensors/temp/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
			if getBoxType() in ('mutant51', 'ax51', 'zgemmah7', 'e4hdultra'):
				tempinfo = ""
			else:
				f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
				tempinfo = f.read()
				tempinfo = tempinfo[:-4]
				f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System Temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

		tempinfo = ""
		if path.exists('/proc/stb/fp/temp_sensor_avs'):
			f = open('/proc/stb/fp/temp_sensor_avs', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
			try:
				f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
				tempinfo = f.read()
				tempinfo = tempinfo[:-4]
				f.close()
			except:
				tempinfo = ""
		elif path.exists('/proc/hisi/msp/pm_cpu'):
			try:
				for line in open('/proc/hisi/msp/pm_cpu').readlines():
					line = [x.strip() for x in line.strip().split(":")]
					if line[0] in ("Tsensor"):
						temp = line[1].split("=")
						temp = line[1].split(" ")
						tempinfo = temp[2]
			except:
				tempinfo = ""
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("Processor Temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"
		AboutLcdText = AboutText.replace('\t', ' ')

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 42
0
def getAboutText():
	AboutText = ""
	AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

	bootloader = ""
	if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
		f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
		bootloader = f.readline().replace('\x00', '').replace('\n', '')
		f.close()
		AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

	if path.exists('/proc/stb/info/chipset'):
		AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

	cpuMHz = ""
	if getMachineBuild() in ('vusolo4k','vuultimo4k'):
		cpuMHz = "   (1,5 GHz)"
	elif getMachineBuild() in ('formuler1', 'triplex'):
		cpuMHz = "   (1,3 GHz)"
	elif getMachineBuild() in ('vuuno4k','dm900', 'gb7252', 'dags7252'):
		cpuMHz = "   (1,7 GHz)"
	elif getMachineBuild() in ('et1x000','hd52','hd51','sf4008','vs1500'):
		try:
			import binascii
			f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb')
			clockfrequency = f.read()
			f.close()
			cpuMHz = "   (%s MHz)" % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1))
		except:
			cpuMHz = "   (1,7 GHz)"
	else:
		if path.exists('/proc/cpuinfo'):
			f = open('/proc/cpuinfo', 'r')
			temp = f.readlines()
			f.close()
			try:
				for lines in temp:
					lisp = lines.split(': ')
					if lisp[0].startswith('cpu MHz'):
						#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
						cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
						break
			except:
				pass

	AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
	AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

	imagestarted = ""
	bootname = ''
	if path.exists('/boot/bootname'):
		f = open('/boot/bootname', 'r')
		bootname = f.readline().split('=')[1]
		f.close()

	if path.exists('/boot/STARTUP'):
		f = open('/boot/STARTUP', 'r')
		f.seek(22)
		image = f.read(1) 
		f.close()
		if bootname: bootname = "   (%s)" %bootname 
		AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"

	AboutText += _("Version:\t%s") % getImageVersion() + "\n"
	#AboutText += _("Build:\t%s") % getImageBuild() + "\n"
	AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

	string = getDriverDate()
	year = string[0:4]
	month = string[4:6]
	day = string[6:8]
	driversdate = '-'.join((year, month, day))
	AboutText += _("Drivers:\t%s") % driversdate + "\n"

	AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
	#AboutText += _("Python:\t%s") % about.getPythonVersionString() + "\n"

	#if getMachineBuild() not in ('et1x000','hd51','hd52','vusolo4k','vuuno4k','vuultimo4k','sf4008','dm820','dm7080','dm900', 'gb7252', 'dags7252', 'vs1500'):
	#	AboutText += _("Installed:\t%s") % about.getFlashDateString() + "\n"

	AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n"

	fp_version = getFPVersion()
	if fp_version is None:
		fp_version = ""
	elif fp_version != 0:
		fp_version = _("Frontprocessor version: %s") % fp_version
		#AboutText += fp_version + "\n"

	tempinfo = ""
	if path.exists('/proc/stb/sensors/temp0/value'):
		f = open('/proc/stb/sensors/temp0/value', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/fp/temp_sensor'):
		f = open('/proc/stb/fp/temp_sensor', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/sensors/temp/value'):
		f = open('/proc/stb/sensors/temp/value', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		#AboutText += _("System temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

	tempinfo = ""
	if path.exists('/proc/stb/fp/temp_sensor_avs'):
		f = open('/proc/stb/fp/temp_sensor_avs', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		#AboutText += _("Processor temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"
	AboutLcdText = AboutText.replace('\t', ' ')

	AboutText += "\n" + _("Web:\twww.miraclebox.se") + "\n"
	AboutText += _("E-Mail:\[email protected]") + "\n"
	AboutText += _("Facebook:\twww.facebook.com/themiraclebox") + "\n"
		
	return AboutText, AboutLcdText
Esempio n. 43
0
	def populate(self):
		model = None
		AboutText = ""
		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

		cpuMHz = ""
		if path.exists('/proc/cpuinfo'):
			f = open('/proc/cpuinfo', 'r')
			temp = f.readlines()
			f.close()
			try:
				for lines in temp:
					lisp = lines.split(': ')
					if lisp[0].startswith('cpu MHz'):
						#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
						cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
						break
			except:
				pass

		AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
		AboutText += _("Version:\t%s") % getImageVersion() + "\n"
		AboutText += _("Front Panel:\t%s") % getMicomVersion() + "\n"
		#AboutText += _("Build:\t%s") % getImageBuild() + "\n"
		AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"
		AboutText += _("Drivers:\t%s") % about.getDriverBuildDateString() + "\n"
		AboutText += _("Bootloader:\t%s") % self.loader + "\n"
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %s") % fp_version
			#AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature:\t%s") % tempinfo.replace('\n', '') + mark + "C\n"

		tempinfo = ""
		if path.exists('/proc/stb/fp/temp_sensor_avs'):
			f = open('/proc/stb/fp/temp_sensor_avs', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("Processor temperature:\t%s") % tempinfo.replace('\n', '') + mark + "C\n"

		self["AboutScrollLabel"].setText(AboutText)
Esempio n. 44
0
    def __init__(self, session):
        Screen.__init__(self, session)
        AboutText = ''
        AboutText += _('Model: %s %s\n') % (getMachineBrand(), getMachineName())
        if path.exists('/proc/stb/info/chipset'):
            AboutText += _('Chipset: BCM%s') % about.getChipSetString().lower().replace('\n', '').replace('bcm', '') + '\n'
        AboutText += _('CPU: %s') % about.getCPUString() + '\n'
        AboutText += _('Cores: %s') % about.getCpuCoresString() + '\n'
        AboutText += _('Image: ') + about.getImageTypeString() + '\n'
        AboutText += _('Kernel version: ') + about.getKernelVersionString() + '\n'
        AboutText += _('Coder: REDOUANE') + '\n'
        AboutText += _('Forum: WWW.star7arab.com') + '\n'
        EnigmaVersion = 'Enigma: ' + about.getEnigmaVersionString()
        self['EnigmaVersion'] = StaticText(EnigmaVersion)
        AboutText += EnigmaVersion + '\n'
        ImageVersion = _('Last upgrade: ') + about.getImageVersionString()
        self['ImageVersion'] = StaticText(ImageVersion)
        AboutText += ImageVersion + '\n'
        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ''
        else:
            fp_version = _('Frontprocessor version: %d') % fp_version
            AboutText += fp_version + '\n'
        self['FPVersion'] = StaticText(fp_version)
        self['TunerHeader'] = StaticText(_('Detected NIMs:'))
        AboutText += '\n' + _('Detected NIMs:') + '\n'
        nims = nimmanager.nimList()
        for count in range(len(nims)):
            if count < 4:
                self['Tuner' + str(count)] = StaticText(nims[count])
            else:
                self['Tuner' + str(count)] = StaticText('')
            AboutText += nims[count] + '\n'

        self['HDDHeader'] = StaticText(_('Detected HDD:'))
        AboutText += '\n' + _('Detected HDD:') + '\n'
        hddlist = harddiskmanager.HDDList()
        hddinfo = ''
        if hddlist:
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += '\n'
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += '%s\n(%s, %d GB %s)' % (hdd.model(),
                     hdd.capacity(),
                     hdd.free() / 1024,
                     _('free'))
                else:
                    hddinfo += '%s\n(%s, %d MB %s)' % (hdd.model(),
                     hdd.capacity(),
                     hdd.free(),
                     _('free'))

        else:
            hddinfo = _('none')
        self['hddA'] = StaticText(hddinfo)
        AboutText += hddinfo
        self['AboutScrollLabel'] = ScrollLabel(AboutText)
        self['key_green'] = Button(_('Translations'))
        self['key_red'] = Button(_('Latest Commits'))
        self['actions'] = ActionMap(['ColorActions', 'SetupActions', 'DirectionActions'], {'cancel': self.close,
         'ok': self.close,
         'red': self.showCommits,
         'green': self.showTranslationInfo,
         'up': self['AboutScrollLabel'].pageUp,
         'down': self['AboutScrollLabel'].pageDown})
Esempio n. 45
0
def getAboutText():
    AboutText = ''
    AboutText += _('Model:\t\t%s %s\n') % (getMachineBrand(), getMachineName())
    AboutText += _('OEM Model:\t\t%s\n') % getMachineBuild()
    bootloader = ''
    if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
        f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
        bootloader = f.readline().replace('\x00', '').replace('\n', '')
        f.close()
        AboutText += _('Bootloader:\t\t%s\n') % bootloader
    if path.exists('/proc/stb/info/chipset'):
        AboutText += _('Chipset:\t\t%s') % about.getChipSetString() + '\n'
    cpuMHz = ''
    if getMachineBuild() in ('u41', 'u42', 'u43'):
        cpuMHz = _('   (1.0 GHz)')
    elif getMachineBuild() in ('dags72604', 'vusolo4k', 'vuultimo4k',
                               'vuzero4k', 'gb72604'):
        cpuMHz = _('   (1.5 GHz)')
    elif getMachineBuild() in ('formuler1tc', 'formuler1', 'triplex',
                               'tiviaraplus'):
        cpuMHz = _('   (1.3 GHz)')
    elif getMachineBuild() in ('gbmv200', 'u51', 'u5', 'u53', 'u532', 'u533',
                               'u52', 'u54', 'u55', 'u56', 'u5pvr', 'h9',
                               'h9combo', 'h10', 'cc1', 'sf8008', 'sf8008m',
                               'hd60', 'hd61', 'i55plus', 'ustym4kpro',
                               'beyonwizv2', 'viper4k', 'v8plus', 'multibox'):
        cpuMHz = _('   (1.6 GHz)')
    elif getMachineBuild() in ('vuuno4kse', 'vuuno4k', 'dm900', 'dm920',
                               'gb7252', 'dags7252', 'xc7439', '8100s'):
        cpuMHz = _('   (1.7 GHz)')
    elif getMachineBuild() in ('alien5', ):
        cpuMHz = _('   (2.0 GHz)')
    elif getMachineBuild() in ('vuduo4k', ):
        cpuMHz = _('   (2.1 GHz)')
    elif getMachineBuild() in ('sf5008', 'et13000', 'et1x000', 'hd52', 'hd51',
                               'sf4008', 'vs1500', 'h7', 'osmio4k',
                               'osmio4kplus', 'osmini4k'):
        try:
            import binascii
            f = open(
                '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency',
                'rb')
            clockfrequency = f.read()
            f.close()
            cpuMHz = _('   (%s MHz)') % str(
                round(int(binascii.hexlify(clockfrequency), 16) / 1000000, 1))
        except:
            cpuMHz = _('   (1.7 GHz)')

    elif path.exists('/proc/cpuinfo'):
        f = open('/proc/cpuinfo', 'r')
        temp = f.readlines()
        f.close()
        try:
            for lines in temp:
                lisp = lines.split(': ')
                if lisp[0].startswith('cpu MHz'):
                    cpuMHz = '   (' + str(int(float(lisp[1].replace(
                        '\n', '')))) + ' MHz)'
                    break

        except:
            pass

    AboutText += _('CPU:\t\t%s') % about.getCPUString() + cpuMHz + '\n'
    AboutText += _('Cores:\t\t%s') % about.getCpuCoresString() + '\n'
    imagestarted = ''
    bootname = ''
    if path.exists('/boot/bootname'):
        f = open('/boot/bootname', 'r')
        bootname = f.readline().split('=')[1]
        f.close()
    if SystemInfo['canMultiBoot']:
        slot = image = GetCurrentImage()
        bootmode = ''
        part = _('eMMC slot %s') % slot
        if SystemInfo['canMode12']:
            bootmode = _('bootmode = %s') % GetCurrentImageMode()
        if SystemInfo['HasHiSi'] and 'sda' in SystemInfo['canMultiBoot'][slot][
                'device']:
            if slot > 4:
                image -= 4
            else:
                image -= 1
            part = 'SDcard slot %s (%s) ' % (
                image, SystemInfo['canMultiBoot'][slot]['device'])
        AboutText += _('Selected Image:\t\t%s') % _('STARTUP_') + str(
            slot) + '  ' + part + ' ' + bootmode + '\n'
    AboutText += _('Version:\t\t%s') % getImageVersion() + '\n'
    AboutText += _('Build:\t\t%s') % getImageBuild() + '\n'
    AboutText += _('Kernel:\t\t%s') % about.getKernelVersionString() + '\n'
    string = getDriverDate()
    year = string[0:4]
    month = string[4:6]
    day = string[6:8]
    driversdate = '-'.join((year, month, day))
    AboutText += _('Drivers:\t\t%s') % MyDateConverter(driversdate) + '\n'
    AboutText += _(
        'GStreamer:\t\t%s') % about.getGStreamerVersionString() + '\n'
    AboutText += _('Python:\t\t%s') % about.getPythonVersionString() + '\n'
    MyFlashDate = about.getFlashDateString()
    if MyFlashDate != _('unknown'):
        AboutText += _('Installed:\t\t%s') % MyFlashDate + '\n'
    AboutText += _('Last update:\t\t%s') % MyDateConverter(
        getEnigmaVersionString()) + '\n'
    fp_version = getFPVersion()
    if fp_version is None:
        fp_version = ''
    elif fp_version != 0:
        fp_version = _('Frontprocessor version: %s') % fp_version
        AboutText += fp_version + '\n'
    tempinfo = ''
    if path.exists('/proc/stb/sensors/temp0/value'):
        f = open('/proc/stb/sensors/temp0/value', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/fp/temp_sensor'):
        f = open('/proc/stb/fp/temp_sensor', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/sensors/temp/value'):
        f = open('/proc/stb/sensors/temp/value', 'r')
        tempinfo = f.read()
        f.close()
    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _('System temperature:\t%s') % tempinfo.replace(
            '\n', '').replace(' ', '') + mark + 'C\n'
    tempinfo = ''
    if path.exists('/proc/stb/fp/temp_sensor_avs'):
        f = open('/proc/stb/fp/temp_sensor_avs', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/power/avs'):
        f = open('/proc/stb/power/avs', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
        try:
            f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
            tempinfo = f.read()
            tempinfo = tempinfo[:-4]
            f.close()
        except:
            tempinfo = ''

    elif path.exists('/proc/hisi/msp/pm_cpu'):
        try:
            for line in open('/proc/hisi/msp/pm_cpu').readlines():
                line = [x.strip() for x in line.strip().split(':')]
                if line[0] in 'Tsensor':
                    temp = line[1].split('=')
                    temp = line[1].split(' ')
                    tempinfo = temp[2]
                    if getMachineBuild() in ('u41', 'u42', 'u43'):
                        tempinfo = str(int(tempinfo) - 15)

        except:
            tempinfo = ''

    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _('Processor temperature:\t%s') % tempinfo.replace(
            '\n', '').replace(' ', '') + mark + 'C\n'
    AboutLcdText = AboutText.replace('\t', ' ')
    return (AboutText, AboutLcdText)
Esempio n. 46
0
    def __init__(self, session):
        Screen.__init__(self, session)
        AboutText = _('STB : ') + getBoxType() + '\n'
        AboutText += _('Brand : ') + about.getBrandString() + '\n'
        AboutText += _('Image : Persian Empire') + '\n'
        AboutText += _('Version : ') + getImageVersion() + '\n'
        AboutText += _('Kernel : ') + about.getKernelVersionString() + ' PE Mode REDOUANE\n'
        EnigmaVersion = 'Enigma2 : ' + about.getEnigmaVersionString()
        self['EnigmaVersion'] = StaticText(EnigmaVersion)
        AboutText += EnigmaVersion + ' PE Mode REDOUANE\n'
        AboutText += _('For More Information Visit http://e2pe.com') + '\n'
        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ''
        else:
            fp_version = _('Frontprocessor : %d') % fp_version
            AboutText += fp_version + '\n'
        self['FPVersion'] = StaticText(fp_version)
        tempinfo = ''
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _('System Temperature : %s') % tempinfo.replace('\n', '') + mark + 'C\n'
        if path.exists('/proc/stb/info/chipset'):
            AboutText += '\n' + _('Chipset : %s') % about.getChipSetString() + '\n'
        AboutText += _('CPU : %s') % about.getCPUString() + _(' , Cores : %s') % about.getCpuCoresString() + '\n'
        self['TunerHeader'] = StaticText(_('NIMs :'))
        AboutText += '\n' + _('NIMs :') + '\n'
        nims = nimmanager.nimList()
        for count in range(len(nims)):
            if count < 4:
                self['Tuner' + str(count)] = StaticText(nims[count])
            else:
                self['Tuner' + str(count)] = StaticText('')
            AboutText += ' ' + nims[count] + '\n'

        self['HDDHeader'] = StaticText(_('HDD :'))
        AboutText += '\n' + _('HDD :') + '\n'
        hddlist = harddiskmanager.HDDList()
        hddinfo = ''
        if hddlist:
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += '\n'
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += '%s\n(%s, %d GB %s)' % (hdd.model(),
                     hdd.capacity(),
                     hdd.free() / 1024,
                     _('free'))
                else:
                    hddinfo += '%s\n(%s, %d MB %s)' % (hdd.model(),
                     hdd.capacity(),
                     hdd.free(),
                     _('free'))

        else:
            hddinfo = _('none')
        self['hddA'] = StaticText(hddinfo)
        AboutText += hddinfo
        self['AboutScrollLabel'] = ScrollLabel(AboutText)
        self['key_green'] = Button(_('Translations'))
        self['key_red'] = Button(_('Latest Commits'))
        self['actions'] = ActionMap(['ColorActions', 'SetupActions', 'DirectionActions'], {'cancel': self.close,
         'ok': self.close,
         'red': self.showCommits,
         'green': self.showTranslationInfo,
         'up': self['AboutScrollLabel'].pageUp,
         'down': self['AboutScrollLabel'].pageDown})
Esempio n. 47
0
def getAboutText():
    AboutText = ""
    AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

    if path.exists('/proc/stb/info/chipset'):
        AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

    cpuMHz = ""
    if path.exists('/proc/cpuinfo'):
        f = open('/proc/cpuinfo', 'r')
        temp = f.readlines()
        f.close()
        try:
            for lines in temp:
                lisp = lines.split(': ')
                if lisp[0].startswith('cpu MHz'):
                    #cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
                    cpuMHz = "   (" + str(int(float(lisp[1].replace(
                        '\n', '')))) + " MHz)"
                    break
        except:
            pass

    AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
    AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

    AboutText += _("Version:\t%s") % 'SpecialEdition' + "\n"
    AboutText += _("Moderator:\t%s") % 'Sodo' + "\n"
    AboutText += _("Build:\t%s") % '3.0' + "\n"
    AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

    string = getDriverDate()
    year = string[0:4]
    month = string[4:6]
    day = string[6:8]
    driversdate = '-'.join((year, month, day))
    AboutText += _("Drivers:\t%s") % driversdate + "\n"

    AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

    AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"

    fp_version = getFPVersion()
    if fp_version is None:
        fp_version = ""
    elif fp_version != 0:
        fp_version = _("Frontprocessor version: %s") % fp_version
        AboutText += fp_version + "\n"

    tempinfo = ""
    if path.exists('/proc/stb/sensors/temp0/value'):
        f = open('/proc/stb/sensors/temp0/value', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/fp/temp_sensor'):
        f = open('/proc/stb/fp/temp_sensor', 'r')
        tempinfo = f.read()
        f.close()
    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _("System temperature:\t%s") % tempinfo.replace(
            '\n', '').replace(' ', '') + mark + "C\n"

    tempinfo = ""
    if path.exists('/proc/stb/fp/temp_sensor_avs'):
        f = open('/proc/stb/fp/temp_sensor_avs', 'r')
        tempinfo = f.read()
        f.close()
    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _("Processor temperature:\t%s") % tempinfo.replace(
            '\n', '').replace(' ', '') + mark + "C\n"
    AboutLcdText = AboutText.replace('\t', ' ')

    return AboutText, AboutLcdText
Esempio n. 48
0
	def __init__(self, session):
		Screen.__init__(self, session)
		hddsplit = skin.parameters.get("AboutHddSplit", 0)

		#AboutHddSplit = 0
		#try:
		#	hddsplit = skin.parameters.get("AboutHddSplit",(0))[0]
		#except:
		#	hddsplit = AboutHddSplit

		if boxtype == 'gb800solo':
			BoxName = "GigaBlue HD 800SOLO"
		elif boxtype == 'gb800se':
			BoxName = "GigaBlue HD 800SE"
		elif boxtype == 'gb800ue':
			BoxName = "GigaBlue HD 800UE"
		elif boxtype == 'gbquad':
			BoxName = "GigaBlue Quad"
		elif boxtype == 'gbquad4k':
			BoxName = "GigaBlue Quad 4k"
		elif boxtype == 'gbue4k':
			BoxName = "GigaBlue UE 4k"
		elif boxtype == 'gbquadplus':
			BoxName = "GigaBlue HD Quadplus"
		elif boxtype == 'gb800seplus':
			BoxName = "GigaBlue HD 800SEplus"
		elif boxtype == 'gb800ueplus':
			BoxName = "GigaBlue HD 800UEplus"
		elif boxtype == 'gbipbox':
			BoxName = "GigaBlue IP Box"
		elif boxtype == 'gbultra':
			BoxName = "GigaBlue HD Ultra"
		elif boxtype == 'gbultraue':
			BoxName = "GigaBlue HD Ultra UE"
		elif boxtype == 'gbultraueh':
			BoxName = "GigaBlue HD Ultra UEh"
		elif boxtype == 'gbultrase':
			BoxName = "GigaBlue HD Ultra SE"
		elif boxtype == 'gbx1':
			BoxName = "GigaBlue X1"
		elif boxtype == 'gbx2':
			BoxName = "GigaBlue X2"
		elif boxtype == 'gbx3':
			BoxName = "GigaBlue X3"
		elif boxtype == 'gbx3h':
			BoxName = "GigaBlue X3h"
		elif boxtype == 'spycat':
			BoxName = "XCORE Spycat"
		elif boxtype == 'quadbox2400':
			BoxName = "AX Quadbox HD2400"
		else:
			BoxName = about.getHardwareTypeString()

		self.setTitle(_("About") + " " + BoxName)

		ImageType = about.getImageTypeString()
		self["ImageType"] = StaticText(ImageType)

		Boxserial = popen('cat /proc/stb/info/sn').read().strip()
		serial = ""
		if Boxserial != "":
			serial = ":Serial : " + Boxserial

		AboutHeader = _("About") + " " + BoxName 
		self["AboutHeader"] = StaticText(AboutHeader)

		AboutText = BoxName + " - " + ImageType + serial + "\n"

		#AboutText += _("Hardware: ") + about.getHardwareTypeString() + "\n"
		#AboutText += _("CPU: ") + about.getCPUInfoString() + "\n"
		#AboutText += _("Installed: ") + about.getFlashDateString() + "\n"
		#AboutText += _("Image: ") + about.getImageTypeString() + "\n"

		CPUinfo = _("CPU: ") + about.getCPUInfoString()
		self["CPUinfo"] = StaticText(CPUinfo)
		AboutText += CPUinfo + "\n"

		CPUspeed = _("Speed: ") + about.getCPUSpeedString()
		self["CPUspeed"] = StaticText(CPUspeed)
		#AboutText += "(" + about.getCPUSpeedString() + ")\n"

		ChipsetInfo = _("Chipset: ") + about.getChipSetString()
		self["ChipsetInfo"] = StaticText(ChipsetInfo)
		AboutText += ChipsetInfo + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		else:
			fp_version = _("Frontprocessor version: %s") % fp_version
			#AboutText += fp_version +"\n"
		self["FPVersion"] = StaticText(fp_version) 

		AboutText += "\n"

		KernelVersion = _("Kernel version: ") + about.getKernelVersionString()
		self["KernelVersion"] = StaticText(KernelVersion)
		AboutText += KernelVersion + "\n"

		if getMachineBuild() == 'gb7252':
			b = popen('cat /proc/stb/info/version').read().strip()
			driverdate=str(b[0:4] + '-' + b[4:6] + '-' + b[6:8] + ' ' + b[8:10]  + ':' + b[10:12] + ':' + b[12:14])
			AboutText += _("DVB drivers: ") + driverdate + "\n"
		else:
			AboutText += _("DVB drivers: ") + self.realDriverDate() + "\n"
			#AboutText += _("DVB drivers: ") + about.getDriverInstalledDate() + "\n"

		ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
		self["ImageVersion"] = StaticText(ImageVersion)
		AboutText += ImageVersion + "\n"

		EnigmaVersion = _("GUI Build: ") + about.getEnigmaVersionString() + "\n"
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		#AboutText += EnigmaVersion

		#AboutText += _("Enigma (re)starts: %d\n") % config.misc.startCounter.value

		FlashDate = _("Flashed: ") + about.getFlashDateString()
		self["FlashDate"] = StaticText(FlashDate)
		AboutText += FlashDate + "\n"

		EnigmaSkin = _("Skin: ") + config.skin.primary_skin.value[0:-9]
		self["EnigmaSkin"] = StaticText(EnigmaSkin)
		AboutText += EnigmaSkin + "\n"

		AboutText += _("Python version: ") + about.getPythonVersionString() + "\n"

		GStreamerVersion = _("GStreamer: ") + about.getGStreamerVersionString().replace("GStreamer","")
		self["GStreamerVersion"] = StaticText(GStreamerVersion)
		AboutText += GStreamerVersion + "\n"

		twisted = popen('opkg list-installed  |grep -i python-twisted-core').read().strip().split(' - ')[1]
		AboutText += "Python-Twisted: " + str(twisted) + "\n"

		AboutText += "\n"
		self["TunerHeader"] = StaticText(_("Detected NIMs:"))
		#AboutText += _("Detected NIMs:") + "\n"

		nims = nimmanager.nimList()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")
			AboutText += nims[count] + "\n"

		self["HDDHeader"] = StaticText(_("Detected HDD:"))

		AboutText += "\n"
		#AboutText +=  _("Detected HDD:") + "\n"
		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s:(%s, %.1f %sB %s)"
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free()/1024.0, "G", _("free"))
				else:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free(), "M", _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		AboutText += hddinfo 
		
		#AboutText += "\n\n" + _("Network Info") 
		#for x in about.GetIPsFromNetworkInterfaces():
		#	AboutText += "\n" + iNetwork.getFriendlyAdapterDescription(x[0]) + " :" + "/dev/" + x[0] + " " + x[1]

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
		self["key_green"] = Button(_("Translations"))
		self["key_red"] = Button(_("Latest Commits"))
		self["key_yellow"] = Button(_("Troubleshoot"))
		self["key_blue"] = Button(_("Memory Info"))
		self["key_info"] = Button(_("Contact Info"))
		self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"red": self.showCommits,
				"green": self.showTranslationInfo,
				"blue": self.showMemoryInfo,
				"info": self.showContactInfo,
				"yellow": self.showTroubleshoot,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})
Esempio n. 49
0
class VideoHardware:
    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"}}

    if about.getChipSetString().find('7335') != -1 or about.getChipSetString(
    ).find('7358') != -1 or about.getChipSetString().find(
            '7356') != -1 or about.getChipSetString().find(
                '7405') != -1 or about.getChipSetString().find('7424') != -1:
        rates["720p"] = {
            "24Hz": {
                24: "720p24"
            },
            "25Hz": {
                25: "720p25"
            },
            "30Hz": {
                30: "720p30"
            },
            "50Hz": {
                50: "720p50"
            },
            "60Hz": {
                60: "720p"
            },
            "multi": {
                50: "720p50",
                60: "720p"
            }
        }
    else:
        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"
        }
    }

    if about.getChipSetString().find(
            '7405') != -1 or about.getChipSetString().find('7335') != -1:
        rates["1080p"] = {
            "24Hz": {
                24: "1080p24"
            },
            "25Hz": {
                25: "1080p25"
            },
            "30Hz": {
                30: "1080p30"
            }
        }

    elif about.getChipSetString().find('7358') != -1 or about.getChipSetString(
    ).find('7356') != -1 or about.getChipSetString().find('7424') != -1:
        rates["1080p"] = {
            "24Hz": {
                24: "1080p24"
            },
            "25Hz": {
                25: "1080p25"
            },
            "30Hz": {
                30: "1080p30"
            },
            "50Hz": {
                50: "1080p50"
            },
            "60Hz": {
                60: "1080p"
            },
            "multi": {
                50: "1080p50",
                60: "1080p"
            }
        }
    elif hw_type == 'elite' or hw_type == 'premium' or hw_type == 'premium+' or hw_type == 'ultra' or hw_type == "me" or hw_type == "minime":
        rates["1080p"] = {
            "50Hz": {
                50: "1080p50"
            },
            "60Hz": {
                60: "1080p"
            },
            "23Hz": {
                23: "1080p"
            },
            "24Hz": {
                24: "1080p"
            },
            "25Hz": {
                25: "1080p"
            },
            "30Hz": {
                30: "1080p"
            },
            "multi": {
                50: "1080p50",
                60: "1080p"
            }
        }

    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 == 'elite' or hw_type == 'premium' or hw_type == 'premium+' or hw_type == 'ultra' or hw_type == "me" or hw_type == "minime":
        config.av.edid_override = True

    if about.getChipSetString().find('7335') != -1 or about.getChipSetString(
    ).find('7358') != -1 or about.getChipSetString(
    ).find('7356') != -1 or about.getChipSetString(
    ).find('7405') != -1 or about.getChipSetString().find(
            '7424'
    ) != -1 or hw_type == 'elite' or hw_type == 'premium' or hw_type == 'premium+' or hw_type == 'ultra' or hw_type == "me" or hw_type == "minime":
        modes["YPbPr"] = [
            "720p", "1080i", "1080p", "576p", "480p", "576i", "480i"
        ]
        modes["DVI"] = [
            "720p", "1080i", "1080p", "576p", "480p", "576i", "480i"
        ]
        widescreen_modes = set(["720p", "1080i", "1080p"])
    else:
        modes["YPbPr"] = ["720p", "1080i", "576p", "480p", "576i", "480i"]
        modes["DVI"] = ["720p", "1080i", "576p", "480p", "576i", "480i"]
        widescreen_modes = set(["720p", "1080i"])

    if boxtype.startswith('vu') or boxtype == 'dm500hd' or boxtype == 'dm800':
        if about.getChipSetString(
        ).find('7358') != -1 or about.getChipSetString().find(
                '7356') != -1 or about.getChipSetString().find('7424') != -1:
            modes["Scart-YPbPr"] = [
                "720p", "1080i", "1080p", "576p", "480p", "576i", "480i"
            ]
        else:
            modes["Scart-YPbPr"] = [
                "720p", "1080i", "576p", "480p", "576i", "480i"
            ]

    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 __init__(self):
        self.last_modes_preferred = []
        self.on_hotplug = CList()
        self.current_mode = None
        self.current_port = None

        self.readAvailableModes()

        if self.modes.has_key("DVI-PC") and not self.getModeList("DVI-PC"):
            print "remove DVI-PC because of not existing modes"
            del self.modes["DVI-PC"]
        if boxtype in ('et4x00', 'xp1000mk', 'xp1000max', 'xp1000plus', 'sf8',
                       'tm2t', 'tmsingle', 'vusolo2', 'tmnano', 'iqonios300hd',
                       'classm', 'axodin', 'axodinc', 'genius', 'evo',
                       'geniuse3hd', 'evoe3hd', 'axase3', 'axase3c',
                       'dm500hdv2', 'dm500hd', 'dm800', 'mixosf7', 'mixoslumi',
                       'mixosf5mini', 'gi9196lite', 'ixusszero',
                       'optimussos1') or (about.getModelString()
                                          == 'ini-3000'):
            del self.modes["YPbPr"]
        if hw_type in ('elite', 'premium', 'premium+', 'ultra', "me",
                       "minime"):
            self.readPreferredModes()

        self.createConfig()
        self.readPreferredModes()

        # take over old AVSwitch component :)
        from Components.AVSwitch import AVSwitch
        config.av.aspectratio.notifiers = []
        config.av.tvsystem.notifiers = []
        config.av.wss.notifiers = []
        AVSwitch.getOutputAspect = self.getOutputAspect

        config.av.aspect.addNotifier(self.updateAspect)
        config.av.wss.addNotifier(self.updateAspect)
        config.av.policy_169.addNotifier(self.updateAspect)
        config.av.policy_43.addNotifier(self.updateAspect)

    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
            print "hotplug on dvi"
            self.on_hotplug("DVI")  # must be DVI

    # 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():
            ##### Only for test #####
            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
            ##### Only for test #####
            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 "setMode - port:", port, "mode:", mode, "rate:", rate

        config.av.videoport.setValue(port)  # [iq]

        # 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:
            mode_etc = None
            if rate == "24Hz" or rate == "25Hz" or rate == "30Hz":
                mode_etc = modes.get(int(rate[:2]))
                f = open("/proc/stb/video/videomode", "w")
                f.write(mode_etc)
                f.close()
            # not support 50Hz, 60Hz for 1080p
            else:
                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 "setting videomode failed."

        try:
            if rate == "24Hz" or rate == "25Hz" or rate == "30Hz":
                mode_etc = modes.get(int(rate[:2]))
                f = open("/proc/stb/video/videomode", "w")
                f.write(mode_etc)
                f.close()
            else:
                # 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 "writing initial videomode to /etc/videomode failed."

        self.updateAspect(None)

    def saveMode(self, port, mode, rate):
        print "saveMode", 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 == "DVI":
            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):
        print "getModeList for port", 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 descr == 'DVI' and has_hdmi:
                descr = 'HDMI'
            elif descr == 'DVI-PC' and has_hdmi:
                descr = 'HDMI-PC'
            lst.append((port, descr))

            # create list of available modes
            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 setColorFormatAsPort(configElement):
            if configElement.value == "YPbPr" or configElement.value == "Scart-YPbPr":
                config.av.colorformat.setValue("yuv")

        config.av.videoport.addNotifier(setColorFormatAsPort)

    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 updateAspect(self, cfgelement):
        # determine aspect = {any,4:3,16:9,16:10}
        # determine policy = {bestfit,letterbox,panscan,nonlinear}

        # based on;
        #   config.av.videoport.value: current video output device
        #     Scart:
        #   config.av.aspect:
        #     4_3:            use policy_169
        #     16_9,16_10:     use policy_43
        #     auto            always "bestfit"
        #   config.av.policy_169
        #     letterbox       use letterbox
        #     panscan         use panscan
        #     scale           use bestfit
        #   config.av.policy_43
        #     pillarbox       use panscan
        #     panscan         use letterbox  ("panscan" is just a bad term, it's inverse-panscan)
        #     nonlinear       use nonlinear
        #     scale           use bestfit

        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

        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"
        policy2 = "policy"  # use main policy

        if is_widescreen:
            if force_widescreen:
                aspect = "16:9"
            else:
                aspect = {
                    "16_9": "16:9",
                    "16_10": "16:10"
                }[config.av.aspect.value]
            policy_choices = {
                "pillarbox": "panscan",
                "panscan": "letterbox",
                "nonlinear": "nonlinear",
                "scale": "bestfit"
            }
            if path.exists("/proc/stb/video/policy_choices"):
                f = open("/proc/stb/video/policy_choices")
                if "auto" in f.readline():
                    policy_choices.update({"auto": "auto"})
                else:
                    policy_choices.update({"auto": "bestfit"})
                f.close()
            policy = policy_choices[config.av.policy_43.value]
            policy2_choices = {
                "letterbox": "letterbox",
                "panscan": "panscan",
                "scale": "bestfit"
            }
            if path.exists("/proc/stb/video/policy2_choices"):
                f = open("/proc/stb/video/policy2_choices")
                if "auto" in f.readline():
                    policy2_choices.update({"auto": "auto"})
                else:
                    policy2_choices.update({"auto": "bestfit"})
                f.close()
            policy2 = policy2_choices[config.av.policy_169.value]
        elif is_auto:
            aspect = "any"
            policy = "bestfit"
        else:
            aspect = "4:3"
            policy = {
                "letterbox": "letterbox",
                "panscan": "panscan",
                "scale": "bestfit",
                "auto": "bestfit"
            }[config.av.policy_169.value]

        if not config.av.wss.value:
            wss = "auto(4:3_off)"
        else:
            wss = "auto"

        print "-> setting aspect: %s, policy: %s, policy2: %s, wss: %s" % (
            aspect, policy, policy2, wss)
        f = open("/proc/stb/video/aspect", "w")
        f.write(aspect)
        f.close()
        f = open("/proc/stb/video/policy", "w")
        f.write(policy)
        f.close()
        f = open("/proc/stb/denc/0/wss", "w")
        f.write(wss)
        f.close()
        try:
            f = open("/proc/stb/video/policy2", "w")
            f.write(policy2)
            f.close()
        except IOError:
            pass
Esempio n. 50
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.setTitle(_("About"))
        OpenNFRVersion = _("OpenNFR %s") % about.getImageVersionString()
        self["OpenNFRVersion"] = Label(OpenNFRVersion)

        AboutText = _("Model:\t\t%s %s\n") % (getMachineBrand(),
                                              getMachineName())

        bootloader = ""
        if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
            f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
            bootloader = f.readline().replace('\x00', '').replace('\n', '')
            f.close()
            AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

        if path.exists('/proc/stb/info/chipset'):
            AboutText += _(
                "Chipset:\t\tBCM%s") % about.getChipSetString() + "\n"

        cpuMHz = ""
        if getMachineBuild() in ('u41', 'u42', 'u43'):
            cpuMHz = _("   (1.0 GHz)")
        elif getMachineBuild() in ('dags72604', 'vusolo4k', 'vuultimo4k',
                                   'vuzero4k', 'gb72604'):
            cpuMHz = "   (1,5 GHz)"
        elif getMachineBuild() in ('formuler1', 'triplex'):
            cpuMHz = "   (1,3 GHz)"
        elif getMachineBuild() in ('gbmv200', 'u51', 'u5', 'u53', 'u52', 'u54',
                                   'u55', 'u56', 'u5pvr', 'h9', 'h9combo',
                                   'cc1', 'sf8008', 'sf8008m', 'hd60', 'hd61',
                                   'i55plus', 'ustym4kpro', 'v8plus',
                                   'multibox'):
            cpuMHz = "   (1,6 GHz)"
        elif getMachineBuild() in ('vuuno4k', 'vuultimo4k', 'gb7252',
                                   'dags7252', '8100s'):
            cpuMHz = "   (1,7 GHz)"
        elif getMachineBuild() in ('alien5', 'u53'):
            cpuMHz = "   (2,0 GHz)"
        elif getMachineBuild() in ('vuduo4k', ):
            cpuMHz = _("   (2.1 GHz)")
        elif getMachineBuild() in ('sf5008', 'et13000', 'et1x000', 'hd52',
                                   'hd51', 'sf4008', 'vs1500', 'h7', 'osmio4k',
                                   'osmio4kplus', 'osmini4k'):
            try:
                import binascii
                f = open(
                    '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency',
                    'rb')
                clockfrequency = f.read()
                f.close()
                cpuMHz = "   (%s MHz)" % str(
                    round(
                        int(binascii.hexlify(clockfrequency), 16) / 1000000,
                        1))
            except:
                cpuMHz = "   (1,7 GHz)"
        else:
            if path.exists('/proc/cpuinfo'):
                f = open('/proc/cpuinfo', 'r')
                temp = f.readlines()
                f.close()
                try:
                    for lines in temp:
                        lisp = lines.split(': ')
                        if lisp[0].startswith('cpu MHz'):
                            #cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
                            cpuMHz = "   (" + str(
                                int(float(lisp[1].replace('\n',
                                                          '')))) + " MHz)"
                            break
                except:
                    pass

        AboutText += _("CPU:\t\t%s") % about.getCPUString() + cpuMHz + "\n"
        AboutText += _("Cores:\t\t%s") % about.getCpuCoresString() + "\n"

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/sensors/temp/value'):
            f = open('/proc/stb/sensors/temp/value', 'r')
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System temperature:\t%s") % tempinfo.replace(
                '\n', '') + mark + "C\n"

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            f = open('/proc/stb/fp/temp_sensor_avs', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/power/avs'):
            f = open('/proc/stb/power/avs', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                f = open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                         'r')
                tempinfo = f.read()
                tempinfo = tempinfo[:-4]
                f.close()
            except:
                tempinfo = ""
        elif path.exists('/proc/hisi/msp/pm_cpu'):
            try:
                for line in open('/proc/hisi/msp/pm_cpu').readlines():
                    line = [x.strip() for x in line.strip().split(":")]
                    if line[0] in ("Tsensor"):
                        temp = line[1].split("=")
                        temp = line[1].split(" ")
                        tempinfo = temp[2]
            except:
                tempinfo = ""
        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("Processor temperature:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"
        imagestarted = ""
        bootname = ''
        if path.exists('/boot/bootname'):
            f = open('/boot/bootname', 'r')
            bootname = f.readline().split('=')[1]
            f.close()

        if SystemInfo["canMultiBoot"]:
            slot = image = GetCurrentImage()
            bootmode = ""
            part = "eMMC slot %s" % slot
            if SystemInfo["canMode12"]:
                bootmode = "bootmode = %s" % GetCurrentImageMode()
            if SystemInfo["HasHiSi"] and "sda" in SystemInfo["canMultiBoot"][
                    slot]['device']:
                if slot > 4:
                    image -= 4
                else:
                    image -= 1
                part = "SDcard slot %s (%s) " % (
                    image, SystemInfo["canMultiBoot"][slot]['device'])
            AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + str(
                slot) + "  " + part + " " + bootmode + "\n"
        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t\t%s") % driversdate + "\n"
        AboutText += _("Image:\t\t%s") % about.getImageVersionString() + "\n"
        AboutText += _("Build:\t\t%s") % getImageBuild() + "\n"
        AboutText += _(
            "Kernel: \t\t%s") % about.getKernelVersionString() + "\n"
        AboutText += _("Oe-Core:\t\t%s") % getOEVersion() + "\n"
        AboutText += _(
            "Enigma (re)starts:\t%d\n") % config.misc.startCounter.value
        AboutText += _(
            "GStreamer:\t\t%s") % about.getGStreamerVersionString() + "\n"
        AboutText += _("Python:\t\t%s") % about.getPythonVersionString() + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Front Panel:\t\t%s") % fp_version
            AboutText += fp_version + "\n"
        else:
            fp_version = _("Front Panel:\t\tVersion unknown")
            AboutText += fp_version + "\n"

        if getMachineBuild() not in ('gbmv200', 'vuduo4k', 'v8plus',
                                     'ustym4kpro', 'hd60', 'hd61', 'i55plus',
                                     'osmio4k', 'osmio4kplus', 'h9', 'h9combo',
                                     'vuzero4k', 'sf5008', 'et13000',
                                     'et1x000', 'hd51', 'hd52', 'vusolo4k',
                                     'vuuno4k', 'vuuno4kse', 'vuultimo4k',
                                     'sf4008', 'dm820', 'dm7080', 'dm900',
                                     'dm920', 'gb7252', 'dags7252', 'vs1500',
                                     'h7', 'xc7439', '8100s', 'u41', 'u42',
                                     'u43', 'u5', 'u5pvr', 'u52', 'u53', 'u54',
                                     'u55', 'u56', 'u51', 'cc1', 'sf8008m',
                                     'sf8008'):
            AboutText += _(
                "Installed:\t\t%s") % about.getFlashDateString() + "\n"
        AboutText += _(
            "Last Upgrade:\t\t%s") % about.getLastUpdateString() + "\n\n"

        self["FPVersion"] = StaticText(fp_version)

        AboutText += _("WWW:\t\t%s") % about.getImageUrlString() + "\n\n"
        AboutText += _(
            "based on:\t\t%s") % "www.github.com/oe-alliance" + "\n\n"
        # don't remove the string out of the _(), or it can't be "translated" anymore.
        # TRANSLATORS: Add here whatever should be shown in the "translator" about screen, up to 6 lines (use \n for newline)
        info = _("TRANSLATOR_INFO")

        if info == _("TRANSLATOR_INFO"):
            info = ""

        infolines = _("").split("\n")
        infomap = {}
        for x in infolines:
            l = x.split(': ')
            if len(l) != 2:
                continue
            (type, value) = l
            infomap[type] = value

        translator_name = infomap.get("Language-Team", "none")
        if translator_name == "none":
            translator_name = infomap.get("Last-Translator", "")

        self["FPVersion"] = StaticText(fp_version)

        self["TunerHeader"] = StaticText(_("Detected NIMs:"))

        nims = nimmanager.nimList()
        for count in range(len(nims)):
            if count < 4:
                self["Tuner" + str(count)] = StaticText(nims[count])
            else:
                self["Tuner" + str(count)] = StaticText("")

        self["HDDHeader"] = StaticText(_("Detected HDD:"))

        hddlist = harddiskmanager.HDDList()
        hddinfo = ""
        if hddlist:
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += "\n"
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += "%s\n(%s, %d GB %s)" % (
                        hdd.model(), hdd.capacity(), hdd.free() / 1024,
                        _("free"))
                else:
                    hddinfo += "%s\n(%s, %d MB %s)" % (
                        hdd.model(), hdd.capacity(), hdd.free(), _("free"))
        else:
            hddinfo = _("none")
        self["hddA"] = StaticText(hddinfo)

        self["AboutScrollLabel"] = ScrollLabel(AboutText)

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "green": self.showTranslationInfo,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
Esempio n. 51
0
def getAboutText():
	AboutText = ""
	AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

	bootloader = ""
	if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
		f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
		bootloader = f.readline().replace('\x00', '').replace('\n', '')
		f.close()
		AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

	if path.exists('/proc/stb/info/chipset'):
		AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

	cpuMHz = ""
	if getMachineBuild() in ('vusolo4k'):
		cpuMHz = "   (1,5 GHz)"
	elif getMachineBuild() in ('hd52','hd51'):
		try:
			import binascii
			f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb')
			clockfrequency = f.read()
			f.close()
			cpuMHz = "   (%s MHz)" % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1))
		except:
			cpuMHz = "   (1,7 GHz)"
	else:
		if path.exists('/proc/cpuinfo'):
			f = open('/proc/cpuinfo', 'r')
			temp = f.readlines()
			f.close()
			try:
				for lines in temp:
					lisp = lines.split(': ')
					if lisp[0].startswith('cpu MHz'):
						#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
						cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
						break
			except:
				pass

	AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
	AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

	imagestarted = ""
	bootname = ''
	if path.exists('/boot/bootname'):
		f = open('/boot/bootname', 'r')
		bootname = f.readline().split('=')[1]
		f.close()

	if path.exists('/boot/STARTUP'):
		f = open('/boot/STARTUP', 'r')
		f.seek(22)
		image = f.read(1) 
		f.close()
		if bootname: bootname = "   (%s)" %bootname 
		AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"

	AboutText += _("Version:\t%s") % getImageVersion() + "\n"
	AboutText += _("Build:\t%s") % getImageBuild() + "\n"
	AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

	string = getDriverDate()
	year = string[0:4]
	month = string[4:6]
	day = string[6:8]
	driversdate = '-'.join((year, month, day))
	AboutText += _("Drivers:\t%s") % driversdate + "\n"

	AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
	AboutText += _("Python:\t%s") % about.getPythonVersionString() + "\n"

	AboutText += _("Installed:\t%s") % about.getFlashDateString() + "\n"
	AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n"

	fp_version = getFPVersion()
	if fp_version is None:
		fp_version = ""
	elif fp_version != 0:
		fp_version = _("Frontprocessor version: %s") % fp_version
		AboutText += fp_version + "\n"

	tempinfo = ""
	if path.exists('/proc/stb/sensors/temp0/value'):
		f = open('/proc/stb/sensors/temp0/value', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/fp/temp_sensor'):
		f = open('/proc/stb/fp/temp_sensor', 'r')
		tempinfo = f.read()
		f.close()
	elif path.exists('/proc/stb/sensors/temp/value'):
		f = open('/proc/stb/sensors/temp/value', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		AboutText += _("System temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

	tempinfo = ""
	if path.exists('/proc/stb/fp/temp_sensor_avs'):
		f = open('/proc/stb/fp/temp_sensor_avs', 'r')
		tempinfo = f.read()
		f.close()
	if tempinfo and int(tempinfo.replace('\n', '')) > 0:
		mark = str('\xc2\xb0')
		AboutText += _("Processor temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"
	AboutLcdText = AboutText.replace('\t', ' ')

	return AboutText, AboutLcdText
Esempio n. 52
0
    def populate(self):
        self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
        self["lab2"] = StaticText(_("By Team ViX"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(
            _("Support at") + " www.world-of-satellite.com")

        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(),
                                             getMachineName())

        if about.getChipSetString() != _("unavailable"):
            if SystemInfo["HasHiSi"]:
                AboutText += _("Chipset:\tHiSilicon %s\n"
                               ) % about.getChipSetString().upper()
            elif about.getIsBroadcom():
                AboutText += _("Chipset:\tBroadcom %s\n"
                               ) % about.getChipSetString().upper()
            else:
                AboutText += _(
                    "Chipset:\t%s\n") % about.getChipSetString().upper()

        AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(),
                                              about.getCPUSpeedString(),
                                              about.getCpuCoresString())

        if SystemInfo["BoxInfo"]:
            BoxInfo = SystemInfo["BoxInfo"]
            AboutText += _("SoC:\t%s\n") % BoxInfo.getItem("socfamily").upper()

        tempinfo = ""
        if path.exists("/proc/stb/sensors/temp0/value"):
            with open("/proc/stb/sensors/temp0/value", "r") as f:
                tempinfo = f.read()
        elif path.exists("/proc/stb/fp/temp_sensor"):
            with open("/proc/stb/fp/temp_sensor", "r") as f:
                tempinfo = f.read()
        elif path.exists("/proc/stb/sensors/temp/value"):
            with open("/proc/stb/sensors/temp/value", "r") as f:
                tempinfo = f.read()
        if tempinfo and int(tempinfo.replace("\n", "")) > 0:
            AboutText += _("System temp:\t%s") % tempinfo.replace(
                "\n", "").replace(" ", "") + "\xb0" + "C\n"

        tempinfo = ""
        if path.exists("/proc/stb/fp/temp_sensor_avs"):
            with open("/proc/stb/fp/temp_sensor_avs", "r") as f:
                tempinfo = f.read()
        elif path.exists("/sys/devices/virtual/thermal/thermal_zone0/temp"):
            try:
                with open("/sys/devices/virtual/thermal/thermal_zone0/temp",
                          "r") as f:
                    tempinfo = f.read()
                    tempinfo = tempinfo[:-4]
            except:
                tempinfo = ""
        elif path.exists("/proc/hisi/msp/pm_cpu"):
            try:
                tempinfo = search(
                    "temperature = (\d+) degree",
                    open("/proc/hisi/msp/pm_cpu").read()).group(1)
            except:
                tempinfo = ""
        if tempinfo and int(tempinfo) > 0:
            AboutText += _("Processor temp:\t%s") % tempinfo.replace(
                "\n", "").replace(" ", "") + "\xb0" + "C\n"

        imageSubBuild = ""
        if getImageType() != "release":
            imageSubBuild = ".%s" % getImageDevBuild()
        AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(
        ), getImageBuild(), imageSubBuild, getImageType().title())

        if SystemInfo["BoxInfo"]:
            BoxInfo = SystemInfo["BoxInfo"]
            if BoxInfo.getItem(
                    "mtdbootfs") != "" and " " not in BoxInfo.getItem(
                        "mtdbootfs"):
                AboutText += _("Boot Device:\t%s\n") % BoxInfo.getItem(
                    "mtdbootfs")
        if SystemInfo["HasH9SD"]:
            if "rootfstype=ext4" in open(
                    "/sys/firmware/devicetree/base/chosen/bootargs",
                    "r").read():
                part = "        - SD card in use for Image root \n"
            else:
                part = "        - eMMC slot in use for Image root \n"
            AboutText += _("%s") % part

        if SystemInfo["canMultiBoot"]:
            slot = image = SystemInfo["MultiBootSlot"]
            part = "eMMC slot %s" % slot
            bootmode = ""
            if SystemInfo["canMode12"]:
                bootmode = "bootmode = %s" % GetCurrentImageMode()
            print("[About] HasHiSi = %s, slot = %s" %
                  (SystemInfo["HasHiSi"], slot))
            if SystemInfo["HasHiSi"] and "sda" in SystemInfo["canMultiBoot"][
                    slot]["root"]:
                if slot > 4:
                    image -= 4
                else:
                    image -= 1
                part = "SDcard slot %s (%s) " % (
                    image, SystemInfo["canMultiBoot"][slot]["root"])
            AboutText += _("Image Slot:\t%s") % "Startup " + str(
                slot) + " - " + part + " " + bootmode + "\n"

        if getMachineName() in ("ET8500") and path.exists("/proc/mtd"):
            self.dualboot = self.dualBoot()
            if self.dualboot:
                AboutText += _("ET8500 Multiboot: Installed\n")

        skinWidth = getDesktop(0).size().width()
        skinHeight = getDesktop(0).size().height()

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = "-".join((day, month, year))

        AboutText += _("Drivers:\t%s\n") % driversdate
        AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
        AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString(
        ).replace("GStreamer ", "")
        if isPluginInstalled(
                "ServiceApp"
        ) and config.plugins.serviceapp.servicemp3.replace.value == True:
            AboutText += _(
                "4097 iptv player:\t%s\n"
            ) % config.plugins.serviceapp.servicemp3.player.value
        else:
            AboutText += _("4097 iptv player:\tDefault player\n")
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
        flashDate = about.getFlashDateString()[8:] + about.getFlashDateString(
        )[4:8] + about.getFlashDateString()[0:4]
        AboutText += _("Installed:\t%s\n") % flashDate
        lastUpdate = getEnigmaVersionString()[8:] + getEnigmaVersionString(
        )[4:8] + getEnigmaVersionString()[0:4]
        AboutText += _("Last update:\t%s\n") % lastUpdate
        AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
        uptime = about.getBoxUptime()
        if uptime:
            AboutText += _("Uptime:\t%s\n") % uptime
        e2uptime = about.getEnigmaUptime()
        if e2uptime:
            AboutText += _("Enigma2 uptime:\t%s\n") % e2uptime
        AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _(
            "  (%s x %s)") % (skinWidth, skinHeight) + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("FP version:\t%s") % fp_version
            AboutText += fp_version + "\n"

        bootloader = ""
        if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
            f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
            bootloader = f.readline().replace('\x00', '').replace('\n', '')
            f.close()
            AboutText += _("Bootloader:\t%s\n") % (bootloader)

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 53
0
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s\n") % about.getChipSetString()

		AboutText += _("CPU:\t%s\n") % about.getCPUString().replace('bcm', 'BCM')
		AboutText += _("CPU speed:\t%s\n") % about.getCPUSpeedString()
		AboutText += _("Cores:\t%s\n") % about.getCpuCoresString()
		imageSubBuild = ""
		if getImageType() != 'release':
			imageSubBuild = ".%s" % getImageDevBuild()
		AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title())
		skinWidth = getDesktop(0).size().width()
		skinHeight = getDesktop(0).size().height()

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Last update:\t%s\n") % getEnigmaVersionString()
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _("  (%s x %s)") % (skinWidth, skinHeight) + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/sensors/temp/value'):
			f = open('/proc/stb/sensors/temp/value', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

		tempinfo = ""
		if path.exists('/proc/stb/fp/temp_sensor_avs'):
			f = open('/proc/stb/fp/temp_sensor_avs', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("Processor temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"
		AboutLcdText = AboutText.replace('\t', ' ')

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("FP version:\t%s") % fp_version
			AboutText += fp_version + "\n"

		bootloader = ""
		if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
				f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
				bootloader = f.readline().replace('\x00', '').replace('\n', '')
				f.close()
				AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 54
0
    def updateInfo(self):
        rc = system("df -h > /tmp/syinfo.tmp")
        text = _("BOX\n") + _("Brand:") + "\t" + getMachineBrand() + "\n"
        f = open("/proc/stb/info/model", 'r')
        text += _("Model:\t") + f.readline()
        f.close()

        if about.getChipSetString() != _("unavailable"):
            if SystemInfo["HasHiSi"]:
                text += _("Chipset:\tHiSilicon %s\n") % about.getChipSetString(
                ).upper()
            elif about.getIsBroadcom():
                text += _("Chipset:\tBroadcom %s\n") % about.getChipSetString(
                ).upper()
            else:
                text += _("Chipset:\t%s\n") % about.getChipSetString().upper()

        text += _("MEMORY\n")
        memTotal = memFree = swapTotal = swapFree = 0
        for line in open("/proc/meminfo", 'r'):
            parts = line.split(':')
            key = parts[0].strip()
            if key == "MemTotal":
                memTotal = parts[1].strip()
            elif key in ("MemFree", "Buffers", "Cached"):
                memFree += int(parts[1].strip().split(' ', 1)[0])
            elif key == "SwapTotal":
                swapTotal = parts[1].strip()
            elif key == "SwapFree":
                swapFree = parts[1].strip()
        text += _("Total memory:") + "\t%s\n" % memTotal
        text += _("Free memory:") + "\t%s kB\n" % memFree
        text += _("Swap total:") + "\t%s \n" % swapTotal
        text += _("Swap free:") + "\t%s \n" % swapFree
        text += "\n" + _("STORAGE") + "\n"
        f = open("/tmp/syinfo.tmp", 'r')
        line = f.readline()
        parts = line.split()
        text += parts[0] + "\t" + parts[1].strip() + "      " + parts[2].strip(
        ) + "    " + parts[3].strip() + "    " + parts[4] + "\n"
        line = f.readline()
        parts = line.split()
        text += _("Flash") + "\t" + parts[1].strip() + "  " + parts[2].strip(
        ) + "  " + parts[3].strip() + "  " + parts[4] + "\n"
        for line in f.readlines():
            if line.find('/media/') != -1:
                line = line.replace('/media/', '   ')
                parts = line.split()
                if len(parts) == 6:
                    text += parts[5] + "\t" + parts[1].strip(
                    ) + "  " + parts[2].strip() + "  " + parts[3].strip(
                    ) + "  " + parts[4] + "\n"
        f.close()
        os_remove("/tmp/syinfo.tmp")

        text += "\n" + _("SOFTWARE") + "\n"
        f = open("/etc/bpversion", 'r')
        text += "Firmware v.:\t" + f.readline()
        f.close()
        text += "Enigma2 v.: \t" + about.getEnigmaVersionString() + "\n"
        text += "Kernel v.: \t" + about.getKernelVersionString() + "\n"

        self["lab1"].setText(text)
Esempio n. 55
0
	def __init__(self, session):
		Screen.__init__(self, session)

		# [ IQON : by knuth
		model = HardwareInfo().get_device_name() 
		macaddress = about.getMacAddressString("eth0")

		if model in ("force2solid"):
			AboutText = _("BRAND: ") + "IQON" + "\n"
			AboutText += _("Hardware: ") + "FORCE2" + "\n"
		elif model in ("tmnanose"):
			AboutText = _("Hardware: ") + "TM-NANO-SE" + "\n"
		elif model in ("optimussosplus"):
			AboutText = _("Hardware: ") + "OPTIMUSS OS+" + "\n"
		elif model in ("force2plus"):
			AboutText = _("Hardware: ") + "FORCE2+" + "\n"
		elif model in ("tmnanosecombo"):
			AboutText = _("Hardware: ") + "TM-NANO-SE Combo" + "\n"
		elif model in ("tmnanosem2"):
			AboutText = _("Hardware: ") + "TM-NANO-SE M2" + "\n"
		elif model in ("optimussos2"):
			AboutText = _("Hardware: ") + "OPTIMUSS OS2" + "\n"
		elif model in ("optimussos1"):
			AboutText = _("Hardware: ") + "OPTIMUSS OS1" + "\n"
		elif model in ("optimussos2plus"):
			AboutText = _("Hardware: ") + "OPTIMUSS OS2+" + "\n"
		elif model in ("optimussos1plus"):
			AboutText = _("Hardware: ") + "OPTIMUSS OS1+" + "\n"
		elif model in ("force2eco"):
			AboutText = _("Hardware: ") + "FORCE2 Eco" + "\n"
		elif model in ("fusionhd"):
			AboutText = _("Hardware: ") + "FUSION HD" + "\n"
		elif model in ("force1plus"):
			f = open("/etc/.brandtype", 'r')
			line = f.readline()
			if "technomate" in line:
				AboutText = _("Hardware: ") + "TM-NANO-3T COMBO" + "\n"
			elif "edision" in line:
				AboutText = _("Hardware: ") + "OPTIMUSS OS3+" + "\n"
			elif "iqon" in line:
				AboutText = _("BRAND: ") + "IQON" + "\n"
				AboutText += _("Hardware: ") + about.getHardwareTypeString() + "\n"
			else:
				AboutText = _("Hardware: ") + about.getHardwareModelString() + "\n"
			f.close()
		else:
			AboutText = _("Hardware: ") + about.getHardwareModelString() + "\n"

		AboutText += _("Mac Address: ") + macaddress + "\n"
		if HardwareInfo().has_micom():
			AboutText += _("Micom Version: ") + about.getMicomVersionString() + "\n"
#		AboutText = _("Hardware: ") + about.getHardwareTypeString() + "\n"
		AboutText += _("Image: ") + about.getImageTypeString() + "\n"
		AboutText += _("Kernel version: ") + about.getKernelVersionString() + "\n"

		EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		AboutText += EnigmaVersion + "\n"

		ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
		self["ImageVersion"] = StaticText(ImageVersion)
		AboutText += ImageVersion + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		else:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

#        if path.exists('/proc/stb/info/chipset'):
		AboutText += _("Chipset: BCM%s\n") % about.getChipSetString()
		AboutText += _("CPU: %s\n") % about.getCPUString()
		AboutText += _("CPU Speed: %s\n") % about.getCPUSpeedString()
		AboutText += _("Cores: %s\n") % about.getCpuCoresString()

		self["FPVersion"] = StaticText(fp_version)

		self["TunerHeader"] = StaticText(_("Detected NIMs:"))
		AboutText += "\n" + _("Detected NIMs:") + "\n"

		nims = nimmanager.nimList()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")
			AboutText += nims[count] + "\n"

		self["HDDHeader"] = StaticText(_("Detected HDD:"))
		AboutText += "\n" + _("Detected HDD:") + "\n"

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += "%s\n(%s, %d GB %s)" % (hdd.model(), hdd.capacity(), hdd.free()/1024, _("free"))
				else:
					hddinfo += "%s\n(%s, %d MB %s)" % (hdd.model(), hdd.capacity(), hdd.free(), _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		AboutText += hddinfo
		self["AboutScrollLabel"] = ScrollLabel(AboutText)
		self["key_green"] = Button(_("Translations"))
		self["key_red"] = Button(_("Latest Commits"))

		self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"red": self.showCommits,
				"green": self.showTranslationInfo,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})

		self["hidden_action"] = ActionMap(["ColorActions"],
		{
			"red": self.red_action,
			"blue": self.blue_action,
			"info": self.info_action,
			"1": self.first_action,
			"2": self.second_action,
			"3": self.third_action,
		},-1)

		self.key_status = -1
Esempio n. 56
0
def getAboutText():
    AboutText = ""

    AboutText += _("Model:\t %s %s\n") % (getMachineBrand(), getMachineName())

    bootloader = ""
    if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
        f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
        bootloader = f.readline().replace('\x00', '').replace('\n', '')
        f.close()
        AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

    if about.getChipSetString() != _("unavailable"):
        if about.getIsBroadcom():
            AboutText += _("Chipset:\t BCM%s\n") % str(
                about.getChipSetString().upper())
        else:
            AboutText += _("Chipset:\t %s\n") % str(
                about.getChipSetString().upper())

    bogoMIPS = ""
    if path.exists('/proc/cpuinfo'):
        f = open('/proc/cpuinfo', 'r')
        temp = f.readlines()
        f.close()
        try:
            for lines in temp:
                lisp = lines.split(': ')
                if lisp[0].startswith('BogoMIPS'):
                    bogoMIPS = "" + str(int(float(lisp[1].replace('\n',
                                                                  '')))) + ""
                    #bogoMIPS = "" + lisp[1].replace('\n','') + ""
                    break
        except:
            pass

    cpuMHz = ""
    if getMachineBuild() in ('vusolo4k', 'vuultimo4k', 'vuzero4k'):
        cpuMHz = "   (1,5 GHz)"
    elif getMachineBuild() in ('formuler1tc', 'formuler1', 'triplex',
                               'tiviaraplus'):
        cpuMHz = "   (1,3 GHz)"
    elif getMachineBuild() in ('u51', 'u5', 'u53', 'u52', 'u5pvr', 'h9'):
        cpuMHz = "   (1,6 GHz)"
    elif getMachineBuild() in ('vuuno4kse', 'vuuno4k', 'dm900', 'dm920',
                               'gb7252', 'dags7252', 'xc7439', '8100s'):
        cpuMHz = "   (1,7 GHz)"
    elif getMachineBuild() in ('alien5'):
        cpuMHz = "   (2,0 GHz)"
    elif getMachineBuild() in ('sf5008', 'et13000', 'et1x000', 'hd52', 'hd51',
                               'sf4008', 'vs1500', 'h7'):
        try:
            import binascii
            f = open(
                '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency',
                'rb')
            clockfrequency = f.read()
            f.close()
            cpuMHz = "   (%s MHz)" % str(
                round(int(binascii.hexlify(clockfrequency), 16) / 1000000, 1))
        except:
            cpuMHz = "   (1,7 GHz)"
    else:
        if path.exists('/proc/cpuinfo'):
            f = open('/proc/cpuinfo', 'r')
            temp = f.readlines()
            f.close()
            try:
                for lines in temp:
                    lisp = lines.split(': ')
                    if lisp[0].startswith('cpu MHz'):
                        #cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
                        cpuMHz = "   (" + str(
                            int(float(lisp[1].replace('\n', '')))) + " MHz)"
                        break
            except:
                pass

    openLD = "OpenLD "

    AboutText += _("CPU:\t %s") % str(
        about.getCPUString()) + cpuMHz + " " + str(
            about.getCpuCoresString2()) + "\n"
    AboutText += _("Cores:\t %s") % str(about.getCpuCoresString()) + "\n"

    imagestarted = ""
    bootname = ''
    if path.exists('/boot/bootname'):
        f = open('/boot/bootname', 'r')
        bootname = f.readline().split('=')[1]
        f.close()

    if path.exists('/boot/STARTUP'):
        f = open('/boot/STARTUP', 'r')
        f.seek(22)
        image = f.read(1)
        f.close()
        if bootname: bootname = "   (%s)" % bootname
        AboutText += _(
            "Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"
    elif path.exists('/boot/cmdline.txt'):
        f = open('/boot/cmdline.txt', 'r')
        f.seek(38)
        image = f.read(1)
        f.close()
        if bootname: bootname = "   (%s)" % bootname
        AboutText += _(
            "Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"

    AboutText += _("Architecture:\t %s") % str(about.getCPUArch()) + "\n"
    AboutText += _("BogoMIPS:\t %s") % bogoMIPS + "\n"
    AboutText += _("Firmware:\t %s") % openLD + str(getImageVersion()) + "\n"
    #AboutText += _("Build:\t %s") % getImageBuild() + "\n"
    #AboutText += _("Image Type:\t%s\n") % getImageType() + "\n"
    AboutText += _("CodeName:\t %s") % getImageCodeName() + "\n"
    AboutText += _("Kernel:\t %s") % str(about.getKernelVersionString()) + "\n"
    AboutText += _("DVB drivers:\t %s") % str(
        about.getDriverInstalledDate()) + "\n"
    AboutText += _("Last update:\t %s") % MyDateConverter(
        str(getEnigmaVersionString())) + "\n"
    AboutText += _("Restarts:\t %d ") % config.misc.startCounter.value + "\n"
    AboutText += _("Uptime:\t %s") % str(about.getUptimeString()) + "\n"
    AboutText += _("GStreamer:\t %s") % str(
        about.getGStreamerVersionString().replace('GStreamer', '')) + "\n"
    if path.exists('/usr/bin/ffmpeg'):
        try:
            AboutText += _("FFmpeg:\t %s") % str(
                about.getFFmpegVersionString()) + "\n"
        except:
            pass
    AboutText += _("Python:\t %s") % str(
        about.getPythonVersionString()) + "\n\n"
    #AboutText += _("CPU Load:\t %s") % str(about.getLoadCPUString()) + "\n"

    #AboutText += _("Installed:\t ") + about.getFlashDateString() + "\n"
    #AboutText += _("Restarts:\t %d ") % config.misc.startCounter.value + "\n\n"

    fp_version = getFPVersion()
    if fp_version is None:
        fp_version = ""
    elif fp_version != 0:
        fp_version = _("Frontprocessor version: %s") % fp_version
    else:
        fp_version = _("Frontprocessor version: %d") % fp_version
        AboutText += fp_version + "\n"

    tempinfo = ""
    if path.exists('/proc/stb/sensors/temp0/value'):
        f = open('/proc/stb/sensors/temp0/value', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/fp/temp_sensor'):
        f = open('/proc/stb/fp/temp_sensor', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/sensors/temp/value'):
        f = open('/proc/stb/sensors/temp/value', 'r')
        tempinfo = f.read()
        f.close()
    if tempinfo and int(tempinfo.replace('\n', '')) > 0:
        mark = str('\xc2\xb0')
        AboutText += _("System temperature:\t%s") % tempinfo.replace(
            '\n', '').replace(' ', '') + mark + "C\n"

    tempinfo = ""
    if path.exists('/proc/stb/fp/temp_sensor_avs'):
        f = open('/proc/stb/fp/temp_sensor_avs', 'r')
        tempinfo = f.read()
        f.close()
    elif path.exists('/proc/stb/power/avs'):
        try:
            f = open('/proc/stb/power/avs', 'r')
            temp = f.read()
            celsius = temp[0:-1]
            tempinfo = celsius
            f.close()
        except:
            tempinfo = ""
    elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
        try:
            f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
            temp = f.read()
            tempinfo = temp[:-4]
            f.close()
        except:
            tempinfo = ""
    if tempinfo and str(round(int(tempinfo.replace('\n', '')))) > 0:
        mark = str('\xc2\xb0')
        AboutText += _("Processor temperature:\t%s") % tempinfo.replace(
            '\n', '').replace(' ', '') + mark + "C\n"
    AboutLcdText = AboutText.replace('\t', ' ')

    return AboutText, AboutLcdText
Esempio n. 57
0
	def imageInfo(self):
		AboutText = _("Full Image Backup ")
		AboutText += _("By Bh Team") + "\n"
		AboutText += _("Support at") + " www.vuplus-community.net\n\n"
		AboutText += _("[Image Info]\n")
		AboutText += _("Model: %s %s\n") % (getMachineBrand(), getMachineName())
		AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d", localtime(self.START))

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset: BCM%s") % about.getChipSetString().lower().replace('\n','').replace('bcm','') + "\n"

		AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"

		AboutText += _("Version: %s") % getImageVersion() + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
		AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s") % driversdate + "\n"

		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

		AboutText += _("[Enigma2 Settings]\n")
		AboutText += commands.getoutput("cat /etc/enigma2/settings")
		AboutText += _("\n\n[User - bouquets (TV)]\n")
		try:
			f = open("/etc/enigma2/bouquets.tv","r")
			lines = f.readlines()
			f.close()
			for line in lines:
				if line.startswith("#SERVICE:"):
					bouqet = line.split()
					if len(bouqet) > 3:
						bouqet[3] = bouqet[3].replace('"','')
						f = open("/etc/enigma2/" + bouqet[3],"r")
						userbouqet = f.readline()
						AboutText += userbouqet.replace('#NAME ','')
						f.close()
		except:
			AboutText += "Error reading bouquets.tv"
			
		AboutText += _("\n[User - bouquets (RADIO)]\n")
		try:
			f = open("/etc/enigma2/bouquets.radio","r")
			lines = f.readlines()
			f.close()
			for line in lines:
				if line.startswith("#SERVICE:"):
					bouqet = line.split()
					if len(bouqet) > 3:
						bouqet[3] = bouqet[3].replace('"','')
						f = open("/etc/enigma2/" + bouqet[3],"r")
						userbouqet = f.readline()
						AboutText += userbouqet.replace('#NAME ','')
						f.close()
		except:
			AboutText += "Error reading bouquets.radio"

		AboutText += _("\n[Installed Plugins]\n")
		AboutText += commands.getoutput("opkg list_installed | grep enigma2-plugin-")

		return AboutText
Esempio n. 58
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" },
							"auto":		{ 50: "720p50", 60: "720p", 24: "720p24" } }

	rates["1080i"] =	{	"50Hz":		{ 50: "1080i50" },
							"60Hz":		{ 60: "1080i" },
							"multi":	{ 50: "1080i50", 60: "1080i" },
							"auto":		{ 50: "1080i50", 60: "1080i", 24: "1080p24" } }

	rates["1080p"] =	{ 	"50Hz":		{ 50: "1080p50" },
							"60Hz":		{ 60: "1080p" },
							"multi":	{ 50: "1080p50", 60: "1080p" },
							"auto":		{ 50: "1080p50", 60: "1080p", 24: "1080p24" } }

	if getBoxType().startswith('dm9'):
		rates["2160p"] =	{ 	"50Hz":		{ 50: "2160p50" },
								"60Hz":		{ 60: "2160p60" },
								"multi":	{ 50: "2160p50", 60: "2160p60" },
								"auto":		{ 50: "2160p50", 60: "2160p60", 24: "2160p24" } }
	else:
		rates["2160p"] =	{ 	"50Hz":		{ 50: "2160p50" },
								"60Hz":		{ 60: "2160p" },
								"multi":	{ 50: "2160p50", 60: "2160p" },
								"auto":		{ 50: "2160p50", 60: "2160p", 24: "2160p24" } }

	rates["2160p30"] =	{ 	"25Hz":		{ 50: "2160p25" },
							"30Hz":		{ 60: "2160p30"} ,
							"multi":	{ 50: "2160p25", 60: "2160p30" },
							"auto":		{ 50: "2160p25", 60: "2160p30", 24: "2160p24" } }

	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', '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')) 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"}

	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 "[AVSwitch] remove DVI-PC because of not existing modes"
	# 	del modes["DVI-PC"]
	if modes.has_key("YPbPr") and getBoxType() in ('osmio4k','sf8008','clap4k','force4','alien5', 'osninopro','protek4k','viperslim','axashis4kcombo','axashis4kcomboplus','dinobot4kplus','dinobot4kmini','zgemmah9t','zgemmah9s','zgemmah9splus','vuzero4k','vuuno4kse','anadol4k','mediabox4k','dinobot4kl','dinobot4k','dinobot4kse','lunix','purehdse','lunix34k','sf5008','et13000','zgemmah6','vipert2c','vipercombo','vipercombohdd','e4hdultra','evoslimse','evoslimt2c','beyonwizu4','zgemmah4','osnino','osninoplus','axultra','gbue4k','spycat4kcombo','spycat4k','valalinux','formuler4ip','formuler3ip','tm4ksuper','galaxy4k','zgemmah52splus','zgemmah2splus','zgemmah7','zgemmah32tc','zgemmah52tc','alphatriple','gi11000','spycat4kmini','tmtwin4k','tmnanom3','tiviarmin','vimastec1000','vimastec1500', 'gbquad4k','revo4k','force3uhdplus','force3uhd','force2nano','evoslim','zgemmah5ac', 'zgemmah3ac', 'bre2zet2c', 'dm900', 'dm920', 'wetekplay', 'wetekplay2', 'wetekhub', 'bre2ze4k', 'vuuno4k', 'vuultimo4k', 'sf4008', 'e4hdcombo', 'ultrabox', 'osmega', 'tmnano3t', 'novaip', 'novacombo', 'novatwin', 'dm520', 'dm525', 'megaforce2', 'purehd', 'sf128', 'sf138', 'mutant11', 'xpeedlxpro', 'mbtwinplus', 'mutant51', 'ax51', 'twinboxlcdci5' , 'twinboxlcdci', 'singleboxlcd', 'formuler4', 'formuler4turbo', 'zgemmah5', 'zgemmah52s', 'zgemmai55', 'sf98', 'odinplus', 'zgemmaslc', '9900lx', '9910lx', '9911lx', 'vusolo4k', 'et7x00mini', 'evomini', 'evominiplus', 'zgemmahs', 'zgemmah2s', 'zgemmah2h', 't2cable', 'xpeedlxcs2', 'xpeedlxcc', 'osmini', 'osminiplus', 'gbx1', 'gbx2', 'gbx3', 'gbx3h', 'sf3038', 'spycat', 'bwidowx', 'bwidowx2', 'fegasusx3', 'fegasusx5s', 'fegasusx5t', 'force2', 'force2plus', 'force2plushv', 'optimussos', 'tmnanose', 'tmnanosem2', 'tmnanosem2plus', 'tmnanocombo', 'zgemmash1', 'zgemmash2', 'zgemmas2s', 'zgemmass', 'mago', 'enibox', 'sf108', 'x1plus', 'xcombo', 'mutant1100', 'mutant1200', 'mutant1265', 'mutant1500', 'mutant500c', 'mutant530c', 'et4x00', 'et7500', 'et7000', 'et7100', '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 ('osmio4k','force4','alien5','osninopro','protek4k','vuzero4k','vuuno4kse','lunix','purehdse','sf5008','et13000','e4hdultra','beyonwizu4','osnino','osninoplus','axultra','gbue4k','gi11000','spycat4kmini','tmtwin4k','tmnanom3','gbquad4k','revo4k','force3uhd','force2nano','dm900', 'dm920', 'wetekplay', 'wetekplay2', 'wetekhub', 'bre2ze4k', 'vuuno4k', 'vuultimo4k', 'sf4008', 'novaip', 'dm520', 'dm525', 'purehd', 'vusolo4k', 'fusionhdse', 'fusionhd', 'force2', 'force2plus', 'force2plushv', 'optimussos', 'tmnanose', 'tmnanosecombo', 'gbx1', 'gbx2', 'gbx3', 'gbx3h', 'gbultraue', 'gbultraueh', '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.is24hzAvailable()

		self.readPreferredModes()
		self.createConfig()


	def readAvailableModes(self):
		try:
			f = open("/proc/stb/video/videomode_choices")
			modes = f.read()[:-1]
			f.close()
		except IOError:
			print "[AVSwitch] couldn't read available videomodes."
			self.modes_available = [ ]
			return
		self.modes_available = modes.split(' ')

	def readPreferredModes(self):
		if config.av.edid_override.value == False:
			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.modes_available
		else:
			self.modes_preferred = self.modes_available
			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.modes_available

		if self.modes_preferred != self.last_modes_preferred:
			self.last_modes_preferred = self.modes_preferred
			self.on_hotplug("HDMI") # must be HDMI

	def is24hzAvailable(self):
		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 port == "DVI":
				if getBrandOEM() in ('azbox'):
					if mode not in self.modes_preferred and not config.av.edid_override.value:
						print "[AVSwitch] no, not preferred"
						return False
			if port != "HDMI":
				if mode not in self.modes_available:
					return False
			elif mode not in self.modes_preferred:
				return False
		return True

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

	def setMode(self, port, mode, rate, force = None):
		print "[AVSwitch] 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)
		mode_24 = modes.get(24)

		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 mode_24 is None or force:
			mode_24 = mode_60
			if force == 50:
				mode_24 = 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."

		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):
		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.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") and not SystemInfo["have24hz"]:
						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 "[AVSwitch] current port not available, not setting videomode"
			return

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

		if mode not in config.av.videorate:
			print "[AVSwitch] 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 about.getChipSetString() in ('meson-6', 'meson-64'):
				if cfgelement.value == "panscan" : arw = "11"
				if cfgelement.value == "letterbox" : arw = "12"
				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 "[AVSwitch] 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):
		eAVSwitch.getInstance().setAspectRatio(value)

	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