コード例 #1
0
ファイル: Ci.py プロジェクト: OpenLD/enigma2
def InitCiConfig():
	config.ci = ConfigSubList()
	config.cimisc = ConfigSubsection()
	for slot in range(MAX_NUM_CI):
		config.ci.append(ConfigSubsection())
		config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices = [("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))], default = "auto")
		config.ci[slot].use_static_pin = ConfigYesNo(default = True)
		config.ci[slot].static_pin = ConfigPIN(default = 0)
		config.ci[slot].show_ci_messages = ConfigYesNo(default = True)
		if SystemInfo["CommonInterfaceSupportsHighBitrates"]:
			if getBrandOEM() in ('dags', 'blackbox'):
				config.ci[slot].canHandleHighBitrates = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "yes")
			else:
				config.ci[slot].canHandleHighBitrates = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "no")
			config.ci[slot].canHandleHighBitrates.slotid = slot
			config.ci[slot].canHandleHighBitrates.addNotifier(setCIBitrate)
		if SystemInfo["CommonInterfaceCIDelay"]:
			config.cimisc.dvbCiDelay = ConfigSelection(default = "256", choices = [ ("16", _("16")), ("32", _("32")), ("64", _("64")), ("128", _("128")), ("256", _("256"))] )
			config.cimisc.dvbCiDelay.addNotifier(setdvbCiDelay)
		if getBrandOEM() in ('entwopia', 'tripledot', 'dreambox'):
			if SystemInfo["HaveCISSL"]:
				config.cimisc.civersion = ConfigSelection(default = "ciplus1", choices = [("auto", _("Auto")), ("ciplus1", _("CI Plus 1.2")), ("ciplus2", _("CI Plus 1.3")), ("legacy", _("CI Legacy"))])
			else:
				config.cimisc.civersion = ConfigSelection(default = "legacy", choices = [("legacy", _("CI Legacy"))])
		else:
			config.cimisc.civersion = ConfigSelection(default = "auto", choices = [("auto", _("Auto")), ("ciplus1", _("CI Plus 1.2")), ("ciplus2", _("CI Plus 1.3")), ("legacy", _("CI Legacy"))])
コード例 #2
0
ファイル: AVSwitch.py プロジェクト: 1198s/enigma2
	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

		if os.path.exists('/proc/stb/video/videomode_50hz') and getBrandOEM() != 'gigablue':
			f = open("/proc/stb/video/videomode_50hz", "w")
			f.write(mode_50)
			f.close()
		if os.path.exists('/proc/stb/video/videomode_60hz') and getBrandOEM() != 'gigablue':
			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()
コード例 #3
0
	def __init__(self, session, args = None):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Fan Control"))

		templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE)
		tempcount = len(templist)
		fanlist = sensors.getSensorsList(sensors.TYPE_FAN_RPM)
		fancount = len(fanlist)

		self["red"] = StaticText(_("Cancel"))
		self["green"] = StaticText(_("OK"))

		for count in range(8):
			if count < tempcount:
				id = templist[count]
				if getBrandOEM() not in ('dags', 'vuplus'):
					self["SensorTempText%d" % count] = StaticText(sensors.getSensorName(id))
					self["SensorTemp%d" % count] = SensorSource(sensorid = id)
				elif getBrandOEM() in ('dags', 'vuplus') and id < 1:
					self["SensorTempText%d" % count] = StaticText(sensors.getSensorName(id))
					self["SensorTemp%d" % count] = SensorSource(sensorid = id)
				else:
					self["SensorTempText%d" % count] = StaticText("")
					self["SensorTemp%d" % count] = SensorSource()
			else:
				self["SensorTempText%d" % count] = StaticText("")
				self["SensorTemp%d" % count] = SensorSource()

			if count < fancount:
				id = fanlist[count]
				self["SensorFanText%d" % count] = StaticText(sensors.getSensorName(id))
				self["SensorFan%d" % count] = SensorSource(sensorid = id)
			else:
				self["SensorFanText%d" % count] = StaticText("")
				self["SensorFan%d" % count] = SensorSource()

		self.list = []
		for count in range(fancontrol.getFanCount()):
			if getBrandOEM() not in ('dags', 'vuplus'):
				self.list.append(getConfigListEntry(_("Fan %d voltage") % (count + 1), fancontrol.getConfig(count).vlt))
			self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm))
			if getBrandOEM() not in ('dags', 'vuplus'):
				self.list.append(getConfigListEntry(_("Standby fan %d voltage") % (count + 1), fancontrol.getConfig(count).vlt_standby))
			self.list.append(getConfigListEntry(_("Standby fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm_standby))

		ConfigListScreen.__init__(self, self.list, session = self.session)
		#self["config"].list = self.list
		#self["config"].setList(self.list)
		self["config"].l.setSeperation(300)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MenuActions"],
		{
			"ok": self.save,
			"cancel": self.revert,
			"red": self.revert,
			"green": self.save,
			"menu": self.closeRecursive,
		}, -1)
コード例 #4
0
	def revert(self):
		for count in range(fancontrol.getFanCount()):
			if getBrandOEM() not in ('dags', 'vuplus'):
				fancontrol.getConfig(count).vlt.load()
			fancontrol.getConfig(count).pwm.load()
			if getBrandOEM() not in ('dags', 'vuplus'):
				fancontrol.getConfig(count).vlt_standby.load()
			fancontrol.getConfig(count).pwm_standby.load()
		self.close()
コード例 #5
0
 def save(self):
     for count in range(fancontrol.getFanCount()):
         if getBrandOEM() not in ("dags", "vuplus"):
             fancontrol.getConfig(count).vlt.save()
         fancontrol.getConfig(count).pwm.save()
         if getBrandOEM() not in ("dags", "vuplus"):
             fancontrol.getConfig(count).vlt_standby.save()
         fancontrol.getConfig(count).pwm_standby.save()
     self.close()
コード例 #6
0
ファイル: QuickMenu.py プロジェクト: undertaker01/enigma2
	def Qsoftware(self):
		self.sublist = []
		self.sublist.append(QuickSubMenuEntryComponent("Software Update",_("Online software update"),_("Check/Install online updates (you must have a working internet connection)")))
		if not getBoxType().startswith('az') and not getBoxType().startswith('dm') and not getBrandOEM().startswith('cube') and not getBoxType().startswith('vusolo4k'):
			self.sublist.append(QuickSubMenuEntryComponent("Flash Online",_("Flash Online a new image"),_("Flash on the fly your your Receiver software.")))
		if not getBoxType().startswith('az') and not getBrandOEM().startswith('cube') and not getBrandOEM().startswith('wetek'):
			self.sublist.append(QuickSubMenuEntryComponent("Complete Backup",_("Backup your current image"),_("Backup your current image to HDD or USB. This will make a 1:1 copy of your box")))
		self.sublist.append(QuickSubMenuEntryComponent("Backup Settings",_("Backup your current settings"),_("Backup your current settings. This includes E2-setup, channels, network and all selected files")))
		self.sublist.append(QuickSubMenuEntryComponent("Restore Settings",_("Restore settings from a backup"),_("Restore your settings back from a backup. After restore the box will restart to activated the new settings")))
		self.sublist.append(QuickSubMenuEntryComponent("Select Backup files",_("Choose the files to backup"),_("Here you can select which files should be added to backupfile. (default: E2-setup, channels, network")))
		self.sublist.append(QuickSubMenuEntryComponent("Software Manager Setup",_("Manage your online update files"),_("Here you can select which files should be updated with a online update")))
		self["sublist"].l.setList(self.sublist)
コード例 #7
0
ファイル: StbHardware.py プロジェクト: popazerty/e2-gui
def setRTCtime(wutime):
	if getBrandOEM() == 'ini' or getBrandOEM() == 'fulan':
		setRTCoffset()
	try:
		f = open("/proc/stb/fp/rtc", "w")
		f.write(str(wutime))
		f.close()
	except IOError:
		try:
			fp = open("/dev/dbox/fp0")
			ioctl(fp.fileno(), 0x101, pack('L', wutime)) # set wake up
			fp.close()
		except IOError:
			print "setRTCtime failed!"
コード例 #8
0
ファイル: ImageManager.py プロジェクト: MCelliotG/vix-core
	def doBackup4(self):
		print '[ImageManager] Stage4: Moving from work to backup folders'
		move('%s/rootfs.%s' % (self.WORKDIR, self.ROOTFSTYPE), '%s/%s' % (self.MAINDEST, self.rootFILE))
		if self.ROOTFSTYPE == 'tar.bz2' and path.exists('%s/vmlinux.tar.bz2' % self.WORKDIR):
			move('%s/vmlinux.tar.bz2' % self.WORKDIR, '%s/%s' % (self.MAINDEST, self.kernelFILE))
		else:
			move('%s/vmlinux.gz' % self.WORKDIR, '%s/%s' % (self.MAINDEST, self.kernelFILE))
		fileout = open(self.MAINDEST + '/imageversion', 'w')
		line = defaultprefix + '-' + getImageType() + '-backup-' + getImageVersion() + '.' + getImageBuild() + '-' + self.BackupDate
		fileout.write(line)
		fileout.close()
		if getBrandOEM() ==  'vuplus':
			if getMachineBuild() == 'vuzero':
				fileout = open(self.MAINDEST + '/force.update', 'w')
				line = "This file forces the update."
				fileout.write(line)
				fileout.close()
			else:
				fileout = open(self.MAINDEST + '/reboot.update', 'w')
				line = "This file forces a reboot after the update."
				fileout.write(line)
				fileout.close()
			imagecreated = True
		elif getBrandOEM() in ('xtrend', 'gigablue', 'odin', 'xp', 'ini'):
			if getBrandOEM() in ('xtrend', 'odin', 'ini'):
				fileout = open(self.MAINDEST + '/noforce', 'w')
				line = "rename this file to 'force' to force an update without confirmation"
				fileout.write(line)
				fileout.close()
			if path.exists('/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/burn.bat'):
				copy('/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/burn.bat', self.MAINDESTROOT + '/burn.bat')
		print '[ImageManager] Stage4: Removing Swap.'
		if path.exists(self.swapdevice + config.imagemanager.folderprefix.value + '-' + getImageType() + "-swapfile_backup"):
			system('swapoff ' + self.swapdevice + config.imagemanager.folderprefix.value + '-' + getImageType() + "-swapfile_backup")
			remove(self.swapdevice + config.imagemanager.folderprefix.value + '-' + getImageType() + "-swapfile_backup")
		if path.exists(self.WORKDIR):
			rmtree(self.WORKDIR)
		if path.exists(self.MAINDEST + '/' + self.rootFILE) and path.exists(self.MAINDEST + '/' + self.kernelFILE):
			for root, dirs, files in walk(self.MAINDEST):
				for momo in dirs:
					chmod(path.join(root, momo), 0644)
				for momo in files:
					chmod(path.join(root, momo), 0644)
			print '[ImageManager] Stage4: Image created in ' + self.MAINDESTROOT
			self.Stage4Complete()
		else:
			print "[ImageManager] Stage4: Image creation failed - e. g. wrong backup destination or no space left on backup device"
			self.BackupComplete()
コード例 #9
0
ファイル: HardwareInfo.py プロジェクト: sodo13/EG-gui
    def __init__(self):
        if HardwareInfo.device_name is not None:
            return
        HardwareInfo.device_name = 'unknown'
        try:
            file = open('/proc/stb/info/model', 'r')
            HardwareInfo.device_name = file.readline().strip()
            file.close()
            if getBrandOEM() == 'dags':
                HardwareInfo.device_name = 'dm800se'
            try:
                file = open('/proc/stb/info/version', 'r')
                HardwareInfo.device_version = file.readline().strip()
                file.close()
            except:
                pass

        except:
            print '----------------'
            print 'you should upgrade to new drivers for the hardware detection to work properly'
            print '----------------'
            print 'fallback to detect hardware via /proc/cpuinfo!!'
            try:
                rd = open('/proc/cpuinfo', 'r').read()
                if 'Brcm4380 V4.2' in rd:
                    HardwareInfo.device_name = 'dm8000'
                    print 'dm8000 detected!'
                elif 'Brcm7401 V0.0' in rd:
                    HardwareInfo.device_name = 'dm800'
                    print 'dm800 detected!'
                elif 'MIPS 4KEc V4.8' in rd:
                    HardwareInfo.device_name = 'dm7025'
                    print 'dm7025 detected!'
            except:
                pass
コード例 #10
0
ファイル: Rc.py プロジェクト: kingvuplus/eg-e2
 def initRc(self):
     if getBrandOEM() == 'ini':
         self['rc'].setPixmapNum(config.misc.rcused.value)
     elif self.isDefaultRc:
         self['rc'].setPixmapNum(config.misc.rcused.value)
     else:
         self['rc'].setPixmapNum(0)
コード例 #11
0
ファイル: Standby.py プロジェクト: vitmod/dvbapp
	def __onClose(self):
		global inStandby
		inStandby = None
		self.standbyTimeoutTimer.stop()
		self.standbyStopServiceTimer.stop()
		self.timeHandler and self.timeHandler.m_timeUpdated.get().remove(self.stopService)
		if self.paused_service:
			self.infoBarInstance.unPauseService()
		elif self.prev_running_service:
			service = self.prev_running_service.toString()
			if config.servicelist.startupservice_onstandby.value:
				self.session.nav.playService(eServiceReference(config.servicelist.startupservice.value))
				from Screens.InfoBar import InfoBar
				InfoBar.instance and InfoBar.instance.servicelist.correctChannelNumber()
			else:
				self.session.nav.playService(self.prev_running_service)
		self.session.screen["Standby"].boolean = False
		globalActionMap.setEnabled(True)
		if (getBrandOEM() in ('fulan')):
			open("/proc/stb/hdmi/output", "w").write("on")

		for hdd in harddiskmanager.HDDList():
			hdd[1].setIdleTime(int(config.usage.hdd_standby.value)) # HDD standby timer value (box active)
		if RecordTimer.RecordTimerEntry.receiveRecordEvents:
			RecordTimer.RecordTimerEntry.stopTryQuitMainloop()
コード例 #12
0
ファイル: ImageManager.py プロジェクト: sodo13/Atemio-all
	def doBackup4(self):
		print '[ImageManager] Stage4: Moving from work to backup folders'
		move(self.WORKDIR + '/root.' + self.ROOTFSTYPE, self.MAINDEST + '/' + self.rootFILE)
		move(self.WORKDIR + '/vmlinux.gz', self.MAINDEST + '/' + self.kernelFILE)
		if getBrandOEM() ==  'ini':
			fileout = open(self.MAINDEST + '/noforce', 'w')
			line = "rename this file to 'force' to force an update without confirmation"
			fileout.write(line)
			fileout.close()
			fileout = open(self.MAINDEST + '/imageversion', 'w')
			line = "Atemio-" + self.BackupDate
			fileout.write(line)
			fileout.close()
			imagecreated = True
		print '[ImageManager] Stage4: Removing Swap.'
		if path.exists(self.swapdevice + config.imagemanager.folderprefix.value + "-swapfile_backup"):
			system('swapoff ' + self.swapdevice + config.imagemanager.folderprefix.value + "-swapfile_backup")
			remove(self.swapdevice + config.imagemanager.folderprefix.value + "-swapfile_backup")
		if path.exists(self.WORKDIR):
			rmtree(self.WORKDIR)
		if path.exists(self.MAINDEST + '/' + self.rootFILE) and path.exists(self.MAINDEST + '/' + self.kernelFILE):
			for root, dirs, files in walk(self.MAINDEST):
				for momo in dirs:
					chmod(path.join(root, momo), 0644)
				for momo in files:
					chmod(path.join(root, momo), 0644)
			print '[ImageManager] Stage4: Image created in ' + self.MAINDESTROOT
			self.Stage4Complete()
		else:
			print "[ImageManager] Stage4: Image creation failed - e. g. wrong backup destination or no space left on backup device"
			self.BackupComplete()
コード例 #13
0
ファイル: ImageBackup.py プロジェクト: Mariusz1970/enigma2
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		
		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		self["key_yellow"] = Button("")
		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], 
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
コード例 #14
0
ファイル: Standby.py プロジェクト: iqas/enigma2
	def __init__(self, session):
		Screen.__init__(self, session)
		self.skinName = "Standby"
		self.avswitch = AVSwitch()

		print "[Standby] enter standby"

		self["actions"] = ActionMap( [ "StandbyActions" ],
		{
			"power": self.Power,
			"discrete_on": self.Power
		}, -1)

		globalActionMap.setEnabled(False)

		self.standbyTimeUnknownTimer = eTimer()

		#mute adc
		self.setMute()
	
		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			# set LCDminiTV off
			setLCDModeMinitTV("0")

		self.paused_service = None
		self.prev_running_service = None

		if self.session.current_dialog:
			if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
				if localtime(time()).tm_year > 1970 and self.session.nav.getCurrentlyPlayingServiceOrGroup():
					if config.servicelist.startupservice_standby.value:
						self.prev_running_service = eServiceReference(config.servicelist.startupservice_standby.value)
					else:
						self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup()
					self.session.nav.stopService()
				else:
					self.standbyTimeUnknownTimer.callback.append(self.stopService)
					self.standbyTimeUnknownTimer.startLongTimer(60)
			elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
				self.paused_service = self.session.current_dialog
				self.paused_service.pauseService()
		if self.session.pipshown:
			from Screens.InfoBar import InfoBar
			InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()

		#set input to vcr scart
		if SystemInfo["ScartSwitch"]:
			self.avswitch.setInput("SCART")
		else:
			self.avswitch.setInput("AUX")
		if (getBrandOEM() in ('fulan')):
			open("/proc/stb/hdmi/output", "w").write("off")

		if int(config.usage.hdd_standby_in_standby.value) != -1: # HDD standby timer value (box in standby) / -1 = same as when box is active
			for hdd in harddiskmanager.HDDList():
				hdd[1].setIdleTime(int(config.usage.hdd_standby_in_standby.value))

		self.onFirstExecBegin.append(self.__onFirstExecBegin)
		self.onClose.append(self.__onClose)
コード例 #15
0
ファイル: Rc.py プロジェクト: postla/OpenNFR-E2
	def initRc(self):
		if getBrandOEM() == 'ini':
			self["rc"].setPixmapNum(config.misc.rcused.getValue())
		else:
			if self.isDefaultRc:
				self["rc"].setPixmapNum(config.misc.rcused.getValue())
			else:
				self["rc"].setPixmapNum(0)
コード例 #16
0
ファイル: InputDevice.py プロジェクト: henrylicious/test
	def __init__(self):
		if pathExists('/proc/stb/ir/rc/type') and getBrandOEM() not in ('gigablue', 'odin', 'ini', 'entwopia', 'tripledot'):
			self.isSupported = True

			if config.plugins.remotecontroltype.rctype.value != 0:
				self.writeRcType(config.plugins.remotecontroltype.rctype.value)
		else:
			self.isSupported = False
コード例 #17
0
	def setOSDHeight(configElement):
		if SystemInfo["CanChangeOsdPosition"]:
			if getBrandOEM() in ('dreambox'):
				f = open("/proc/stb/vmpeg/0/dst_height", "w")
			else:
				f = open("/proc/stb/fb/dst_height", "w")
			f.write('%X' % configElement.value)
			f.close()
コード例 #18
0
ファイル: InputDevice.py プロジェクト: openmb/stb-gui
	def __init__(self):
		if SystemInfo["RcTypeChangable"] and os.path.exists('/proc/stb/info/boxtype') and getBrandOEM() not in ('gigablue', 'odin', 'ini', 'entwopia', 'tripledot'):
			self.isSupported = True
			self.boxType = open('/proc/stb/info/boxtype', 'r').read().strip()
			if config.plugins.remotecontroltype.rctype.value != 0:
				self.writeRcType(config.plugins.remotecontroltype.rctype.value)
		else:
			self.isSupported = False
コード例 #19
0
	def info(self):
		self.selLine = self["filedata"].getSelectionIndex()
		self.oldLine = self.list[self.selLine]
		if getBrandOEM() == "fulan":
			target = "/usr/bin/iperf -c %s" % self.oldLine	
		else:
			target = "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/data/iperf -c %s" % self.oldLine	
		
		self.session.open(Console, title=_("iperf Net_test..."), cmdlist = [target], closeOnSuccess = False)
コード例 #20
0
ファイル: Standby.py プロジェクト: kingvuplus/boom
 def Power(self):
     print '[Standby] leave standby'
     if getBrandOEM() in 'fulan':
         open('/proc/stb/hdmi/output', 'w').write('on')
     self.avswitch.setInput('ENCODER')
     self.leaveMute()
     if SystemInfo['Display'] and SystemInfo['LCDMiniTV']:
         setLCDModeMinitTV(config.lcd.modeminitv.value)
     self.close(True)
コード例 #21
0
ファイル: Ci.py プロジェクト: openhdf/enigma2
def InitCiConfig():
	config.ci = ConfigSubList()
	config.cimisc = ConfigSubsection()
	for slot in range(MAX_NUM_CI):
		config.ci.append(ConfigSubsection())
		config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices = [("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))], default = "auto")
		config.ci[slot].use_static_pin = ConfigYesNo(default = True)
		config.ci[slot].static_pin = ConfigPIN(default = 0)
		config.ci[slot].show_ci_messages = ConfigYesNo(default = True)
		if SystemInfo["CommonInterfaceSupportsHighBitrates"]:
			if getBrandOEM() in ('dags', 'blackbox'):
				config.ci[slot].canHandleHighBitrates = ConfigYesNo(default = True)
			else:
				config.ci[slot].canHandleHighBitrates = ConfigYesNo(default = False)
			config.ci[slot].canHandleHighBitrates.slotid = slot
			config.ci[slot].canHandleHighBitrates.addNotifier(setCIBitrate)
		if SystemInfo["RelevantPidsRoutingSupport"]:
			global relevantPidsRoutingChoices
			if not relevantPidsRoutingChoices:
				relevantPidsRoutingChoices = [("no", _("No")), ("yes", _("Yes"))]
				default = "no"
				fileName = "/proc/stb/tsmux/ci%d_relevant_pids_routing_choices"
			if fileExists(fileName, 'r'):
				relevantPidsRoutingChoices = []
				fd = open(fileName, 'r')
				data = fd.read()
				data = data.split()
				for x in data:
					relevantPidsRoutingChoices.append((x, _(x)))
				if default not in data:
					default = data[0]
			config.ci[slot].relevantPidsRouting = ConfigSelection(choices = relevantPidsRoutingChoices, default = default)
			config.ci[slot].relevantPidsRouting.slotid = slot
			config.ci[slot].relevantPidsRouting.addNotifier(setRelevantPidsRouting)
	if SystemInfo["CommonInterfaceCIDelay"]:
		config.cimisc.dvbCiDelay = ConfigSelection(default = "256", choices = [ ("16", _("16")), ("32", _("32")), ("64", _("64")), ("128", _("128")), ("256", _("256"))] )
		config.cimisc.dvbCiDelay.addNotifier(setdvbCiDelay)
	if getBrandOEM() in ('entwopia', 'tripledot', 'dreambox'):
		if SystemInfo["HaveCISSL"]:
			config.cimisc.civersion = ConfigSelection(default = "ciplus1", choices = [("auto", _("Auto")), ("ciplus1", _("CI Plus 1.2")), ("ciplus2", _("CI Plus 1.3")), ("legacy", _("CI Legacy"))])
		else:
			config.cimisc.civersion = ConfigSelection(default = "legacy", choices = [("legacy", _("CI Legacy"))])
	else:
		config.cimisc.civersion = ConfigSelection(default = "auto", choices = [("auto", _("Auto")), ("ciplus1", _("CI Plus 1.2")), ("ciplus2", _("CI Plus 1.3")), ("legacy", _("CI Legacy"))])
コード例 #22
0
def InitOsd():
    SystemInfo["CanChange3DOsd"] = access("/proc/stb/fb/3dmode", R_OK) and True or False
    SystemInfo["CanChangeOsdAlpha"] = access("/proc/stb/video/alpha", R_OK) and True or False
    if SystemInfo["CanChangeOsdAlpha"] == True:
        SystemInfo["OsdMenu"] = True
    else:
        SystemInfo["OsdMenu"] = False

    if getBrandOEM() in ("fulan"):
        SystemInfo["CanChange3DOsd"] = False

    def setOSDAlpha(configElement):
        if SystemInfo["CanChangeOsdAlpha"]:
            print "Setting OSD alpha:", str(configElement.value)
            config.av.osd_alpha.setValue(configElement.value)
            f = open("/proc/stb/video/alpha", "w")
            f.write(str(configElement.value))
            f.close()

    config.osd.alpha.addNotifier(setOSDAlpha)

    def set3DMode(configElement):
        if SystemInfo["CanChange3DOsd"]:
            value = configElement.value
            print "Setting 3D mode:", value
            try:
                if SystemInfo["CanUse3DModeChoices"]:
                    f = open("/proc/stb/fb/3dmode_choices", "r")
                    choices = f.readlines()[0].split()
                    f.close()
                    if value not in choices:
                        if value == "sidebyside":
                            value = "sbs"
                        elif value == "topandbottom":
                            value = "tab"
                        elif value == "auto":
                            value = "off"
                f = open("/proc/stb/fb/3dmode", "w")
                f.write(value)
                f.close()
            except:
                pass

    config.osd.threeDmode.addNotifier(set3DMode)

    def set3DZnorm(configElement):
        if SystemInfo["CanChange3DOsd"]:
            print "Setting 3D depth:", configElement.value
            try:
                f = open("/proc/stb/fb/znorm", "w")
                f.write("%d" % int(configElement.value))
                f.close()
            except:
                pass

    config.osd.threeDznorm.addNotifier(set3DZnorm)
コード例 #23
0
ファイル: AVSwitch.py プロジェクト: sklnet/opennfr-enigma2
	def setColorFormat(self, value):
		if getBrandOEM() == "fulan":
			eAVSwitch.getInstance().setColorFormat(value)
		else:
			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)
コード例 #24
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.skinName = "Standby"
		self.avswitch = AVSwitch()

		print "enter standby"

		self["actions"] = ActionMap( [ "StandbyActions" ],
		{
			"power": self.Power,
			"discrete_on": self.Power
		}, -1)

		globalActionMap.setEnabled(False)

		from Screens.InfoBar import InfoBar
		self.infoBarInstance = InfoBar.instance
		self.standbyStopServiceTimer = eTimer()
		self.standbyStopServiceTimer.callback.append(self.stopService)
		self.timeHandler = None

		#mute adc
		self.setMute()

		self.paused_service = None

		self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup()
		service = self.prev_running_service and self.prev_running_service.toString()
		if service:
			if service.rsplit(":", 1)[1].startswith("/"):
				self.paused_service = True
				self.infoBarInstance.pauseService()
			else:
				self.timeHandler =  eDVBLocalTimeHandler.getInstance()
				if self.timeHandler.ready():
					if self.session.nav.getCurrentlyPlayingServiceOrGroup():
						self.stopService()
					else:
						self.standbyStopServiceTimer.startLongTimer(5)
					self.timeHandler = None
				else:
					self.timeHandler.m_timeUpdated.get().append(self.stopService)

		if self.session.pipshown:
			self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP()

		#set input to vcr scart
		if SystemInfo["ScartSwitch"]:
			self.avswitch.setInput("SCART")
		else:
			self.avswitch.setInput("AUX")
		if (getBrandOEM() in ('fulan')):
			open("/proc/stb/hdmi/output", "w").write("off")
		self.onFirstExecBegin.append(self.__onFirstExecBegin)
		self.onClose.append(self.__onClose)
コード例 #25
0
	def Power(self):
		print "leave standby"
		if (getBrandOEM() in ('fulan')):
				open("/proc/stb/hdmi/output", "w").write("on")
		#set input to encoder
		self.avswitch.setInput("ENCODER")
		#restart last played service
		#unmute adc
		self.leaveMute()
		#kill me
		self.close(True)
コード例 #26
0
ファイル: Ci.py プロジェクト: project-opendroid/enigma2-1
def InitCiConfig():
	config.ci = ConfigSubList()
	for slot in range(MAX_NUM_CI):
		config.ci.append(ConfigSubsection())
		config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices = [("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))], default = "no")
		if SystemInfo["CommonInterfaceSupportsHighBitrates"]:
			if getBrandOEM() == "dags":
				config.ci[slot].canHandleHighBitrates = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "yes")
			else: 
				config.ci[slot].canHandleHighBitrates = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "no")
			config.ci[slot].canHandleHighBitrates.slotid = slot
			config.ci[slot].canHandleHighBitrates.addNotifier(setCIBitrate)
コード例 #27
0
ファイル: InputDevice.py プロジェクト: Huevos/enigma2
	def __init__(self):
		if pathExists('/proc/stb/ir/rc/type') and pathExists('/proc/stb/info/boxtype') and getBrandOEM() != 'gigablue':
			self.isSupported = True

			fd = open('/proc/stb/info/boxtype', 'r')
			self.boxType = fd.read()
			fd.close()

			if config.plugins.remotecontroltype.rctype.value != 0:
				self.writeRcType(config.plugins.remotecontroltype.rctype.value)
		else:
			self.isSupported = False
コード例 #28
0
ファイル: Ci.py プロジェクト: kingvuplus/boom
def InitCiConfig():
    config.ci = ConfigSubList()
    for slot in range(MAX_NUM_CI):
        config.ci.append(ConfigSubsection())
        config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices=[('auto', _('Auto')), ('no', _('No')), ('yes', _('Yes'))], default='no')
        if SystemInfo['CommonInterfaceSupportsHighBitrates']:
            if getBrandOEM() == 'dags':
                config.ci[slot].canHandleHighBitrates = ConfigSelection(choices=[('no', _('No')), ('yes', _('Yes'))], default='yes')
            else:
                config.ci[slot].canHandleHighBitrates = ConfigSelection(choices=[('no', _('No')), ('yes', _('Yes'))], default='no')
            config.ci[slot].canHandleHighBitrates.slotid = slot
            config.ci[slot].canHandleHighBitrates.addNotifier(setCIBitrate)
コード例 #29
0
ファイル: Standby.py プロジェクト: kingvuplus/ee-test
	def Power(self):
		print "[Standby] leave standby"
		if (getBrandOEM() in ('fulan')):
			open("/proc/stb/hdmi/output", "w").write("on")
		#set input to encoder
		self.avswitch.setInput("ENCODER")
		#restart last played service
		#unmute adc
		self.leaveMute()
		# set LCDminiTV 
		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			setLCDModeMinitTV(config.lcd.modeminitv.value)
		#kill me
		self.close(True)
コード例 #30
0
ファイル: StbHardware.py プロジェクト: henrylicious/test
def setRTCtime(wutime):
	if getBoxType() in ('gb800solo', 'gb800se', 'gb800ue') or getBrandOEM().startswith('ini'):
		setRTCoffset()
	try:
		f = open("/proc/stb/fp/rtc", "w")
		f.write(str(wutime))
		f.close()
	except IOError:
		try:
			fp = open("/dev/dbox/fp0")
			ioctl(fp.fileno(), 0x101, pack('L', wutime)) # set wake up
			fp.close()
		except IOError:
			print "setRTCtime failed!"
コード例 #31
0
ファイル: ImageBackup.py プロジェクト: teamblue-e2/enigma2
	def doFullBackup(self, answer):
		if answer is not None:
			if answer[1]:
				self.RECOVERY = answer[3]
				self.DIRECTORY = "%s/images" % answer[2]
				if not os.path.exists(self.DIRECTORY):
					try:
						os.makedirs(self.DIRECTORY)
					except:
						self.session.open(MessageBox, _("Cannot create backup directory"), MessageBox.TYPE_ERROR, timeout=10)
						return
				self.SLOT = answer[1]
				self.MODEL = GetBoxName()
				self.OEM = getBrandOEM()
				self.MACHINEBUILD = getMachineBuild()
				self.MACHINENAME = getMachineName()
				self.MACHINEBRAND = getMachineBrand()
				self.IMAGEFOLDER = getImageFolder()
				self.UBINIZE_ARGS = getMachineUBINIZE()
				self.MKUBIFS_ARGS = getMachineMKUBIFS()
				self.ROOTFSSUBDIR = "none"
				self.ROOTFSBIN = getMachineRootFile()
				self.KERNELBIN = getMachineKernelFile()
				self.ROOTFSTYPE = getImageFileSystem().strip()
				self.IMAGEDISTRO = getImageDistro()
				self.DISTROVERSION = getImageVersion()

				if SystemInfo["canRecovery"]:
					self.EMMCIMG = SystemInfo["canRecovery"][0]
					self.MTDBOOT = SystemInfo["canRecovery"][1]
				else:
					self.EMMCIMG = "none"
					self.MTDBOOT = "none"

				self.getImageList = self.saveImageList
				if SystemInfo["canMultiBoot"]:
					self.MTDKERNEL = SystemInfo["canMultiBoot"][self.SLOT]["kernel"].split('/')[2]
					self.MTDROOTFS = SystemInfo["canMultiBoot"][self.SLOT]["device"].split('/')[2]
					if SystemInfo["HasRootSubdir"]:
						self.ROOTFSSUBDIR = SystemInfo["canMultiBoot"][self.SLOT]['rootsubdir']
				else:
					self.MTDKERNEL = getMachineMtdKernel()
					self.MTDROOTFS = getMachineMtdRoot()

				print "[Image Backup] BOX MACHINEBUILD = >%s<" % self.MACHINEBUILD
				print "[Image Backup] BOX MACHINENAME = >%s<" % self.MACHINENAME
				print "[Image Backup] BOX MACHINEBRAND = >%s<" % self.MACHINEBRAND
				print "[Image Backup] BOX MODEL = >%s<" % self.MODEL
				print "[Image Backup] OEM MODEL = >%s<" % self.OEM
				print "[Image Backup] IMAGEFOLDER = >%s<" % self.IMAGEFOLDER
				print "[Image Backup] UBINIZE = >%s<" % self.UBINIZE_ARGS
				print "[Image Backup] MKUBIFS = >%s<" % self.MKUBIFS_ARGS
				print "[Image Backup] MTDBOOT = >%s<" % self.MTDBOOT
				print "[Image Backup] MTDKERNEL = >%s<" % self.MTDKERNEL
				print "[Image Backup] MTDROOTFS = >%s<" % self.MTDROOTFS
				print "[Image Backup] ROOTFSBIN = >%s<" % self.ROOTFSBIN
				print "[Image Backup] KERNELBIN = >%s<" % self.KERNELBIN
				print "[Image Backup] ROOTFSSUBDIR = >%s<" % self.ROOTFSSUBDIR
				print "[Image Backup] ROOTFSTYPE = >%s<" % self.ROOTFSTYPE
				print "[Image Backup] EMMCIMG = >%s<" % self.EMMCIMG
				print "[Image Backup] IMAGEDISTRO = >%s<" % self.IMAGEDISTRO
				print "[Image Backup] DISTROVERSION = >%s<" % self.DISTROVERSION
				print "[Image Backup] MTDBOOT = >%s<" % self.MTDBOOT
				print "[Image Backup] USB RECOVERY = >%s< " % self.RECOVERY
				print "[Image Backup] DESTINATION = >%s< " % self.DIRECTORY
				print "[Image Backup] SLOT = >%s< " % self.SLOT

				self.TITLE = _("Fullbackup on %s") % (self.DIRECTORY)
				self.START = time()
				self.DATE = strftime("%Y%m%d_%H%M", localtime(self.START))
				self.IMAGEVERSION = self.imageInfo()
				self.MKFS_UBI = "/usr/sbin/mkfs.ubifs"
				self.MKFS_TAR = "/bin/tar"
				self.BZIP2 = "/usr/bin/bzip2"
				self.MKFS_JFFS2 = "/usr/sbin/mkfs.jffs2"
				self.UBINIZE = "/usr/sbin/ubinize"
				self.NANDDUMP = "/usr/sbin/nanddump"
				self.FASTBOOT = "/usr/bin/ext2simg"
				self.WORKDIR = "%s/bi" % self.DIRECTORY

				self.SHOWNAME = "%s %s" % (self.MACHINEBRAND, self.MODEL)
				self.MAINDEST = "%s/build_%s/%s" % (self.DIRECTORY, self.MODEL, self.IMAGEFOLDER)
				self.MAINDESTROOT = "%s/build_%s" % (self.DIRECTORY, self.MODEL)

				self.message = "echo -e '\n"
				if getMachineBrand().startswith('A') or getMachineBrand().startswith('E') or getMachineBrand().startswith('I') or getMachineBrand().startswith('O') or getMachineBrand().startswith('U') or getMachineBrand().startswith('Xt'):
					self.message += (_('Back-up Tool for an %s\n') % self.SHOWNAME).upper()
				else:
					self.message += (_('Back-up Tool for a %s\n') % self.SHOWNAME).upper()
				self.message += VERSION + '\n'
				self.message += "_________________________________________________\n\n"
				self.message += _("Please be patient, a backup will now be made,\n")
				self.message += _("because of the used filesystem the back-up\n")
				if self.RECOVERY:
					self.message += _("will take about 30 minutes for this system\n")
				else:
					self.message += _("will take about 1-15 minutes for this system\n")
				self.message += "_________________________________________________\n"
				self.message += "'"

				## PREPARING THE BUILDING ENVIRONMENT
				os.system("rm -rf %s" % self.WORKDIR)
				self.backuproot = "/tmp/bi/root"
				if SystemInfo["HasRootSubdir"]:
					self.backuproot = "/tmp/bi/RootSubdir/"
				if not os.path.exists(self.WORKDIR):
					os.makedirs(self.WORKDIR)
				if not os.path.exists(self.backuproot):
					os.makedirs(self.backuproot)
				os.system("sync")
				if SystemInfo["canMultiBoot"]:
					if SystemInfo["HasRootSubdir"]:
						os.system("mount /dev/%s /tmp/bi/RootSubdir" % self.MTDROOTFS)
						self.backuproot = self.backuproot + self.ROOTFSSUBDIR
					else:
						os.system("mount /dev/%s %s" % (self.MTDROOTFS, self.backuproot))
				else:
					os.system("mount --bind / %s" % (self.backuproot))

				if "jffs2" in self.ROOTFSTYPE.split():
					cmd1 = "%s --root=%s --faketime --output=%s/root.jffs2 %s" % (self.MKFS_JFFS2, self.backuproot, self.WORKDIR, self.MKUBIFS_ARGS)
					cmd2 = None
					cmd3 = None
				elif "ubi" in self.ROOTFSTYPE.split():
					f = open("%s/ubinize.cfg" % self.WORKDIR, "w")
					f.write("[ubifs]\n")
					f.write("mode=ubi\n")
					f.write("image=%s/root.ubi\n" % self.WORKDIR)
					f.write("vol_id=0\n")
					f.write("vol_type=dynamic\n")
					f.write("vol_name=rootfs\n")
					f.write("vol_flags=autoresize\n")
					f.close()
					ff = open("%s/root.ubi" % self.WORKDIR, "w")
					ff.close()
					cmd1 = "%s -r %s -o %s/root.ubi %s" % (self.MKFS_UBI, self.backuproot, self.WORKDIR, self.MKUBIFS_ARGS)
					cmd2 = "%s -o %s/root.ubifs %s %s/ubinize.cfg" % (self.UBINIZE, self.WORKDIR, self.UBINIZE_ARGS, self.WORKDIR)
					cmd3 = "mv %s/root.ubifs %s/root.%s" % (self.WORKDIR, self.WORKDIR, self.ROOTFSTYPE)
				else:
					if self.EMMCIMG == "usb_update.bin" and self.RECOVERY:
						cmd1 = None
						cmd2 = None
					else:
						cmd1 = "%s -cf %s/rootfs.tar -C %s --exclude ./var/nmbd --exclude ./.resizerootfs --exclude ./.resize-rootfs --exclude ./.resize-linuxrootfs --exclude ./.resize-userdata --exclude ./var/lib/samba/private/msg.sock --exclude ./var/lib/samba/msg.sock/* --exclude ./run/avahi-daemon/socket ." % (self.MKFS_TAR, self.WORKDIR, self.backuproot)
						cmd2 = "%s %s/rootfs.tar" % (self.BZIP2, self.WORKDIR)
					cmd3 = None

				cmdlist = []
				cmdlist.append(self.message)
				if cmd1:
					cmdlist.append('echo "' + _("Create:") + ' %s"' % self.ROOTFSBIN)
					cmdlist.append(cmd1)
				if cmd2:
					cmdlist.append(cmd2)
				if cmd3:
					cmdlist.append(cmd3)

				if self.MODEL in ("gbquad4k", "gbue4k", "gbx34k"):
					cmdlist.append('echo "' + _("Create:") + " boot dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p1 of=%s/boot.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " rescue dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p3 of=%s/rescue.bin" % self.WORKDIR)

				if self.MACHINEBUILD in ("h9", "i55plus"):
					cmdlist.append('echo "' + _("Create:") + " fastboot dump" + '"')
					cmdlist.append("dd if=/dev/mtd0 of=%s/fastboot.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " bootargs dump" + '"')
					cmdlist.append("dd if=/dev/mtd1 of=%s/bootargs.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " baseparam dump" + '"')
					cmdlist.append("dd if=/dev/mtd2 of=%s/baseparam.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " pq_param dump" + '"')
					cmdlist.append("dd if=/dev/mtd3 of=%s/pq_param.bin" % self.WORKDIR)
					cmdlist.append('echo "' + _("Create:") + " logo dump" + '"')
					cmdlist.append("dd if=/dev/mtd4 of=%s/logo.bin" % self.WORKDIR)

				if self.EMMCIMG == "usb_update.bin" and self.RECOVERY:
					SEEK_CONT = (Harddisk.getFolderSize(self.backuproot) / 1024) + 100000

					cmdlist.append('echo "' + _("Create:") + " fastboot dump" + '"')
					cmdlist.append('cp -f /usr/share/fastboot.bin %s/fastboot.bin' % (self.WORKDIR))
					#cmdlist.append("dd if=/dev/mmcblk0p1 of=%s/fastboot.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " bootargs dump" + '"')
					cmdlist.append('cp -f /usr/share/bootargs.bin %s/bootargs.bin' % (self.WORKDIR))
					#cmdlist.append("dd if=/dev/mmcblk0p2 of=%s/bootargs.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " boot dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p3 of=%s/boot.img" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " baseparam dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p4 of=%s/baseparam.img" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " pq_param dump" + '"')
					#cmdlist.append('cp -f /usr/share/bootargs.bin %s/pq_param.bin' %(self.WORKDIR))
					cmdlist.append("dd if=/dev/mmcblk0p5 of=%s/pq_param.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " logo dump" + '"')
					cmdlist.append("dd if=/dev/mmcblk0p6 of=%s/logo.img" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " deviceinfo dump" + '"')
					#cmdlist.append('cp -f /usr/share/bootargs.bin %s/deviceinfo.bin' %(self.WORKDIR))
					cmdlist.append("dd if=/dev/mmcblk0p7 of=%s/deviceinfo.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " apploader dump" + '"')
					cmdlist.append('cp -f /usr/share/apploader.bin %s/apploader.bin' % (self.WORKDIR))
					#cmdlist.append("dd if=/dev/mmcblk0p10 of=%s/apploader.bin" % self.WORKDIR)

					cmdlist.append('echo "' + _("Create:") + " rootfs dump" + '"')
					cmdlist.append("dd if=/dev/zero of=%s/rootfs.ext4 seek=%s count=60 bs=1024" % (self.WORKDIR, SEEK_CONT))
					cmdlist.append("mkfs.ext4 -F -i 4096 %s/rootfs.ext4" % (self.WORKDIR))
					cmdlist.append("mkdir -p %s/userdata" % self.WORKDIR)
					cmdlist.append("mount %s/rootfs.ext4 %s/userdata" % (self.WORKDIR, self.WORKDIR))
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs1" % self.WORKDIR)
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs2" % self.WORKDIR)
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs3" % self.WORKDIR)
					cmdlist.append("mkdir -p %s/userdata/linuxrootfs4" % self.WORKDIR)
					cmdlist.append("rsync -aAX %s/ %s/userdata/linuxrootfs1/" % (self.backuproot, self.WORKDIR))
					cmdlist.append("umount %s/userdata" % (self.WORKDIR))

				cmdlist.append('echo "' + _("Create:") + " kerneldump" + '"')
				if SystemInfo["canMultiBoot"] or self.MTDKERNEL.startswith('mmcblk0'):
					cmdlist.append("dd if=/dev/%s of=%s/%s" % (self.MTDKERNEL, self.WORKDIR, self.KERNELBIN))
				else:
					cmdlist.append("nanddump -a -f %s/vmlinux.gz /dev/%s" % (self.WORKDIR, self.MTDKERNEL))

				if self.EMMCIMG == "disk.img" and self.RECOVERY:
					EMMC_IMAGE = "%s/%s" % (self.WORKDIR, self.EMMCIMG)
					BLOCK_SIZE = 512
					BLOCK_SECTOR = 2
					IMAGE_ROOTFS_ALIGNMENT = 1024
					BOOT_PARTITION_SIZE = 3072
					KERNEL_PARTITION_SIZE = 8192
					ROOTFS_PARTITION_SIZE = 1048576
					EMMC_IMAGE_SIZE = 3817472
					KERNEL_PARTITION_OFFSET = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					ROOTFS_PARTITION_OFFSET = int(KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					SECOND_KERNEL_PARTITION_OFFSET = int(ROOTFS_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					THRID_KERNEL_PARTITION_OFFSET = int(SECOND_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					FOURTH_KERNEL_PARTITION_OFFSET = int(THRID_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					MULTI_ROOTFS_PARTITION_OFFSET = int(FOURTH_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					EMMC_IMAGE_SEEK = int(EMMC_IMAGE_SIZE) * int(BLOCK_SECTOR)
					cmdlist.append('echo "' + _("Create: Recovery Fullbackup %s") % (self.EMMCIMG) + '"')
					cmdlist.append('dd if=/dev/zero of=%s bs=%s count=0 seek=%s' % (EMMC_IMAGE, BLOCK_SIZE, EMMC_IMAGE_SEEK))
					cmdlist.append('parted -s %s mklabel gpt' % EMMC_IMAGE)
					PARTED_END_BOOT = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart boot fat16 %s %s' % (EMMC_IMAGE, IMAGE_ROOTFS_ALIGNMENT, PARTED_END_BOOT))
					PARTED_END_KERNEL1 = int(KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel %s %s' % (EMMC_IMAGE, KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL1))
					PARTED_END_ROOTFS1 = int(ROOTFS_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxrootfs ext4 %s %s' % (EMMC_IMAGE, ROOTFS_PARTITION_OFFSET, PARTED_END_ROOTFS1))
					PARTED_END_KERNEL2 = int(SECOND_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel2 %s %s' % (EMMC_IMAGE, SECOND_KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL2))
					PARTED_END_KERNEL3 = int(THRID_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel3 %s %s' % (EMMC_IMAGE, THRID_KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL3))
					PARTED_END_KERNEL4 = int(FOURTH_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart linuxkernel4 %s %s' % (EMMC_IMAGE, FOURTH_KERNEL_PARTITION_OFFSET, PARTED_END_KERNEL4))
					rd = open("/proc/swaps", "r").read()
					if "mmcblk0p7" in rd:
						SWAP_PARTITION_OFFSET = int(FOURTH_KERNEL_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
						SWAP_PARTITION_SIZE = int(262144)
						MULTI_ROOTFS_PARTITION_OFFSET = int(SWAP_PARTITION_OFFSET) + int(SWAP_PARTITION_SIZE)
						cmdlist.append('parted -s %s unit KiB mkpart swap linux-swap %s %s' % (EMMC_IMAGE, SWAP_PARTITION_OFFSET, SWAP_PARTITION_OFFSET + SWAP_PARTITION_SIZE))
						cmdlist.append('parted -s %s unit KiB mkpart userdata ext4 %s 100%%' % (EMMC_IMAGE, MULTI_ROOTFS_PARTITION_OFFSET))
					else:
						cmdlist.append('parted -s %s unit KiB mkpart userdata ext4 %s 100%%' % (EMMC_IMAGE, MULTI_ROOTFS_PARTITION_OFFSET))
					BOOT_IMAGE_SEEK = int(IMAGE_ROOTFS_ALIGNMENT) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDBOOT, EMMC_IMAGE, BOOT_IMAGE_SEEK))
					KERNAL_IMAGE_SEEK = int(KERNEL_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDKERNEL, EMMC_IMAGE, KERNAL_IMAGE_SEEK))
					ROOTFS_IMAGE_SEEK = int(ROOTFS_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s ' % (self.MTDROOTFS, EMMC_IMAGE, ROOTFS_IMAGE_SEEK))
				elif self.EMMCIMG == "emmc.img" and self.RECOVERY:
					EMMC_IMAGE = "%s/%s" % (self.WORKDIR, self.EMMCIMG)
					BLOCK_SECTOR = 2
					IMAGE_ROOTFS_ALIGNMENT = 1024
					BOOT_PARTITION_SIZE = 3072
					KERNEL_PARTITION_SIZE = 8192
					ROOTFS_PARTITION_SIZE = 1898496
					EMMC_IMAGE_SIZE = 7634944
					BOOTDD_VOLUME_ID = "boot"
					KERNEL1_PARTITION_OFFSET = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					ROOTFS1_PARTITION_OFFSET = int(KERNEL1_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					KERNEL2_PARTITION_OFFSET = int(ROOTFS1_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					ROOTFS2_PARTITION_OFFSET = int(KERNEL2_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					KERNEL3_PARTITION_OFFSET = int(ROOTFS2_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					ROOTFS3_PARTITION_OFFSET = int(KERNEL3_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					KERNEL4_PARTITION_OFFSET = int(ROOTFS3_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					ROOTFS4_PARTITION_OFFSET = int(KERNEL4_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					EMMC_IMAGE_SEEK = int(EMMC_IMAGE_SIZE) * int(IMAGE_ROOTFS_ALIGNMENT)
					cmdlist.append('echo "' + _("Create: Recovery Fullbackup %s") % (self.EMMCIMG) + '"')
					cmdlist.append('dd if=/dev/zero of=%s bs=1 count=0 seek=%s' % (EMMC_IMAGE, EMMC_IMAGE_SEEK))
					cmdlist.append('parted -s %s mklabel gpt' % EMMC_IMAGE)
					PARTED_END_BOOT = int(IMAGE_ROOTFS_ALIGNMENT) + int(BOOT_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart boot fat16 %s %s' % (EMMC_IMAGE, IMAGE_ROOTFS_ALIGNMENT, PARTED_END_BOOT))
					cmdlist.append('parted -s %s set 1 boot on' % EMMC_IMAGE)
					PARTED_END_KERNEL1 = int(KERNEL1_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel1 %s %s' % (EMMC_IMAGE, KERNEL1_PARTITION_OFFSET, PARTED_END_KERNEL1))
					PARTED_END_ROOTFS1 = int(ROOTFS1_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs1 ext4 %s %s' % (EMMC_IMAGE, ROOTFS1_PARTITION_OFFSET, PARTED_END_ROOTFS1))
					PARTED_END_KERNEL2 = int(KERNEL2_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel2 %s %s' % (EMMC_IMAGE, KERNEL2_PARTITION_OFFSET, PARTED_END_KERNEL2))
					PARTED_END_ROOTFS2 = int(ROOTFS2_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs2 ext4 %s %s' % (EMMC_IMAGE, ROOTFS2_PARTITION_OFFSET, PARTED_END_ROOTFS2))
					PARTED_END_KERNEL3 = int(KERNEL3_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel3 %s %s' % (EMMC_IMAGE, KERNEL3_PARTITION_OFFSET, PARTED_END_KERNEL3))
					PARTED_END_ROOTFS3 = int(ROOTFS3_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs3 ext4 %s %s' % (EMMC_IMAGE, ROOTFS3_PARTITION_OFFSET, PARTED_END_ROOTFS3))
					PARTED_END_KERNEL4 = int(KERNEL4_PARTITION_OFFSET) + int(KERNEL_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart kernel4 %s %s' % (EMMC_IMAGE, KERNEL4_PARTITION_OFFSET, PARTED_END_KERNEL4))
					PARTED_END_ROOTFS4 = int(ROOTFS4_PARTITION_OFFSET) + int(ROOTFS_PARTITION_SIZE)
					cmdlist.append('parted -s %s unit KiB mkpart rootfs4 ext4 %s %s' % (EMMC_IMAGE, ROOTFS4_PARTITION_OFFSET, PARTED_END_ROOTFS4))
					BOOT_IMAGE_SEEK = int(IMAGE_ROOTFS_ALIGNMENT) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDBOOT, EMMC_IMAGE, BOOT_IMAGE_SEEK))
					KERNAL_IMAGE_SEEK = int(KERNEL1_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s' % (self.MTDKERNEL, EMMC_IMAGE, KERNAL_IMAGE_SEEK))
					ROOTFS_IMAGE_SEEK = int(ROOTFS1_PARTITION_OFFSET) * int(BLOCK_SECTOR)
					cmdlist.append('dd if=/dev/%s of=%s seek=%s ' % (self.MTDROOTFS, EMMC_IMAGE, ROOTFS_IMAGE_SEEK))
				elif self.EMMCIMG == "usb_update.bin" and self.RECOVERY:
					cmdlist.append('echo "' + _("Create: Recovery Fullbackup %s") % (self.EMMCIMG) + '"')
					f = open("%s/emmc_partitions.xml" % self.WORKDIR, "w")
					f.write('<?xml version="1.0" encoding="GB2312" ?>\n')
					f.write('<Partition_Info>\n')
					f.write('<Part Sel="1" PartitionName="fastboot" FlashType="emmc" FileSystem="none" Start="0" Length="1M" SelectFile="fastboot.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="bootargs" FlashType="emmc" FileSystem="none" Start="1M" Length="1M" SelectFile="bootargs.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="bootoptions" FlashType="emmc" FileSystem="none" Start="2M" Length="1M" SelectFile="boot.img"/>\n')
					f.write('<Part Sel="1" PartitionName="baseparam" FlashType="emmc" FileSystem="none" Start="3M" Length="3M" SelectFile="baseparam.img"/>\n')
					f.write('<Part Sel="1" PartitionName="pqparam" FlashType="emmc" FileSystem="none" Start="6M" Length="4M" SelectFile="pq_param.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="logo" FlashType="emmc" FileSystem="none" Start="10M" Length="4M" SelectFile="logo.img"/>\n')
					f.write('<Part Sel="1" PartitionName="deviceinfo" FlashType="emmc" FileSystem="none" Start="14M" Length="4M" SelectFile="deviceinfo.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="loader" FlashType="emmc" FileSystem="none" Start="26M" Length="32M" SelectFile="apploader.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="linuxkernel1" FlashType="emmc" FileSystem="none" Start="66M" Length="16M" SelectFile="kernel.bin"/>\n')
					f.write('<Part Sel="1" PartitionName="userdata" FlashType="emmc" FileSystem="ext3/4" Start="130M" Length="7000M" SelectFile="rootfs.ext4"/>\n')
					f.write('</Partition_Info>\n')
					f.close()
					cmdlist.append('mkupdate -s 00000003-00000001-01010101 -f %s/emmc_partitions.xml -d %s/%s' % (self.WORKDIR, self.WORKDIR, self.EMMCIMG))
				self.session.open(Console, title=self.TITLE, cmdlist=cmdlist, finishedCallback=self.doFullBackupCB, closeOnSuccess=True)
			else:
				self.close()
		else:
			self.close()
コード例 #32
0
 def __init__(self, session, distro, mbimageversion):
     Screen.__init__(self, session)
     self.session = session
     global ImageVersion
     ImageVersion = mbimageversion
     distri = getBrandOEM()
     boxname = getBoxType()
     if boxname == "twinboxlcdci5":
         boxname = "twinboxlcd"
     Screen.setTitle(self, _('OPDBoot - Download Image'))
     self['key_green'] = Button(_('Install'))
     self['key_red'] = Button(_('Exit'))
     self.filename = None
     self.imagelist = []
     self.simulate = False
     self.imagePath = '/media/opdboot/OPDBootUpload'
     global BRANDOEM
     global BRANDOEMDROID
     global MASCHINEBUILD
     BRANDOEM = getBrandOEM()
     BRANDOEMDROID = getBrandOEM()
     MASCHINEBUILD = boxname
     if boxname in ('ax51', 'triplex'):
         BRANDOEM = 'ax'
     elif boxname in ('gb800seplus', 'gbquadplus', 'gbquad4k', 'gbue4k',
                      'gbultraue', 'gbx1', 'gbx2', 'gbx3'):
         BRANDOEM = 'gigablue'
     elif boxname in ('mutant51'):
         BRANDOEM = 'mutant'
     elif boxname in ('sf128', 'sf208', 'sf3038', 'sf4008'):
         BRANDOEM = 'octagon'
     elif boxname in ('osmega'):
         BRANDOEM = 'xcore'
     if boxname in ('gb800seplus', 'gbquadplus', 'gbquad4k', 'gbue4k',
                    'gbultraue', 'gbx1', 'gbx2', 'gbx3'):
         BRANDOEMDROID = 'GigaBlue'
         MASCHINEBUILD = boxname
     elif boxname in ('formuler1', 'formuler3', 'formuler4',
                      'formuler4turbo'):
         BRANDOEMDROID = 'Formuler'
         MASCHINEBUILD = boxname
     elif boxname in ('atemio6000', 'atemio6100', 'atemio6200',
                      'atemionemesis'):
         BRANDOEMDROID = 'Atemio'
         MASCHINEBUILD = boxname
     elif boxname in ('xpeedlx3'):
         BRANDOEMDROID = 'GoldenInterstar'
         MASCHINEBUILD = boxname
     elif boxname in ('sf98', 'sf108', 'sf128', 'sf138', 'sf208', 'sf228',
                      'sf3038', 'sf4008'):
         BRANDOEMDROID = 'Octagon'
         MASCHINEBUILD = boxname
     elif boxname in ('mutant51', 'ax51'):
         BRANDOEMDROID = 'Mut@nt'
         MASCHINEBUILD = 'HD51'
     elif boxname in ('optimussos1plus', 'optimussos2plus',
                      'optimussos3plus', 'optimussos1', 'optimussos2',
                      'osmega', 'osmini'):
         BRANDOEMDROID = 'Edision'
         MASCHINEBUILD = boxname
     elif boxname in ('vusolo4k'):
         BRANDOEMDROID = 'VU+'
         MASCHINEBUILD = boxname
     self.distro = distro
     if self.distro == 'egami':
         self.feed = 'egami'
         self.feedurl = 'http://image.egami-image.com'
     elif self.distro == 'opennfr':
         self.feed = 'opennfr'
         self.feedurl = 'http://dev.nachtfalke.biz/nfr/feeds/%s/images' % ImageVersion
     elif self.distro == 'openatv-6.0':
         self.feed = 'openatv'
         self.feedurl = 'http://images.mynonpublic.com/openatv/%s' % ImageVersion
     elif self.distro == 'openvix':
         self.feed = 'openvix'
         self.feedurl = 'http://openvix.co.uk'
     elif self.distro == 'pure2':
         self.feed = 'pure2'
         self.feedurl = 'http://pur-e2.club/OU/images/?dir=6.1'
     elif self.distro == 'opendroid':
         self.feed = 'opendroid'
         self.feedurl = 'http://images.opendroid.org/%s' % ImageVersion
     elif self.distro == 'openpli':
         self.feed = 'openpli'
         self.feedurl = 'http://openpli.org/download'
     elif self.distro == 'hdmu':
         self.feed = 'hdmu'
         self.feedurl = 'http://www.hdmedia-universe.com/board/pages.php?pageid=1&'
     elif self.distro == 'openhdf':
         self.feed = 'openhdf'
         if ImageVersion == "5.5":
             hdfImageVersion = "v55"
         elif ImageVersion == "6.1":
             hdfImageVersion = "v60"
         elif ImageVersion == "6.2":
             hdfImageVersion = "v62"
         else:
             hdfImageVersion = "v61"
         self.feedurl = 'http://%s.hdfreaks.cc/%s' % (hdfImageVersion,
                                                      boxname)
         self.feedurl1 = 'http://%s.hdfreaks.cc' % hdfImageVersion
     elif self.distro == 'openeight':
         self.feed = 'openeight'
         self.feedurl = 'http://openeight.de'
     elif self.distro == 'satdreamgr':
         if distri == "Vu+":
             distri = "vu"
         self.feed = 'satdreamgr'
         self.feedurl = 'http://sgcpm.com/satdreamgr-images-experimental/%s/%s' % (
             distri.lower(), boxname)
     else:
         self.feed = 'opennfr'
         self.feedurl = 'http://dev.nachtfalke.biz/nfr/feeds/6.2/images'
     self['imageList'] = MenuList(self.imagelist)
     self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {
         'green': self.green,
         'red': self.quit,
         'cancel': self.quit
     }, -2)
     self.onLayoutFinish.append(self.layoutFinished)
     return
コード例 #33
0
ファイル: Standby.py プロジェクト: ostende/OBH-DM9XX
	def __init__(self, session):
		Screen.__init__(self, session)
		self.skinName = "Standby"
		self.avswitch = AVSwitch()

		print "[Standby] enter standby"

		if path.exists("/usr/scripts/standby_enter.sh"):
			Console().ePopen("/usr/scripts/standby_enter.sh")

		self["actions"] = ActionMap( [ "StandbyActions" ],
		{
			"power": self.Power,
			"discrete_on": self.Power
		}, -1)

		globalActionMap.setEnabled(False)

		from Screens.InfoBar import InfoBar
		self.infoBarInstance = InfoBar.instance
		self.standbyStopServiceTimer = eTimer()
		self.standbyStopServiceTimer.callback.append(self.stopService)
		self.timeHandler = None

		self.setMute()

		if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
			# set LCDminiTV off
			setLCDMiniTVMode("0")

		self.paused_service = self.paused_action = False

		self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup()
		if Components.ParentalControl.parentalControl.isProtected(self.prev_running_service):
			self.prev_running_service = eServiceReference(config.tv.lastservice.value)
		service = self.prev_running_service and self.prev_running_service.toString()
		if service:
			if service.rsplit(":", 1)[1].startswith("/"):
				self.paused_service = hasattr(self.session.current_dialog, "pauseService") and hasattr(self.session.current_dialog, "unPauseService") and self.session.current_dialog or self.infoBarInstance
				self.paused_action = hasattr(self.paused_service, "seekstate") and hasattr(self.paused_service, "SEEK_STATE_PLAY") and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY
				self.paused_action and self.paused_service.pauseService()
		if not self.paused_service:
			self.timeHandler =  eDVBLocalTimeHandler.getInstance()
			if self.timeHandler.ready():
				if self.session.nav.getCurrentlyPlayingServiceOrGroup():
					self.stopService()
				else:
					self.standbyStopServiceTimer.startLongTimer(5)
				self.timeHandler = None
			else:
				self.timeHandler.m_timeUpdated.get().append(self.stopService)

		if self.session.pipshown:
			self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP()

		if SystemInfo["ScartSwitch"]:
			self.avswitch.setInput("SCART")
		else:
			self.avswitch.setInput("AUX")
		if getBrandOEM() in ('dinobot') or SystemInfo["HasHiSi"]:
			try:
				open("/proc/stb/hdmi/output", "w").write("off")
			except:
				pass

		self.onFirstExecBegin.append(self.__onFirstExecBegin)
		self.onClose.append(self.__onClose)
コード例 #34
0
def InitCiConfig():
    config.ci = ConfigSubList()
    config.cimisc = ConfigSubsection()
    for slot in range(MAX_NUM_CI):
        config.ci.append(ConfigSubsection())
        config.ci[slot].canDescrambleMultipleServices = ConfigSelection(
            choices=[("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))],
            default="auto")
        config.ci[slot].use_static_pin = ConfigYesNo(default=True)
        config.ci[slot].static_pin = ConfigPIN(default=0)
        config.ci[slot].show_ci_messages = ConfigYesNo(default=True)
        if SystemInfo["CommonInterfaceSupportsHighBitrates"]:
            if getBrandOEM() in ('dags', 'blackbox'):
                config.ci[slot].canHandleHighBitrates = ConfigSelection(
                    choices=[("no", _("No")), ("yes", _("Yes"))],
                    default="yes")
            else:
                config.ci[slot].canHandleHighBitrates = ConfigSelection(
                    choices=[("no", _("No")), ("yes", _("Yes"))], default="no")
            config.ci[slot].canHandleHighBitrates.slotid = slot
            config.ci[slot].canHandleHighBitrates.addNotifier(setCIBitrate)
        if SystemInfo["RelevantPidsRoutingSupport"]:
            global relevantPidsRoutingChoices
            if not relevantPidsRoutingChoices:
                relevantPidsRoutingChoices = [("no", _("No")),
                                              ("yes", _("Yes"))]
                default = "no"
                fileName = "/proc/stb/tsmux/ci%d_relevant_pids_routing_choices"
            if fileExists(fileName, 'r'):
                relevantPidsRoutingChoices = []
                fd = open(fileName, 'r')
                data = fd.read()
                data = data.split()
                for x in data:
                    relevantPidsRoutingChoices.append((x, _(x)))
                if default not in data:
                    default = data[0]
            config.ci[slot].relevantPidsRouting = ConfigSelection(
                choices=relevantPidsRoutingChoices, default=default)
            config.ci[slot].relevantPidsRouting.slotid = slot
            config.ci[slot].relevantPidsRouting.addNotifier(
                setRelevantPidsRouting)
    if SystemInfo["CommonInterfaceCIDelay"]:
        config.cimisc.dvbCiDelay = ConfigSelection(default="256",
                                                   choices=[("16", _("16")),
                                                            ("32", _("32")),
                                                            ("64", _("64")),
                                                            ("128", _("128")),
                                                            ("256", _("256"))])
        config.cimisc.dvbCiDelay.addNotifier(setdvbCiDelay)
    if getBrandOEM() in ('entwopia', 'tripledot', 'dreambox'):
        if SystemInfo["HaveCISSL"]:
            config.cimisc.civersion = ConfigSelection(
                default="ciplus1",
                choices=[("auto", _("Auto")), ("ciplus1", _("CI Plus 1.2")),
                         ("ciplus2", _("CI Plus 1.3")),
                         ("legacy", _("CI Legacy"))])
        else:
            config.cimisc.civersion = ConfigSelection(default="legacy",
                                                      choices=[("legacy",
                                                                _("CI Legacy"))
                                                               ])
    else:
        config.cimisc.civersion = ConfigSelection(default="auto",
                                                  choices=[("auto", _("Auto")),
                                                           ("ciplus1",
                                                            _("CI Plus 1.2")),
                                                           ("ciplus2",
                                                            _("CI Plus 1.3")),
                                                           ("legacy",
                                                            _("CI Legacy"))])
コード例 #35
0
ファイル: InfoBar.py プロジェクト: popazerty/e2-gui
	def _helpTvRadioToggle(self):
		if getBrandOEM() == 'gigablue':
			return _("Switch between TV and radio...")
		else:
			return _("Watch TV...")
コード例 #36
0
 def TvRadioToggle(self):
     if getBrandOEM() == 'gigablue':
         self.toogleTvRadio()
     else:
         self.showTv()
コード例 #37
0
ファイル: Navigation.py プロジェクト: Ormiwhite/enigma2-2
    def __init__(self, wakeupData=None):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None

        Screens.Standby.TVstate()
        self.skipWakeup = False
        self.skipTVWakeup = False

        self.RecordTimer = None
        self.isRecordTimerImageStandard = False
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
            self.isRecordTimerImageStandard = True

        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False

        #wakeup data
        now = time()
        try:
            self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [
                int(n) for n in wakeupData.split(',')
            ]
        except:
            print "=" * 100
            print "[NAVIGATION] ERROR: can't read wakeup data"
            self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = int(
                now), -1, -1, 0, 0, -1, 0
        self.syncCount = 0
        hasFakeTime = (
            now <= 31536000 or now - self.lastshutdowntime <= 120
        ) and self.getstandby < 2  #set hasFakeTime only if lower than values and was last shutdown to deep standby
        wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
        #TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)

        if 0:  #debug
            print "#" * 100
            print "[NAVIGATION] timediff from last shutdown to now = %ds" % (
                now - self.lastshutdowntime)
            print "[NAVIGATION] shutdowntime: %s, wakeuptime: %s timertime: %s, recordtime: %s" % (
                ctime(self.lastshutdowntime), ctime(self.wakeuptime),
                ctime(self.timertime), ctime(self.recordtime))
            print "[NAVIGATION] wakeuptyp: %s, getstandby: %s, forcerecord: %s" % (
                {
                    0: "record-timer",
                    1: "zap-timer",
                    2: "power-timer",
                    3: "plugin-timer"
                }[self.wakeuptyp], {
                    0: "no standby",
                    1: "standby",
                    2: "no standby (box was not in deepstandby)"
                }[self.getstandby], self.forcerecord)
            print "#" * 100

        print "=" * 100
        print "[NAVIGATION] was timer wakeup = %s" % wasTimerWakeup
        print "[NAVIGATION] current time is %s -> it's fake-time suspected: %s" % (
            ctime(now), hasFakeTime)
        print "-" * 100

        thisBox = getBoxType()
        if not config.workaround.deeprecord.value and (
                wasTimerWakeup_failure or thisBox in
            ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
             'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM()
                in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia')
                or getMachineBuild() in ('dags7335', 'dags7356', 'dags7362')):
            print "[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" % thisBox
            print "-" * 100
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()

        if config.workaround.deeprecord.value:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            print "[NAVIGATION] starting deepstandby-workaround"
            self.wakeupwindow_plus = self.timertime + 300
            self.wakeupwindow_minus = self.wakeuptime - (
                config.workaround.wakeupwindow.value * 60)
            wasTimerWakeup = False
            if not hasFakeTime and now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus:  # if there is a recording sheduled, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()
        else:
            #secure wakeup window to prevent a wrong 'wasTimerWakeup' value as timer wakeup detection
            self.wakeupwindow_plus = self.timertime + 900
            self.wakeupwindow_minus = self.wakeuptime - 3600

        if self.wakeuptime > 0:
            print "[NAVIGATION] wakeup time from deep-standby expected: *** %s ***" % (
                ctime(self.wakeuptime))
            if config.workaround.deeprecord.value:
                print "[NAVIGATION] timer wakeup detection window: %s - %s" % (
                    ctime(self.wakeupwindow_minus),
                    ctime(self.wakeupwindow_plus))
        else:
            print "[NAVIGATION] wakeup time was not set"
        print "-" * 100

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if not hasFakeTime:
                self.wakeupCheck()
                return

        if hasFakeTime and self.wakeuptime > 0:  # check for NTP-time sync, if no sync, wait for transponder time
            if Screens.Standby.TVinStandby.getTVstandby(
                    'waitfortimesync') and not wasTimerWakeup:
                self.skipTVWakeup = True
                Screens.Standby.TVinStandby.setTVstate('power')
            self.savedOldTime = now
            self.timesynctimer = eTimer()
            self.timesynctimer.callback.append(self.TimeSynctimer)
            self.timesynctimer.start(5000, True)
            print "[NAVIGATION] wait for time sync"
            print "~" * 100
        else:
            self.wakeupCheck(False)
コード例 #38
0
ファイル: BoxBrandingTest.py プロジェクト: oostende/openspa1
import boxbranding
print "getMachineBuild=%s<" % boxbranding.getMachineBuild()
print "getMachineMake=%s<" % boxbranding.getMachineMake()
print "getMachineProcModel=%s<" % boxbranding.getMachineProcModel()
print "getMachineBrand=%s<" % boxbranding.getMachineBrand()
print "getMachineName=%s<" % boxbranding.getMachineName()
print "getMachineMtdKernel=%s<" % boxbranding.getMachineMtdKernel()
print "getMachineKernelFile=%s<" % boxbranding.getMachineKernelFile()
print "getMachineMtdRoot=%s<" % boxbranding.getMachineMtdRoot()
print "getMachineRootFile=%s<" % boxbranding.getMachineRootFile()
print "getMachineMKUBIFS=%s<" % boxbranding.getMachineMKUBIFS()
print "getMachineUBINIZE=%s<" % boxbranding.getMachineUBINIZE()
print "getBoxType=%s<" % boxbranding.getBoxType()
print "getBrandOEM=%s<" % boxbranding.getBrandOEM()
print "getOEVersion=%s<" % boxbranding.getOEVersion()
print "getDriverDate=%s<" % boxbranding.getDriverDate()
print "getImageVersion=%s<" % boxbranding.getImageVersion()
print "getImageBuild=%s<" % boxbranding.getImageBuild()
print "getImageDevBuild=%s<" % boxbranding.getImageDevBuild()
print "getImageType=%s<" % boxbranding.getImageType()
print "getImageDistro=%s<" % boxbranding.getImageDistro()
print "getImageFolder=%s<" % boxbranding.getImageFolder()
print "getImageFileSystem=%s<" % boxbranding.getImageFileSystem()
print "getImageArch=%s<" % boxbranding.getImageArch()
コード例 #39
0
ファイル: mytest.py プロジェクト: ostende/EGAMI
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value,
                     config.misc.isNextPowerTimerAfterEventActionAuto.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    screensToRun = [
        p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
    ]

    profile("wizards")
    screensToRun += wizardManager.getWizards()
    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()
    runReactor()

    config.misc.startCounter.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    wakeupList = [
        x for x in (
            (session.nav.RecordTimer.getNextRecordingTime(), 0,
             session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
            (session.nav.RecordTimer.getNextZapTime(),
             1), (plugins.getNextWakeupTime(), 2),
            (session.nav.PowerTimer.getNextPowerManagerTime(), 3,
             session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
        if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] != 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 270:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if getBrandOEM() == 'gigablue':
                wptime = startTime[
                    0] - 120  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0] - 240
        if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM(
        ) == 'gigablue':
            print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime))
        setFPWakeuptime(wptime)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
        print 'recordTimerWakeupAuto', recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    PowerTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] == 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 60:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if getBrandOEM() == 'gigablue':
                wptime = startTime[
                    0] + 120  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0]
        if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM(
        ) == 'gigablue':
            print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime + 60))
        setFPWakeuptime(wptime)
        PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
        print 'PowerTimerWakeupAuto', PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
コード例 #40
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.skinName = "Standby"
        self.avswitch = AVSwitch()

        print "[Standby] enter standby"
        SystemInfo["StandbyState"] = True

        if os.path.exists("/usr/script/StandbyEnter.sh"):
            Console().ePopen("/usr/script/StandbyEnter.sh &")

        self["actions"] = ActionMap(
            ["StandbyActions"], {
                "power": self.Power,
                "power_make": self.Power_make,
                "power_break": self.Power_break,
                "power_long": self.Power_long,
                "power_repeat": self.Power_repeat,
                "discrete_on": self.Power
            }, -1)

        globalActionMap.setEnabled(False)

        self.ignoreKeyBreakTimer = eTimer()
        self.standbyStopServiceTimer = eTimer()
        self.standbyStopServiceTimer.callback.append(self.stopService)
        self.timeHandler = None

        #mute adc
        self.setMute()

        if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
            # set LCDminiTV off
            setLCDModeMinitTV("0")

        self.paused_service = None
        self.prev_running_service = None

        self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup(
        )
        service = self.prev_running_service and self.prev_running_service.toString(
        )
        if service:
            if service.startswith("1:") and service.rsplit(
                    ":", 1)[1].startswith("/"):
                self.paused_service = self.session.current_dialog
                self.paused_service.pauseService()
        if not self.paused_service:
            self.timeHandler = eDVBLocalTimeHandler.getInstance()
            if self.timeHandler.ready():
                if self.session.nav.getCurrentlyPlayingServiceOrGroup():
                    self.stopService()
                else:
                    self.standbyStopServiceTimer.startLongTimer(5)
                self.timeHandler = None
            else:
                if config.misc.SyncTimeUsing.value == 0:
                    self.timeHandler.m_timeUpdated.get().append(
                        self.stopService)
                else:
                    self.standbyStopServiceTimer.startLongTimer(5)
                    self.timeHandler = None

        if self.session.pipshown:
            from Screens.InfoBar import InfoBar
            InfoBar.instance and hasattr(
                InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()

        #set input to vcr scart
        if SystemInfo["ScartSwitch"]:
            self.avswitch.setInput("SCART")
        else:
            self.avswitch.setInput("AUX")
        if (getBrandOEM() in ('fulan', 'clap', 'dinobot') or getMachineBuild()
                in ('gbmv200', 'sf8008', 'sf8008m', 'ustym4kpro', 'beyonwizv2',
                    'viper4k')):
            try:
                open("/proc/stb/hdmi/output", "w").write("off")
            except:
                pass

        if int(
                config.usage.hdd_standby_in_standby.value
        ) != -1:  # HDD standby timer value (box in standby) / -1 = same as when box is active
            for hdd in harddiskmanager.HDDList():
                hdd[1].setIdleTime(
                    int(config.usage.hdd_standby_in_standby.value))

        self.onFirstExecBegin.append(self.__onFirstExecBegin)
        self.onClose.append(self.__onClose)
コード例 #41
0
from Components.Button import Button
from Components.Label import Label
from Components.ActionMap import ActionMap
from Components.About import about
from Screens.Console import Console
from Screens.MessageBox import MessageBox
from time import time, strftime, localtime
from os import path, system, makedirs, listdir, walk, statvfs
import commands
import datetime
from boxbranding import getBoxType, getMachineBrand, getMachineName, getDriverDate, getImageVersion, getImageBuild, getBrandOEM, getMachineBuild, getImageFolder, getMachineUBINIZE, getMachineMKUBIFS, getMachineMtdKernel, getMachineKernelFile, getMachineRootFile, getImageFileSystem

VERSION = "Version 5.0 Opendroid"

HaveGZkernel = True
if getBrandOEM() in ("fulan"):
	HaveGZkernel = False

def Freespace(dev):
	statdev = statvfs(dev)
	space = (statdev.f_bavail * statdev.f_frsize) / 1024
	print "[FULL BACKUP] Free space on %s = %i kilobytes" %(dev, space)
	return space

class ImageBackup(Screen):
	skin = """
	<screen position="center,center" size="560,400" title="Image Backup">
		<ePixmap position="0,360"   zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
		<ePixmap position="140,360" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
		<ePixmap position="280,360" zPosition="1" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
		<ePixmap position="420,360" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
コード例 #42
0
ファイル: ImageBackup.py プロジェクト: VytenisP/enigma2-2
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINEBUILD = getMachineBuild()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		self.IMAGEFOLDER = getImageFolder()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem()

		if self.MACHINEBUILD in ("hd51","vs1500","h7"):
			self.MTDBOOT = "mmcblk0p1"
			self.EMMCIMG = "disk.img"
		elif self.MACHINEBUILD in ("xc7439"):
			self.MTDBOOT = "mmcblk1p1"
			self.EMMCIMG = "emmc.img"
		else:
			self.MTDBOOT = "none"
			self.EMMCIMG = "none"

		print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		print "[FULL BACKUP] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
		print "[FULL BACKUP] UBINIZE = >%s<" %self.UBINIZE_ARGS
		print "[FULL BACKUP] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
		print "[FULL BACKUP] MTDBOOT = >%s<" %self.MTDBOOT
		print "[FULL BACKUP] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] EMMCIMG = >%s<" %self.EMMCIMG

		self.list = self.list_files("/boot")
		self["key_green"] = StaticText("USB")
		self["key_red"] = StaticText("HDD")
		self["key_blue"] = StaticText(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = StaticText(_("STARTUP"))
			self["info-multi"] = Label(_("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."))
		else:
			self["key_yellow"] = StaticText("")
			self["info-multi"] = Label(" ")
		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], 
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
コード例 #43
0
ファイル: mytest.py プロジェクト: mat12/mytest
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value,
                     config.misc.isNextPowerTimerAfterEventActionAuto.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    screensToRun = [
        p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
    ]

    profile("wizards")
    screensToRun += wizardManager.getWizards()
    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    if boxtype in ('sf3038', 'spycat', 'nano', 'nanoc', 'et7500', 'mixosf5',
                   'mixosf7', 'mixoslumi', 'gi9196m', 'maram9', 'ixussone',
                   'ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3',
                   'sezam5000hd', 'mbtwin', 'sezam1000hd', 'mbmini',
                   'atemio5x00', 'beyonwizt3') or getBrandOEM() in ('fulan'):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()

    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open("/dev/dbox/oled0", "w")
        f.write('-E2-')
        f.close()

    print "lastshutdown=%s		(True = last shutdown was OK)" % config.usage.shutdownOK.value
    print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value
    print "bootup action=%s" % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print "last shutdown = %s" % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)

    config.usage.shutdownOK.setValue(False)
    config.usage.shutdownOK.save()
    configfile.save()

    # kill showiframe if it is running (sh4 hack...)
    os.system("killall -9 showiframe")

    runReactor()

    print "normal shutdown"
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    from time import time, strftime, localtime
    from Tools.StbHardware import setFPWakeuptime, getFPWakeuptime, setRTCtime
    #get currentTime
    nowTime = time()
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    wakeupList = [
        x for x in (
            (session.nav.RecordTimer.getNextRecordingTime(), 0,
             session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
            (session.nav.RecordTimer.getNextZapTime(),
             1), (plugins.getNextWakeupTime(), 2),
            (session.nav.PowerTimer.getNextPowerManagerTime(), 3,
             session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
        if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] != 3:
        from time import strftime
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 270:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if getBoxType().startswith("gb"):
                wptime = startTime[
                    0] - 120  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0] - 240
        if not config.misc.SyncTimeUsing.value == "0" or getBoxType(
        ).startswith('gb'):
            print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime))
        setFPWakeuptime(wptime)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
        print 'recordTimerWakeupAuto', recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    PowerTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] == 3:
        from time import strftime
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 60:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if config.workaround.deeprecord.value:
                wptime = startTime[
                    0] + 240  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0]
        if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM(
        ) == 'gigablue':
            print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime + 60))
        setFPWakeuptime(wptime)
        PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
        print 'PowerTimerWakeupAuto', PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
コード例 #44
0
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.nextWakeup.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    profile("wizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            session.open(RestoreScreen, runRestore=True)
        else:
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system('rm -f /media/hdd/images/config/autorestore')
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()
    print screensToRun

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            print "[mytest.py] quitMainloop #3"
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    if not RestoreSettings:
        runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    if boxtype in ('ustym4kpro', 'sf8008', 'clap4k', 'alien5', 'osninopro',
                   'osnino', 'osninoplus', 'alphatriple', 'spycat4kmini',
                   'tmtwin4k', 'mbmicrov2', 'revo4k', 'force3uhd', 'wetekplay',
                   'wetekplay2', 'wetekhub', 'dm7020hd', 'dm7020hdv2',
                   'osminiplus', 'osmega', 'sf3038', 'spycat', 'e4hd',
                   'e4hdhybrid', 'mbmicro', 'et7500', 'mixosf5', 'mixosf7',
                   'mixoslumi', 'gi9196m', 'maram9', 'ixussone', 'ixusszero',
                   'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
                   'mbtwin', 'sezam1000hd', 'mbmini', 'atemio5x00',
                   'beyonwizt3', '9910lx', '9911lx') or getBrandOEM() in (
                       'fulan') or getMachineBuild() in ('dags7362',
                                                         'dags73625', 'dags5'):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()

    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open("/dev/dbox/oled0", "w")
        f.write('-E2-')
        f.close()

    print "lastshutdown=%s		(True = last shutdown was OK)" % config.usage.shutdownOK.value
    print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value
    print "bootup action=%s" % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print "last shutdown = %s" % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)

    if not RestoreSettings:
        config.usage.shutdownOK.setValue(False)
        config.usage.shutdownOK.save()
        configfile.save()

    # kill showiframe if it is running (sh4 hack...)
    if getMachineBuild() in ('spark', 'spark7162'):
        os.system("killall -9 showiframe")

    runReactor()

    print "[mytest.py] normal shutdown"
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    #	if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    #recordtimer
    if session.nav.isRecordTimerImageStandard:  #check RecordTimer instance
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    #zaptimer
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    #powertimer
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    #plugintimer
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]  #"pluginname | pluginfolder"
    tmp = tmp[1].lower()
    #start in standby, depending on plugin type
    if "epgrefresh" in tmp:
        nextPluginName = "EPGRefresh"
        nextPluginTimeInStandby = 1
    elif "vps" in tmp:
        nextPluginName = "VPS"
        nextPluginTimeInStandby = 1
    elif "serienrecorder" in tmp:
        nextPluginName = "SerienRecorder"
        nextPluginTimeInStandby = 0  # plugin function for deep standby from standby not compatible (not available)
    elif "elektro" in tmp:
        nextPluginName = "Elektro"
        nextPluginTimeInStandby = 1
    elif "minipowersave" in tmp:
        nextPluginName = "MiniPowersave"
        nextPluginTimeInStandby = 1
    elif "enhancedpowersave" in tmp:
        nextPluginName = "EnhancedPowersave"
        nextPluginTimeInStandby = 1
    else:
        #default for plugins
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0

    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()

    print "=" * 100
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        # wakeup time before timer begins
        wptime = startTime[0] - (config.workaround.wakeuptime.value * 60)
        if (wptime - nowTime) < 120:  # no time to switch box back on
            wptime = int(nowTime) + 120  # so switch back on in 120 seconds

        #check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            #when next record starts in 15 mins
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            #by vps-plugin
            elif startTime[1] == 3 and nextPluginName == "VPS":
                setStandby = forceNextRecord = 1

        if startTime[1] == 3:
            nextPluginName = " (%s)" % nextPluginName
        else:
            nextPluginName = ""
        print "[mytest.py] set next wakeup type to '%s'%s %s" % (
            {
                0: "record-timer",
                1: "zap-timer",
                2: "power-timer",
                3: "plugin-timer"
            }[startTime[1]], nextPluginName, {
                0: "and starts normal",
                1: "and starts in standby"
            }[setStandby])
        if forceNextRecord:
            print "[mytest.py] set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag"
        print "[mytest.py] set next wakeup time to", strftime(
            "%a, %Y/%m/%d %H:%M:%S", localtime(wptime))
        #set next wakeup
        setFPWakeuptime(wptime)
        #set next standby only after shutdown in deep standby
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2  # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby
        config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d,%d" % (
            int(nowTime), wptime, startTime[0], startTime[1], setStandby,
            nextRecordTime, forceNextRecord)
    else:
        config.misc.nextWakeup.value = "%d,-1,-1,0,0,-1,0" % (int(nowTime))
        if not boxtype.startswith(
                'azboxm'
        ):  #skip for Azbox (mini)ME - setting wakeup time to past reboots box
            setFPWakeuptime(int(nowTime) -
                            3600)  #minus one hour -> overwrite old wakeup time
        print "[mytest.py] no set next wakeup time"
    config.misc.nextWakeup.save()
    print "=" * 100

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
コード例 #45
0
ファイル: SystemInfo.py プロジェクト: vid48/enigma2
    "/proc/stb/fb/primary/zoffset")
SystemInfo["Blindscan_t2_available"] = fileCheck("/proc/stb/info/vumodel")
SystemInfo["HasTranscoding"] = pathExists("/proc/stb/encoder/0") or fileCheck(
    "/dev/bcm_enc0")
SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices",
                                       "h265")
SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = getBoxType() in (
    'vusolo4k', 'gbquad4k')
SystemInfo["hasXcoreVFD"] = getBoxType() in (
    'osmega', 'spycat4k', 'spycat4kmini', 'spycat4kcombo') and fileCheck(
        "/sys/module/brcmstb_%s/parameters/pt6302_cgram" % getBoxType())
SystemInfo["HasHDMIin"] = getHaveHDMIinHD() in (
    'True', ) or getHaveHDMIinFHD() in ('True', )
SystemInfo["HasHDMI-CEC"] = fileExists(
    "/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
SystemInfo["HasInfoButton"] = getBrandOEM() in ('airdigital', 'broadmedia',
                                                'ceryon', 'dags', 'edision',
                                                'formuler', 'gfutures',
                                                'gigablue', 'ini', 'octagon',
                                                'odin', 'skylake', 'tiviar',
                                                'xcore', 'xp', 'xtrend')
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["canMultiBoot"] = getMachineBuild() in (
    'hd51', 'h7', 'vs1500') and (1, 4, 'mmcblk0p') or getBoxType() in (
        'gbue4k', 'gbquad4k') and (3, 3, 'mmcblk0p') or getMachineBuild() in (
            'sf8008') and fileCheck("/dev/sda") and (
                0, 2, 'sda') or getMachineBuild() in ('osmio4k') and (
                    1, 4, 'mmcblk1p')
SystemInfo["HasHiSi"] = pathExists('/proc/hisi')
SystemInfo["canMode12"] = getMachineBuild() in ('hd51') and (
    '440M@328M brcm_cma=192M@768M', '520M@248M brcm_cma=200M@768M')
コード例 #46
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["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 ('7358', '7356', '7362', '7424', '7425',
                                    '7241', '7552'):
        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 getBrandOEM() == 'vuplus':
        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', 'odimm7', 'vusolo2',
            'tmnano', 'tmnanose', 'tmnano2super', 'tmnano3t', 'iqonios300hd',
            'e3hd', 'dm500hdv2', 'dm500hd', 'dm800', 'ebox7358', 'eboxlumi',
            'ebox5100', 'ixusszero', 'optimussos1', 'enfinity', 'uniboxhd1'):
        del modes["YPbPr"]
    if modes.has_key("Scart") and getBoxType() in ('tmnano', 'tmnano3t',
                                                   'tmnano2super'):
        modes["RCA"] = modes["Scart"]
        del modes["Scart"]
    if modes.has_key("Scart") and getBoxType() in ('gbquad', 'et5x00',
                                                   'ixussone', 'et6x00',
                                                   'tmnano', 'tmnanose',
                                                   'tmnano2t', 'tmnano2super'):
        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 "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 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

        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:
            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 "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"
        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 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
コード例 #47
0
from boxbranding import getBoxType, getMachineBrand, getMachineBuild, getBrandOEM
from Tools.StbHardware import getFPVersion
import os

boxtype = getBoxType()
machinebuild = getMachineBuild()
machinebrand = getMachineBrand()
brandoem = getBrandOEM()


class RcModel:
    def __init__(self):
        pass

    def rcIsDefault(self):
        if self.getRcFolder() != 'dmm0':
            return False
        return True

    def readFile(self, target):
        fp = open(target, 'r')
        out = fp.read()
        fp.close()
        return out.split()[0]

    def process(self, line):
        if line.lower().startswith('config.usage.rc_model='):
            parts = line.split('=')
            folder = parts[-1].rstrip()
            if os.path.isfile('/usr/share/enigma2/rc_models/' + folder +
                              '/rc.png') and os.path.isfile(
コード例 #48
0
def InitOsd():
    SystemInfo["CanChange3DOsd"] = access('/proc/stb/fb/3dmode',
                                          R_OK) and True or False
    SystemInfo["CanChangeOsdAlpha"] = access('/proc/stb/video/alpha',
                                             R_OK) and True or False
    SystemInfo["CanChangeOsdPosition"] = access('/proc/stb/vmpeg/0/dst_left',
                                                R_OK) and True or False
    SystemInfo["OsdSetup"] = SystemInfo["CanChangeOsdPosition"]
    if SystemInfo["CanChangeOsdAlpha"] == True or SystemInfo[
            "CanChangeOsdPosition"] == True:
        SystemInfo["OsdMenu"] = True
    else:
        SystemInfo["OsdMenu"] = False

    if getBrandOEM() in ('fulan'):
        SystemInfo["CanChangeOsdPosition"] = False
        SystemInfo["CanChange3DOsd"] = False

    def setOSDLeft(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/vmpeg/0/dst_left", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_left.addNotifier(setOSDLeft)

    def setOSDWidth(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/vmpeg/0/dst_width", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_width.addNotifier(setOSDWidth)

    def setOSDTop(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/vmpeg/0/dst_top", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_top.addNotifier(setOSDTop)

    def setOSDHeight(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/vmpeg/0/dst_height", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_height.addNotifier(setOSDHeight)
    print 'Setting OSD position: %s %s %s %s' % (
        config.osd.dst_left.value, config.osd.dst_width.value,
        config.osd.dst_top.value, config.osd.dst_height.value)

    def setOSDAlpha(configElement):
        if SystemInfo["CanChangeOsdAlpha"]:
            print 'Setting OSD alpha:', str(configElement.value)
            config.av.osd_alpha.setValue(configElement.value)
            f = open("/proc/stb/video/alpha", "w")
            f.write(str(configElement.value))
            f.close()

    config.osd.alpha.addNotifier(setOSDAlpha)

    def set3DMode(configElement):
        if SystemInfo["CanChange3DOsd"]:
            value = configElement.value
            print 'Setting 3D mode:', value
            try:
                if SystemInfo["CanUse3DModeChoices"]:
                    f = open("/proc/stb/fb/3dmode_choices", "r")
                    choices = f.readlines()[0].split()
                    f.close()
                    if value not in choices:
                        if value == "sidebyside":
                            value = "sbs"
                        elif value == "topandbottom":
                            value = "tab"
                        elif value == "auto":
                            value = "off"
                f = open("/proc/stb/fb/3dmode", "w")
                f.write(value)
                f.close()
            except:
                pass

    config.osd.threeDmode.addNotifier(set3DMode)

    def set3DZnorm(configElement):
        if SystemInfo["CanChange3DOsd"]:
            print 'Setting 3D depth:', configElement.value
            try:
                f = open("/proc/stb/fb/znorm", "w")
                f.write('%d' % int(configElement.value))
                f.close()
            except:
                pass

    config.osd.threeDznorm.addNotifier(set3DZnorm)
コード例 #49
0
def runScreenTest():
    config.misc.startCounter.value += 1
    config.misc.startCounter.save()

    #Let's Disable it for a while
    #config.usage.async_plug_load.value = False

    if config.usage.async_plug_load.value and os.path.isfile(
            "/usr/lib/enigma2/python/Plugins/SystemPlugins/EGAMIPluginSpeedUp/plugin.pyo"
    ):
        profile("readBaseList")
        plugins.loadBasePlugins(resolveFilename(SCOPE_PLUGINS))
    else:
        profile("readPluginList")
        plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.nextWakeup.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    screensToRun = [
        p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
    ]

    profile("wizards")
    screensToRun += wizardManager.getWizards()
    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            print "[mytest.py] quitMainloop #3"
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    if boxtype in ('wetekplay', 'wetekplayplus', 'mbtwinplus', 'sf3038',
                   'spycat', 'e4hd', 'mbmicro', 'et7500', 'mixosf5', 'mixosf7',
                   'mixoslumi', 'gi9196m', 'maram9', 'ixussone', 'ixussone',
                   'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
                   'mbtwin', 'sezam1000hd', 'mbmini', 'atemio5x00',
                   'beyonwizt3') or getBrandOEM() in ('fulan'):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()

    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open("/dev/dbox/oled0", "w")
        f.write('-E2-')
        f.close()

    print "lastshutdown=%s		(True = last shutdown was OK)" % config.usage.shutdownOK.value
    print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value
    print "bootup action=%s" % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print "last shutdown = %s" % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)

    config.usage.shutdownOK.setValue(False)
    config.usage.shutdownOK.save()
    configfile.save()

    runReactor()

    print "[mytest.py] normal shutdown"
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    #	if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    #recordtimer
    if session.nav.isRecordTimerImageStandard:  #check RecordTimer instance
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    #zaptimer
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    #powertimer
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    #plugintimer
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]  #"pluginname | pluginfolder"
    tmp = tmp[1].lower()
    #start in standby, depending on plugin type
    if "epgrefresh" in tmp:
        nextPluginName = "EPGRefresh"
        nextPluginTimeInStandby = 1
    elif "vps" in tmp:
        nextPluginName = "VPS"
        nextPluginTimeInStandby = 1
    elif "serienrecorder" in tmp:
        nextPluginName = "SerienRecorder"
        nextPluginTimeInStandby = 0  # plugin function for deep standby from standby not compatible (not available)
    elif "elektro" in tmp:
        nextPluginName = "Elektro"
        nextPluginTimeInStandby = 1
    elif "minipowersave" in tmp:
        nextPluginName = "MiniPowersave"
        nextPluginTimeInStandby = 1
    elif "enhancedpowersave" in tmp:
        nextPluginName = "EnhancedPowersave"
        nextPluginTimeInStandby = 1
    else:
        #default for plugins
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0

    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()

    # individual wakeup time offset
    if config.workaround.wakeuptimeoffset.value == "standard":
        if boxtype.startswith("gb"):
            wpoffset = -120  # Gigaboxes already starts 2 min. before wakeup time
        else:
            wpoffset = 0
    else:
        wpoffset = int(config.workaround.wakeuptimeoffset.value)

    print "=" * 100
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        # wakeup time is 5 min before timer starts + offset
        wptime = startTime[0] - 300 - wpoffset
        if (wptime - nowTime) < 120:  # no time to switch box back on
            wptime = int(nowTime) + 120  # so switch back on in 120 seconds

        #check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            #when next record starts in 15 mins
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            #by vps-plugin
            elif startTime[1] == 3 and nextPluginName == "VPS":
                setStandby = forceNextRecord = 1

        if startTime[1] == 3:
            nextPluginName = " (%s)" % nextPluginName
        else:
            nextPluginName = ""
        print "[mytest.py] set next wakeup type to '%s'%s %s" % (
            {
                0: "record-timer",
                1: "zap-timer",
                2: "power-timer",
                3: "plugin-timer"
            }[startTime[1]], nextPluginName, {
                0: "and starts normal",
                1: "and starts in standby"
            }[setStandby])
        if forceNextRecord:
            print "[mytest.py] set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag"
        print "[mytest.py] set next wakeup time to", strftime(
            "%a, %Y/%m/%d %H:%M:%S", localtime(wptime))
        #set next wakeup
        setFPWakeuptime(wptime)
        #set next standby only after shutdown in deep standby
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2  # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby
        config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d" % (
            wptime, startTime[0], startTime[1], setStandby, nextRecordTime,
            forceNextRecord)
    else:
        config.misc.nextWakeup.value = "-1,-1,0,0,-1,0"
        print "[mytest.py] no set next wakeup time"
    config.misc.nextWakeup.save()
    print "=" * 100

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
コード例 #50
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 setHDMIColorspace(configElement):
        try:
            f = open(SystemInfo["havecolorspace"], "w")
            f.write(configElement.value)
            f.close()
        except:
            pass

    def setHDMIColorimetry(configElement):
        try:
            f = open(SystemInfo["havecolorimetry"], "w")
            f.write(configElement.value)
            f.close()
        except:
            pass

    def setHdmiColordepth(configElement):
        try:
            f = open(SystemInfo["havehdmicolordepth"], "w")
            f.write(configElement.value)
            f.close()
        except:
            pass

    def set3DSurround(configElement):
        f = open("/proc/stb/audio/3d_surround", "w")
        f.write(configElement.value)
        f.close()

    def set3DPosition(configElement):
        f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
        f.write(configElement.value)
        f.close()

    def setAutoVolume(configElement):
        f = open("/proc/stb/audio/avl", "w")
        f.write(configElement.value)
        f.close()

    def setAC3Downmix(configElement):
        f = open("/proc/stb/audio/ac3", "w")
        f.write(configElement.value)
        f.close()
        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)

    def setAC3plusTranscode(configElement):
        f = open("/proc/stb/audio/ac3plus", "w")
        f.write(configElement.value)
        f.close()

    def setDTSDownmix(configElement):
        f = open("/proc/stb/audio/dts", "w")
        f.write(configElement.value)
        f.close()

    def setDTSHD(configElement):
        f = open("/proc/stb/audio/dtshd", "w")
        f.write(configElement.value)
        f.close()

    def setAACDownmix(configElement):
        f = open("/proc/stb/audio/aac", "w")
        f.write(configElement.value)
        f.close()

    def setAACDownmixPlus(configElement):
        f = open("/proc/stb/audio/aacplus", "w")
        f.write(configElement.value)
        f.close()

    def setAACTranscode(configElement):
        f = open("/proc/stb/audio/aac_transcode", "w")
        f.write(configElement.value)
        f.close()

    def setWMAPRO(configElement):
        f = open("/proc/stb/audio/wmapro", "w")
        f.write(configElement.value)
        f.close()

    def setBoxmode(configElement):
        try:
            f = open("/proc/stb/info/boxmode", "w")
            f.write(configElement.value)
            f.close()
        except:
            pass

    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"

    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])

    def read_choices(procx, defchoice):
        with open(procx, 'r') as myfile:
            choices = myfile.read().strip()
        myfile.close()
        if choices:
            choiceslist = choices.split(" ")
            choicesx = [(item, _("%s") % item) for item in choiceslist]
            defaultx = choiceslist[0]
            for item in choiceslist:
                if "%s" % defchoice.upper in item.upper():
                    defaultx = item
                    break
        return (choicesx, defaultx)

    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"]:

        if getBrandOEM() == "vuplus" and SystemInfo["HasMMC"]:
            choices = [("Edid(Auto)", _("Auto")), ("Hdmi_Rgb", _("RGB")),
                       ("444", _("YCbCr444")), ("422", _("YCbCr422")),
                       ("420", _("YCbCr420"))]
            default = "Edid(Auto)"
        else:

            choices = [("auto", _("Auto")), ("rgb", _("RGB")),
                       ("420", _("420")), ("422", _("422")), ("444", _("444"))]
            default = "auto"

        if SystemInfo["havecolorspacechoices"] and SystemInfo["CanProc"]:
            f = "/proc/stb/video/hdmi_colorspace_choices"
            (choices, default) = read_choices(f, default)

        config.av.hdmicolorspace = ConfigSelection(choices=choices,
                                                   default=default)
        config.av.hdmicolorspace.addNotifier(setHDMIColorspace)
    else:
        config.av.hdmicolorspace = ConfigNothing()

    if SystemInfo["havecolorimetry"]:

        choices = [("auto", _("auto")), ("bt2020ncl", _("BT 2020 NCL")),
                   ("bt2020cl", _("BT 2020 CL")), ("bt709", _("BT 709"))]
        default = "auto"

        if SystemInfo["havecolorimetrychoices"] and SystemInfo["CanProc"]:
            f = "/proc/stb/video/hdmi_colorimetry_choices"
            (choices, default) = read_choices(f, default)

        config.av.hdmicolorimetry = ConfigSelection(choices=choices,
                                                    default=default)
        config.av.hdmicolorimetry.addNotifier(setHDMIColorimetry)
    else:
        config.av.hdmicolorimetry = ConfigNothing()

    if SystemInfo["havehdmicolordepth"]:

        choices = [("auto", _("Auto")), ("8bit", _("8bit")),
                   ("10bit", _("10bit")), ("12bit", _("12bit"))]
        default = "auto"

        if SystemInfo["havehdmicolordepthchoices"] and SystemInfo["CanProc"]:
            f = "/proc/stb/video/hdmi_colordepth_choices"
            (choices, default) = read_choices(f, default)

        config.av.hdmicolordepth = ConfigSelection(choices=choices,
                                                   default=default)
        config.av.hdmicolordepth.addNotifier(setHdmiColordepth)
    else:
        config.av.hdmicolordepth = ConfigNothing()

    if SystemInfo["havehdmihdrtype"]:

        def setHdmiHdrType(configElement):
            try:
                f = open("/proc/stb/video/hdmi_hdrtype", "w")
                f.write(configElement.value)
                f.close()
            except:
                pass

        config.av.hdmihdrtype = ConfigSelection(choices={
            "auto": _("Auto"),
            "dolby": _("dolby"),
            "none": _("sdr"),
            "hdr10": _("hdr10"),
            "hlg": _("hlg")
        },
                                                default="auto")
        config.av.hdmihdrtype.addNotifier(setHdmiHdrType)
    else:
        config.av.hdmihdrtype = ConfigNothing()

    if SystemInfo["HDRSupport"]:

        def setHlgSupport(configElement):
            open("/proc/stb/hdmi/hlg_support", "w").write(configElement.value)

        config.av.hlg_support = ConfigSelection(
            default="auto(EDID)",
            choices=[("auto(EDID)", _("controlled by HDMI")),
                     ("yes", _("force enabled")), ("no", _("force disabled"))])
        config.av.hlg_support.addNotifier(setHlgSupport)

        def setHdr10Support(configElement):
            open("/proc/stb/hdmi/hdr10_support",
                 "w").write(configElement.value)

        config.av.hdr10_support = ConfigSelection(
            default="auto(EDID)",
            choices=[("auto(EDID)", _("controlled by HDMI")),
                     ("yes", _("force enabled")), ("no", _("force disabled"))])
        config.av.hdr10_support.addNotifier(setHdr10Support)

        def setDisable12Bit(configElement):
            open("/proc/stb/video/disable_12bit",
                 "w").write(configElement.value)

        config.av.allow_12bit = ConfigSelection(default="0",
                                                choices=[("0", _("yes")),
                                                         ("1", _("no"))])
        config.av.allow_12bit.addNotifier(setDisable12Bit)

        def setDisable10Bit(configElement):
            open("/proc/stb/video/disable_10bit",
                 "w").write(configElement.value)

        config.av.allow_10bit = ConfigSelection(default="0",
                                                choices=[("0", _("yes")),
                                                         ("1", _("no"))])
        config.av.allow_10bit.addNotifier(setDisable10Bit)

    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"]:

        choices = [("none", _("off")), ("hdmi", _("HDMI")),
                   ("spdif", _("SPDIF")), ("dac", _("DAC"))]
        default = "none"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/3d_surround_choices"
            (choices, default) = read_choices(f, default)

        config.av.surround_3d = ConfigSelection(choices=choices,
                                                default="none")
        config.av.surround_3d.addNotifier(set3DSurround)
    else:
        config.av.surround_3d = ConfigNothing()

    if SystemInfo["Can3DSpeaker"]:

        choices = [("center", _("center")), ("wide", _("wide")),
                   ("extrawide", _("extra wide"))]
        default = "center"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/3d_surround_speaker_position_choices"
            (choices, default) = read_choices(f, default)

        config.av.surround_3d_speaker = ConfigSelection(choices=choices,
                                                        default=default)
        config.av.surround_3d_speaker.addNotifier(set3DPosition)
    else:
        config.av.surround_3d_speaker = ConfigNothing()

    if SystemInfo["CanAutoVolume"]:

        choices = [("none", _("off")), ("hdmi", _("HDMI")),
                   ("spdif", _("SPDIF")), ("dac", _("DAC"))]
        default = "none"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/avl_choices"
            (choices, default) = read_choices(f, default)
        config.av.autovolume = ConfigSelection(choices=choices,
                                               default=default)
        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"]:

        choices = [("downmix", _("Downmix")),
                   ("passthrough", _("Passthrough"))]
        default = "downmix"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/ac3_choices"
            (choices, default) = read_choices(f, default)
        config.av.downmix_ac3 = ConfigSelection(choices=choices,
                                                default=default)
        config.av.downmix_ac3.addNotifier(setAC3Downmix)

    if SystemInfo["CanAC3Transcode"]:

        choices = [("use_hdmi_caps", _("controlled by HDMI")),
                   ("force_ac3", _("convert to AC3"))]
        default = "force_ac3"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/ac3plus_choices"
            (choices, default) = read_choices(f, default)
        config.av.transcodeac3plus = ConfigSelection(choices=choices,
                                                     default=default)
        config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

    if SystemInfo["CanDownmixDTS"]:

        choice_list = [("downmix", _("Downmix")),
                       ("passthrough", _("Passthrough"))]
        default = "downmix"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/dts_choices"
            (choices, default) = read_choices(f, default)

        config.av.downmix_dts = ConfigSelection(choices=choices,
                                                default=default)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDTSHD"]:

        choices = [("downmix", _("Downmix")),
                   ("force_dts", _("convert to DTS")),
                   ("use_hdmi_caps", _("controlled by HDMI")),
                   ("multichannel", _("convert to multi-channel PCM")),
                   ("hdmi_best", _("use best / controlled by HDMI"))]
        default = "downmix"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/dtshd_choices"
            (choices, default) = read_choices(f, default)

        config.av.dtshd = ConfigSelection(choices=choices, default=default)
        config.av.dtshd.addNotifier(setDTSHD)

    if SystemInfo["CanDownmixAAC"]:

        choices = [("downmix", _("Downmix")),
                   ("passthrough", _("Passthrough"))]
        default = "downmix"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/aac_choices"
            (choices, default) = read_choices(f, default)

        config.av.downmix_aac = ConfigSelection(choices=choices,
                                                default=default)
        config.av.downmix_aac.addNotifier(setAACDownmix)

    if SystemInfo["CanDownmixAACPlus"]:

        choices = [("downmix", _("Downmix")),
                   ("passthrough", _("Passthrough")),
                   ("multichannel", _("convert to multi-channel PCM")),
                   ("force_ac3", _("convert to AC3")),
                   ("force_dts", _("convert to DTS")),
                   ("use_hdmi_cacenter", _("use_hdmi_cacenter")),
                   ("wide", _("wide")), ("extrawide", _("extrawide"))]
        default = "downmix"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/aacplus_choices"
            (choices, default) = read_choices(f, default)

        config.av.downmix_aacplus = ConfigSelection(choices=choices,
                                                    default=default)
        config.av.downmix_aacplus.addNotifier(setAACDownmixPlus)

    if SystemInfo["CanAACTranscode"]:

        choices = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
        default = "off"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/aac_transcode_choices"
            (choices, default) = read_choices(f, default)

        config.av.transcodeaac = ConfigSelection(choices=choices,
                                                 default=default)
        config.av.transcodeaac.addNotifier(setAACTranscode)
    else:
        config.av.transcodeaac = ConfigNothing()

    if SystemInfo["CanWMAPRO"]:
        choices = [("downmix", _("Downmix")),
                   ("passthrough", _("Passthrough")),
                   ("multichannel", _("convert to multi-channel PCM")),
                   ("hdmi_best", _("use best / controlled by HDMI"))]
        default = "downmix"

        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/wmapro_choices"
            (choices, default) = read_choices(f, default)

        config.av.wmapro = ConfigSelection(choices=choices, default=default)
        config.av.wmapro.addNotifier(setWMAPRO)

    if SystemInfo["haveboxmode"]:
        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["HasScaler_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()
コード例 #51
0
def getFilePath(setting):
	if getBrandOEM() in ('dreambox'):
		return "/proc/stb/vmpeg/0/dst_%s" % (setting)
	else:
		return "/proc/stb/fb/dst_%s" % (setting)
コード例 #52
0
class AVSwitch:
    print("BoxBranding", "MachineBuild", getMachineBuild())
    print("BoxBranding", "BoxType", getBoxType())
    print("BoxBranding", "BrandOEM", getBrandOEM())
    print("BoxBranding", "DisplayType", getDisplayType())
    print("AVSwitch", "hasRCA", SystemInfo["hasRCA"])
    print("AVSwitch", "hasSCART", SystemInfo["hasScart"])
    print("AVSwitch", "hasJACK", SystemInfo["hasJack"])
    print("AVSwitch", "hasYUV", SystemInfo["hasYUV"])
    print("AVSwitch", "HasScartYUV", SystemInfo["hasScartYUV"])

    rates = {}  # high-level, use selectable modes.
    modes = {}  # a list of (high-level) modes for a certain port.

    rates["PAL"] = {
        "50Hz": {
            50: "pal"
        },
        "60Hz": {
            60: "pal60"
        },
        "multi": {
            50: "pal",
            60: "pal60"
        }
    }
    rates["NTSC"] = {"60Hz": {60: "ntsc"}}
    rates["Multi"] = {"multi": {50: "pal", 60: "ntsc"}}
    rates["480i"] = {"60Hz": {60: "480i"}}
    rates["576i"] = {"50Hz": {50: "576i"}}
    rates["480p"] = {"60Hz": {60: "480p"}}
    rates["576p"] = {"50Hz": {50: "576p"}}
    rates["720p"] = {
        "50Hz": {
            50: "720p50"
        },
        "60Hz": {
            60: "720p"
        },
        "multi": {
            50: "720p50",
            60: "720p"
        }
    }
    rates["1080i"] = {
        "50Hz": {
            50: "1080i50"
        },
        "60Hz": {
            60: "1080i"
        },
        "multi": {
            50: "1080i50",
            60: "1080i"
        }
    }
    rates["1080p"] = {
        "50Hz": {
            50: "1080p50"
        },
        "60Hz": {
            60: "1080p"
        },
        "multi": {
            50: "1080p50",
            60: "1080p"
        }
    }
    rates["2160p"] = {
        "50Hz": {
            50: "2160p50"
        },
        "60Hz": {
            60: "2160p"
        },
        "multi": {
            50: "2160p50",
            60: "2160p"
        }
    }
    rates["2160p30"] = {"multi": {50: "2160p25", 60: "2160p30"}}
    rates["PC"] = {
        "1024x768": {
            60: "1024x768"
        },  # not possible on DM7025
        "800x600": {
            60: "800x600"
        },  # also not possible
        "720x480": {
            60: "720x480"
        },
        "720x576": {
            60: "720x576"
        },
        "1280x720": {
            60: "1280x720"
        },
        "1280x720 multi": {
            50: "1280x720_50",
            60: "1280x720"
        },
        "1920x1080": {
            60: "1920x1080"
        },
        "1920x1080 multi": {
            50: "1920x1080",
            60: "1920x1080_50"
        },
        "1280x1024": {
            60: "1280x1024"
        },
        "1366x768": {
            60: "1366x768"
        },
        "1366x768 multi": {
            50: "1366x768",
            60: "1366x768_50"
        },
        "1280x768": {
            60: "1280x768"
        },
        "640x480": {
            60: "640x480"
        }
    }

    modes["HDMI"] = SystemInfo["VideoModes"][0]
    widescreen_modes = SystemInfo["VideoModes"][1]

    if SystemInfo["hasYUV"]:
        modes["YPbPr"] = modes["HDMI"]

    if SystemInfo["hasScartYUV"]:
        modes["Scart-YPbPr"] = modes["HDMI"]

    if SystemInfo["hasRCA"]:
        modes["RCA"] = ["PAL", "NTSC", "Multi"]

    if SystemInfo["hasJack"]:
        modes["Jack"] = ["PAL", "NTSC", "Multi"]

    if SystemInfo["hasScart"]:
        modes["Scart"] = ["PAL", "NTSC", "Multi"]

    print("[AVSwitch] Modes-B are %s" % modes)

    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

        try:
            f = open("/proc/stb/video/videomode_50hz", "w")
            f.write(mode_50)
            f.close()
        except IOError:
            print "[AVSwitch] cannot open /proc/stb/video/videomode_50hz"
        try:
            f = open("/proc/stb/video/videomode_60hz", "w")
            f.write(mode_60)
            f.close()
        except IOError:
            print "[AVSwitch] cannot open /proc/stb/video/videomode_60hz"

        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])

        if about.getCPUString().startswith('STx'):
            #call setResolution() with -1,-1 to read the new scrren dimensions without changing the framebuffer resolution
            from enigma import gMainDC
            gMainDC.getInstance().setResolution(-1, -1)

    def saveMode(self, port, mode, rate):
        config.av.videoport.setValue(port)
        config.av.videoport.save()
        if port in config.av.videomode:
            config.av.videomode[port].setValue(mode)
            config.av.videomode[port].save()
        if mode in config.av.videorate:
            config.av.videorate[mode].setValue(rate)
            config.av.videorate[mode].save()

    def isPortAvailable(self, port):
        # fixme
        return True

    def isPortUsed(self, port):
        if port == "HDMI":
            self.readPreferredModes()
            return len(self.modes_preferred) != 0
        else:
            return True

    def getPortList(self):
        return [port for port in self.modes if self.isPortAvailable(port)]

    # get a list with all modes, with all rates, for a given port.
    def getModeList(self, port):
        res = []
        for mode in self.modes[port]:
            # list all rates which are completely valid
            rates = [
                rate for rate in self.rates[mode]
                if self.isModeAvailable(port, mode, rate)
            ]

            # if at least one rate is ok, add this mode
            if len(rates):
                res.append((mode, rates))
        return res

    def createConfig(self, *args):
        hw_type = HardwareInfo().get_device_name()
        has_hdmi = HardwareInfo().has_hdmi()
        lst = []

        config.av.videomode = ConfigSubDict()
        config.av.videorate = ConfigSubDict()

        # create list of output ports
        portlist = self.getPortList()
        for port in portlist:
            descr = port
            if 'HDMI' in port:
                lst.insert(0, (port, descr))
            else:
                lst.append((port, descr))

            modes = self.getModeList(port)
            if len(modes):
                config.av.videomode[port] = ConfigSelection(
                    choices=[mode for (mode, rates) in modes])
            for (mode, rates) in modes:
                config.av.videorate[mode] = ConfigSelection(choices=rates)
        config.av.videoport = ConfigSelection(choices=lst)

    def setInput(self, input):
        INPUT = {"ENCODER": 0, "SCART": 1, "AUX": 2}
        eAVSwitch.getInstance().setInput(INPUT[input])

    def setColorFormat(self, value):
        if not self.current_port:
            self.current_port = config.av.videoport.value
        if self.current_port in ("YPbPr", "Scart-YPbPr"):
            eAVSwitch.getInstance().setColorFormat(3)
        elif self.current_port in ("RCA"):
            eAVSwitch.getInstance().setColorFormat(0)
        else:
            eAVSwitch.getInstance().setColorFormat(value)

    def setConfiguredMode(self):
        port = config.av.videoport.value
        if port not in config.av.videomode:
            print "[VideoHardware] current port not available, not setting videomode"
            return

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

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

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

    def setAspect(self, cfgelement):
        print "[VideoHardware] setting aspect: %s" % cfgelement.value
        f = open("/proc/stb/video/aspect", "w")
        f.write(cfgelement.value)
        f.close()

    def setWss(self, cfgelement):
        if not cfgelement.value:
            wss = "auto(4:3_off)"
        else:
            wss = "auto"
        print "[VideoHardware] setting wss: %s" % wss
        f = open("/proc/stb/denc/0/wss", "w")
        f.write(wss)
        f.close()

    def setPolicy43(self, cfgelement):
        print "[VideoHardware] setting policy: %s" % cfgelement.value
        f = open("/proc/stb/video/policy", "w")
        f.write(cfgelement.value)
        f.close()

    def setPolicy169(self, cfgelement):
        if os.path.exists("/proc/stb/video/policy2"):
            print "[VideoHardware] setting policy2: %s" % cfgelement.value
            f = open("/proc/stb/video/policy2", "w")
            f.write(cfgelement.value)
            f.close()

    def getOutputAspect(self):
        ret = (16, 9)
        port = config.av.videoport.value
        if port not in config.av.videomode:
            print "[VideoHardware] current port not available in getOutputAspect!!! force 16:9"
        else:
            mode = config.av.videomode[port].value
            force_widescreen = self.isWidescreenMode(port, mode)
            is_widescreen = force_widescreen or config.av.aspect.value in (
                "16:9", "16:10")
            is_auto = config.av.aspect.value == "auto"
            if is_widescreen:
                if force_widescreen:
                    pass
                else:
                    aspect = {
                        "16:9": "16:9",
                        "16:10": "16:10"
                    }[config.av.aspect.value]
                    if aspect == "16:10":
                        ret = (16, 10)
            elif is_auto:
                try:
                    aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read()
                    if aspect_str == "1":  # 4:3
                        ret = (4, 3)
                except IOError:
                    pass
            else:  # 4:3
                ret = (4, 3)
        return ret

    def getFramebufferScale(self):
        aspect = self.getOutputAspect()
        fb_size = getDesktop(0).size()
        return aspect[0] * fb_size.height(), aspect[1] * fb_size.width()

    def getAspectRatioSetting(self):
        valstr = config.av.aspectratio.value
        if valstr == "4_3_letterbox":
            val = 0
        elif valstr == "4_3_panscan":
            val = 1
        elif valstr == "16_9":
            val = 2
        elif valstr == "16_9_always":
            val = 3
        elif valstr == "16_10_letterbox":
            val = 4
        elif valstr == "16_10_panscan":
            val = 5
        elif valstr == "16_9_letterbox":
            val = 6
        return val
コード例 #53
0
ファイル: SystemInfo.py プロジェクト: retrofan1979/enigma2
SystemInfo["VFD_final_scroll_delay"] = not SystemInfo["7segment"] and getBoxType() not in ("et8500",) and fileCheck("/proc/stb/lcd/final_scroll_delay")
SystemInfo["LcdLiveTV"] = fileCheck("/proc/stb/fb/sd_detach") or fileCheck("/proc/stb/lcd/live_enable")
SystemInfo["LCDMiniTV"] = fileExists("/proc/stb/lcd/mode")
SystemInfo["LCDMiniTVPiP"] = SystemInfo["LCDMiniTV"] and getBoxType() != "gb800ueplus"
SystemInfo["LcdPowerOn"] = fileExists("/proc/stb/power/vfd")
SystemInfo["FastChannelChange"] = False
SystemInfo["3DMode"] = fileCheck("/proc/stb/fb/3dmode") or fileCheck("/proc/stb/fb/primary/3d")
SystemInfo["3DZNorm"] = fileCheck("/proc/stb/fb/znorm") or fileCheck("/proc/stb/fb/primary/zoffset")
SystemInfo["Blindscan_t2_available"] = fileCheck("/proc/stb/info/vumodel")
SystemInfo["HasTranscoding"] = pathExists("/proc/stb/encoder/0") or fileCheck("/dev/bcm_enc0")
SystemInfo["HasH265Encoder"] = fileHas("/proc/stb/encoder/0/vcodec_choices", "h265")
SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = getBoxType() in ("vusolo4k", "gbquad4k")
SystemInfo["hasXcoreVFD"] = getBoxType() in ("osmega", "spycat4k", "spycat4kmini", "spycat4kcomb") and fileCheck("/sys/module/brcmstb_%s/parameters/pt6302_cgram" % getBoxType())
SystemInfo["HasHDMIin"] = getHaveHDMIinHD() in ("True",) or getHaveHDMIinFHD() in ("True",)
SystemInfo["HasHDMI-CEC"] = fileExists("/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
SystemInfo["HasInfoButton"] = getBrandOEM() in ("airdigital", "broadmedia", "ceryon", "dags", "dinobot", "edision", "formuler", "gfutures", "gigablue", "ini", "maxytec", "octagon", "odin", "skylake", "tiviar", "xcore", "xp", "xtrend")
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["AndroidMode"] = SystemInfo["RecoveryMode"] and getMachineBuild() in ("multibox",)
SystemInfo["MBbootdevice"] = getMBbootdevice()
SystemInfo["canMultiBoot"] = getMultibootslots()
SystemInfo["HasHiSi"] = pathExists("/proc/hisi")
SystemInfo["canBackupEMC"] = getMachineBuild() in ("hd51", "h7") and ("disk.img", "%s" % SystemInfo["MBbootdevice"]) or getMachineBuild() in ("osmio4k", "osmio4kplus", "osmini4k") and ("emmc.img", "%s" % SystemInfo["MBbootdevice"]) or SystemInfo["HasHiSi"] and ("usb_update.bin", "none")
SystemInfo["canMode12"] = getMachineBuild() in ("hd51", "h7") and ("brcm_cma=440M@328M brcm_cma=192M@768M", "brcm_cma=520M@248M brcm_cma=200M@768M")
SystemInfo["HasMMC"] = fileHas("/proc/cmdline", "root=/dev/mmcblk") or "mmcblk" in getMachineMtdRoot()
SystemInfo["HasH9SD"] = getMachineBuild() in ("h9", "i55plus") and pathExists("/dev/mmcblk0p1")
SystemInfo["HasSDnomount"] = getMachineBuild() in ("h9", "i55plus") and (False, "none") or getMachineBuild() in ("multibox", "h9combo", "h9twin") and (True, "mmcblk0")
SystemInfo["CanProc"] = SystemInfo["HasMMC"] and getBrandOEM() != "vuplus"
SystemInfo["Canaudiosource"] = fileCheck("/proc/stb/hdmi/audio_source")
SystemInfo["Can3DSurround"] = fileHas("/proc/stb/audio/3d_surround_choices", "none")
SystemInfo["Can3DSpeaker"] = fileHas("/proc/stb/audio/3d_surround_speaker_position_choices", "center")
SystemInfo["CanAutoVolume"] = fileHas("/proc/stb/audio/avl_choices", "none")
コード例 #54
0
    "/dev/dbox/lcd0")
SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
SystemInfo["OledDisplay"] = fileExists(
    resolveFilename(
        SCOPE_SKIN, 'display/skin_display_picon.xml')) or fileExists(
            resolveFilename(SCOPE_SKIN, 'vfd_skin/skin_display_no_picon.xml')
        ) or getBoxType() in ('osminiplus')
SystemInfo["TextDisplay"] = fileExists(
    resolveFilename(SCOPE_SKIN, 'display/skin_text_clock.xml'))
SystemInfo["DeepstandbySupport"] = HardwareInfo().has_deepstandby()
SystemInfo["Fan"] = fileExists("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileExists("/proc/stb/fp/fan_pwm")
SystemInfo["StandbyLED"] = fileExists("/proc/stb/power/standbyled")
SystemInfo["StandbyPowerLed"] = fileExists("/proc/stb/power/standbyled")
SystemInfo["FBLCDDisplay"] = fileCheck("/proc/stb/fb/sd_detach")
SystemInfo["lxbuttons"] = getBrandOEM() == "ini"
SystemInfo["homebutton"] = getBoxType().startswith('ixuss')
SystemInfo["endbutton"] = getBoxType().startswith('ixuss')
SystemInfo["3FunctionButtons"] = getBoxType() == "et8000" or getBoxType(
) == "et6x00" or getBoxType() == "et10000" or getBoxType().startswith('gb')
SystemInfo["4FunctionButtons"] = getBoxType().startswith('gb')
SystemInfo["WakeOnLAN"] = fileCheck("/proc/stb/fp/wol") or fileCheck(
    "/proc/stb/power/wol")
SystemInfo["HDMICEC"] = (
    fileExists("/dev/hdmi_cec")
    or fileExists("/dev/misc/hdmi_cec0")) and fileExists(
        "/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
SystemInfo["SABSetup"] = fileExists(
    "/usr/lib/enigma2/python/Plugins/SystemPlugins/SABnzbd/plugin.pyo")
SystemInfo["SeekStatePlay"] = False
SystemInfo["GraphicLCD"] = getBoxType() in ('vuultimo', 'xpeedlx3', 'et10000',
コード例 #55
0
class AnimationSetupScreen(Screen):
    if getBrandOEM() == 'gigablue':
        animationSetupItems = [
            {
                "idx": 0,
                "name": _("Disable Animations")
            },
            {
                "idx": 1,
                "name": _("Simple fade")
            },
            {
                "idx": 2,
                "name": _("Simple zoom")
            },
            {
                "idx": 3,
                "name": _("Grow drop")
            },
            {
                "idx": 4,
                "name": _("Grow from left")
            },
            {
                "idx": 5,
                "name": _("Extrude from left")
            },
            #{"idx":6, "name":_("Popup")},
            {
                "idx": 7,
                "name": _("Slide drop")
            },
            {
                "idx": 8,
                "name": _("Slide from left")
            },
            {
                "idx": 9,
                "name": _("Slide left to right")
            },
            {
                "idx": 10,
                "name": _("Slide right to left")
            },
            {
                "idx": 11,
                "name": _("Slide top to bottom")
            },
            {
                "idx": 12,
                "name": _("Zoom from left")
            },
            {
                "idx": 13,
                "name": _("Zoom from right")
            },
            {
                "idx": 14,
                "name": _("Stripes")
            },
        ]
    else:
        animationSetupItems = [
            {
                "idx": 0,
                "name": _("Disable Animations")
            },
            {
                "idx": 1,
                "name": _("Simple fade")
            },
            {
                "idx": 2,
                "name": _("Grow drop")
            },
            {
                "idx": 3,
                "name": _("Grow from left")
            },
            {
                "idx": 4,
                "name": _("Popup")
            },
            {
                "idx": 5,
                "name": _("Slide drop")
            },
            {
                "idx": 6,
                "name": _("Slide left to right")
            },
            {
                "idx": 7,
                "name": _("Slide top to bottom")
            },
            {
                "idx": 8,
                "name": _("Stripes")
            },
        ]

    skin = """
		<screen name="AnimationSetup" position="center,center" size="680,400" title="Animation Setup">
			<ePixmap pixmap="buttons/red.png" position="0,0" size="140,40" zPosition="1" alphatest="on" />
			<ePixmap pixmap="buttons/green.png" position="140,0" size="140,40" zPosition="1" alphatest="on" />
			<ePixmap pixmap="buttons/yellow.png" position="280,0" size="140,40" zPosition="1" alphatest="on" />
			<ePixmap pixmap="buttons/blue.png" position="420,0" size="140,40" zPosition="1" alphatest="on" />

			<widget source="key_red" render="Label" position="0,0" zPosition="2" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#9f1313" transparent="1" />
			<widget source="key_green" render="Label" position="140,0" zPosition="2" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#1f771f" transparent="1" />
			<widget source="key_yellow" render="Label" position="280,0" zPosition="2" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#a08500" transparent="1" />
			<widget source="key_blue" render="Label" position="420,0" zPosition="2" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ffffff" backgroundColor="#18188b" transparent="1" />

			<widget name="list" position="10,60" size="660,364" scrollbarMode="showOnDemand" />
			<widget source="introduction" render="Label" position="0,370" size="560,40" zPosition="10" font="Regular;20" valign="center" backgroundColor="#25062748" transparent="1" />
		</screen>"""

    def __init__(self, session):

        self.skin = AnimationSetupScreen.skin
        Screen.__init__(self, session)

        self.animationList = []

        self["introduction"] = StaticText(_("* current animation"))
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save"))
        self["key_yellow"] = StaticText(_("Settings"))
        self["key_blue"] = StaticText(_("Preview"))

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "cancel": self.keyclose,
                "save": self.ok,
                "ok": self.ok,
                "yellow": self.config,
                "blue": self.preview
            }, -3)

        self["list"] = MenuList(self.animationList)

        self.onLayoutFinish.append(self.layoutFinished)

    def layoutFinished(self):
        l = []
        for x in self.animationSetupItems:
            key = x.get("idx", 0)
            name = x.get("name", "??")
            if key == config.misc.window_animation_default.value:
                name = "* %s" % (name)
            l.append((name, key))

        self["list"].setList(l)

    def ok(self):
        current = self["list"].getCurrent()
        if current:
            key = current[1]
            config.misc.window_animation_default.value = key
            config.misc.window_animation_default.save()
            setAnimation_current(key)
        self.close()

    def keyclose(self):
        setAnimation_current(config.misc.window_animation_default.value)
        setAnimation_speed(int(config.misc.window_animation_speed.value))
        self.close()

    def config(self):
        self.session.open(AnimationSetupConfig)

    def preview(self):
        current = self["list"].getCurrent()
        if current:
            global g_animation_paused
            tmp = g_animation_paused
            g_animation_paused = False

            setAnimation_current(current[1])
            self.session.open(MessageBox,
                              current[0],
                              MessageBox.TYPE_INFO,
                              timeout=3)
            g_animation_paused = tmp
コード例 #56
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.
    supports2160p = False
    supports1080p = False

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

    SystemInfo["have24hz"] = os.path.exists("/proc/stb/video/videomode_24hz")
    if SystemInfo["have24hz"]:
        for mode, rate in rates.iteritems():
            if mode[0].isdigit() and "multi" in rate:
                rate["multi"][24] = mode[:-1] + "p24"

    modes["Scart"] = ["PAL", "NTSC", "Multi"]
    # modes["DVI-PC"] = ["PC"]

    if about.getChipSetString() in ('5272s', '7251', '7251S', '7251s', '7252',
                                    '7252S', '7252s', '7366', '7376', '7444s',
                                    '3798mv200', '3798cv200', 'hi3798mv200',
                                    'hi3798cv200'):
        supports2160p = True
        supports1080p = True
        modes["HDMI"] = [
            "1080p", "1080i", "720p", "576p", "576i", "480p", "480i", "2160p"
        ]
        widescreen_modes = {"1080p", "1080i", "720p", "2160p"}
    elif about.getChipSetString() in ('7241', '7356', '73565', '7358', '7362',
                                      '73625', '7424', '7425', '7552'):
        supports1080p = True
        modes["HDMI"] = [
            "1080p", "1080i", "720p", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"1080p", "1080i", "720p"}
    else:
        modes["HDMI"] = ["1080i", "720p", "576p", "576i", "480p", "480i"]
        widescreen_modes = {"1080i", "720p"}

    modes["YPbPr"] = modes["HDMI"]
    if getBrandOEM() == 'vuplus' and getBoxType() not in ('vusolo4k',
                                                          'vuultimo4k',
                                                          'vuuno4k'):
        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',
        'e3hd',
        'ebox7358',
        'eboxlumi',
        'ebox5100',
        'enfinity',
        'et13000',
        'et4x00',
        'gbx1',
        'gbx3',
        'iqonios300hd',
        'ixusszero',
        'mbmicro',
        'mbtwinplus',
        'mutant11',
        'mutant51',
        'mutant500c',
        'mutant1200',
        'mutant1500',
        'odimm7',
        'optimussos1',
        'osmega',
        'osmini',
        'osminiplus',
        'sf128',
        'sf138',
        'sf4008',
        'tm2t',
        'tmnano',
        'tmnano2super',
        'tmnano3t',
        'tmnanose',
        'tmnanosecombo',
        'tmnanoseplus',
        'tmnanosem2',
        'tmnanosem2plus',
        'tmnanom3',
        'tmsingle',
        'tmtwin4k',
        'uniboxhd1',
        'vusolo2',
        'vusolo4k',
        'vuuno4k',
        'vuultimo4k',
        'xp1000',
    )

    # Machines that have composite video (yellow RCA socket) but do not have Scart.
    yellow_RCA_no_scart = (
        'gb800ueplus',
        'gbultraue',
        'mbmicro',
        '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 = (
        'et13000',
        'et5x00',
        'et6x00',
        'gbquad',
        'gbx1',
        'gbx3',
        'ixussone',
        'mutant51',
        'mutant1500',
        'sf4008',
        'tmnano2t',
        'tmnanom3',
        'tmtwin4k',
        'vusolo4k',
        'vuuno4k',
        'vuultimo4k',
    )

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

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

    if "Scart" in modes and (getBoxType() in no_yellow_RCA__no_scart
                             or getMachineBuild() 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.modes_available = self.readAvailableModes()

        self.createConfig()
        self.readPreferredModes()

    def readAvailableModes(self):
        try:
            f = open("/proc/stb/video/videomode_choices")
            modes = f.read().strip()
            f.close()
        except IOError:
            print "[VideoHardware] could not read available videomodes"
            modes = []
            return modes
        return modes.split(' ')

    def readPreferredModes(self):
        try:
            f = open("/proc/stb/video/videomode_preferred")
            modes = f.read().strip()
            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):
        # config.av.videoport.setValue(port)
        # we can ignore "port"
        self.current_mode = mode
        self.current_port = port
        self.current_rate = rate
        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_24 = mode_60
        if mode_60 is None or force == 50:
            mode_60 = mode_24 = mode_50
        if mode_24 is None:
            mode_24 = mode_60

        if os.path.exists('/proc/stb/video/videomode_50hz') and getBoxType(
        ) not in ('gbquadplus', 'gb800solo', 'gb800se', 'gb800ue',
                  'gb800ueplus'):
            try:
                f = open("/proc/stb/video/videomode_50hz", "w")
                f.write(mode_50)
                f.close()
            except:
                print "[AVSwitch] failed to set videomode_50hz to", mode_50

        if os.path.exists('/proc/stb/video/videomode_60hz') and getBoxType(
        ) not in ('gbquadplus', 'gb800solo', 'gb800se', 'gb800ue',
                  'gb800ueplus'):
            try:
                f = open("/proc/stb/video/videomode_60hz", "w")
                f.write(mode_60)
                f.close()
            except:
                print "[AVSwitch] failed to set videomode_60hz to", mode_60

        if SystemInfo["have24hz"]:
            try:
                f = open("/proc/stb/video/videomode_24hz", "w")
                f.write(mode_24)
                f.close()
            except:
                print "[AVSwitch] failed to set videomode_24hz to", mode_24

        try:
            if rate == "multi":
                mode_etc = mode_50
            else:
                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 as err:
                print "[AVSwitch] setting videomode failed:", err

        self.setColorFormat({
            "cvbs": 0,
            "rgb": 1,
            "svideo": 2,
            "yuv": 3
        }[config.av.colorformat.value])

    def saveMode(self, port, mode, rate):
        config.av.videoport.setValue(port)
        config.av.videoport.save()
        if port in config.av.videomode:
            config.av.videomode[port].setValue(mode)
            config.av.videomode[port].save()
        if mode in config.av.videorate:
            config.av.videorate[mode].setValue(rate)
            config.av.videorate[mode].save()

    def isPortAvailable(self, port):
        # fixme
        return True

    def isPortUsed(self, port):
        if port == "HDMI":
            self.readPreferredModes()
            return len(self.modes_preferred) != 0
        else:
            return True

    def getPortList(self):
        return [port for port in self.modes if self.isPortAvailable(port)]

    # get a list with all modes, with all rates, for a given port.
    def getModeList(self, port):
        res = []
        for mode in self.modes[port]:
            # list all rates which are completely valid
            rates = [
                rate for rate in self.rates[mode]
                if self.isModeAvailable(port, mode, rate)
            ]

            # if at least one rate is ok, add this mode
            if len(rates):
                res.append((mode, rates))
        return res

    def createConfig(self, *args):
        hw_type = HardwareInfo().get_device_name()
        has_hdmi = HardwareInfo().has_hdmi()
        lst = []

        config.av.videomode = ConfigSubDict()
        config.av.videorate = ConfigSubDict()

        # create list of output ports
        portlist = self.getPortList()
        for port in portlist:
            descr = port
            if 'HDMI' in port:
                lst.insert(0, (port, descr))
            else:
                lst.append((port, descr))

            modes = self.getModeList(port)
            if len(modes):
                config.av.videomode[port] = ConfigSelection(
                    choices=[mode for (mode, rates) in modes])
            for (mode, rates) in modes:
                config.av.videorate[mode] = ConfigSelection(choices=rates)
        config.av.videoport = ConfigSelection(choices=lst)

    def setInput(self, input):
        INPUT = {"ENCODER": 0, "SCART": 1, "AUX": 2}
        eAVSwitch.getInstance().setInput(INPUT[input])

    def setColorFormat(self, value):
        if not self.current_port:
            self.current_port = config.av.videoport.value
        if self.current_port in ("YPbPr", "Scart-YPbPr"):
            eAVSwitch.getInstance().setColorFormat(3)
        elif self.current_port in ("RCA", ):
            eAVSwitch.getInstance().setColorFormat(0)
        else:
            eAVSwitch.getInstance().setColorFormat(value)

    def setConfiguredMode(self):
        port = config.av.videoport.value
        if port not in config.av.videomode:
            print "[VideoHardware] current port not available, not setting videomode"
            return

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

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

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

    def setAspect(self, cfgelement):
        print "[VideoHardware] setting aspect: %s" % cfgelement.value
        f = open("/proc/stb/video/aspect", "w")
        f.write(cfgelement.value)
        f.close()

    def setWss(self, cfgelement):
        if not cfgelement.value:
            wss = "auto(4:3_off)"
        else:
            wss = "auto"
        print "[VideoHardware] setting wss: %s" % wss
        f = open("/proc/stb/denc/0/wss", "w")
        f.write(wss)
        f.close()

    def setPolicy43(self, cfgelement):
        print "[VideoHardware] setting policy: %s" % cfgelement.value
        f = open("/proc/stb/video/policy", "w")
        f.write(cfgelement.value)
        f.close()

    def setPolicy169(self, cfgelement):
        if os.path.exists("/proc/stb/video/policy2"):
            print "[VideoHardware] setting policy2: %s" % cfgelement.value
            f = open("/proc/stb/video/policy2", "w")
            f.write(cfgelement.value)
            f.close()

    def getOutputAspect(self):
        ret = (16, 9)
        port = config.av.videoport.value
        if port not in config.av.videomode:
            print "[VideoHardware] current port not available in getOutputAspect!!! force 16:9"
        else:
            mode = config.av.videomode[port].value
            force_widescreen = self.isWidescreenMode(port, mode)
            is_widescreen = force_widescreen or config.av.aspect.value in (
                "16:9", "16:10")
            is_auto = config.av.aspect.value == "auto"
            if is_widescreen:
                if force_widescreen:
                    pass
                else:
                    aspect = {
                        "16:9": "16:9",
                        "16:10": "16:10"
                    }[config.av.aspect.value]
                    if aspect == "16:10":
                        ret = (16, 10)
            elif is_auto:
                try:
                    aspect_str = open("/proc/stb/vmpeg/0/aspect",
                                      "r").read().strip()
                    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
コード例 #57
0
def runScreenTest():
    def runNextScreen(session, screensToRun, *result):
        if result:
            print("[StartEnigma] Exiting via quitMainloop #3.")
            enigma.quitMainloop(*result)
            return
        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    config.misc.startCounter.value += 1
    profile("ReadPluginList")
    enigma.pauseInit()
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
    enigma.resumeInit()
    profile("Init:Session")
    nav = Navigation(config.misc.nextWakeup.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summaryDesktop=enigma.getDesktop(1),
                      navigation=nav)
    CiHandler.setSession(session)
    from Screens.SwapManager import SwapAutostart
    SwapAutostart()
    profile("InitWizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            session.open(RestoreScreen, runRestore=True)
        else:
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system("rm -f /media/hdd/images/config/autorestore")
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()
    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()
    print(screensToRun)
    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)
    if not RestoreSettings:
        runNextScreen(session, screensToRun)
    profile("InitVolumeControl")
    vol = VolumeControl(session)
    profile("InitPowerKey")
    power = PowerKey(session)
    if BOX_TYPE in (
            "alien5", "osninopro", "osnino", "osninoplus", "alphatriple",
            "spycat4kmini", "tmtwin4k", "mbmicrov2", "revo4k", "force3uhd",
            "wetekplay", "wetekplay2", "wetekhub", "dm7020hd", "dm7020hdv2",
            "osminiplus", "osmega", "sf3038", "spycat", "e4hd", "e4hdhybrid",
            "mbmicro", "et7500", "mixosf5", "mixosf7", "mixoslumi", "gi9196m",
            "maram9", "ixussone", "ixusszero", "uniboxhd1", "uniboxhd2",
            "uniboxhd3", "sezam5000hd", "mbtwin", "sezam1000hd", "mbmini",
            "atemio5x00", "beyonwizt3", "9910lx", "9911lx", "9920lx",
            "dual") or getBrandOEM() in ("fulan", ) or getMachineBuild() in (
                "u41", "dags7362", "dags73625", "dags5", "ustym4kpro",
                "beyonwizv2", "viper4k", "sf8008", "sf8008m", "sf8008opt",
                "cc1", "gbmv200", "sfx6008"):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)
    # We need session.scart to access it from within menu.xml.
    session.scart = AutoScartControl(session)
    profile("InitTrashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)
    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)
    profile("Init:VolumeAdjust")
    import Screens.VolumeAdjust
    Screens.VolumeAdjust.autostart(session)
    profile("RunReactor")
    profile_final()
    if BOX_TYPE in ("sf8", "classm", "axodin", "axodinc", "starsatlx",
                    "genius", "evo"):
        f = open("/dev/dbox/oled0", "w")
        f.write("-E2-")
        f.close()
    print("[StartEnigma] Last shutdown=%s.  (True = last shutdown was OK.)" %
          config.usage.shutdownOK.value)
    print("[StartEnigma] NOK shutdown action=%s." %
          config.usage.shutdownNOK_action.value)
    print("[StartEnigma] Boot action=%s." % config.usage.boot_action.value)
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == "normal" or not config.usage.boot_action.value == "normal":
        print("[StartEnigma] Last shutdown=%s." %
              config.usage.shutdownOK.value)
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)
    if not RestoreSettings:
        config.usage.shutdownOK.setValue(False)
        config.usage.shutdownOK.save()
        configfile.save()
    # Kill showiframe if it is running.  (sh4 hack...)
    if getMachineBuild() in ("spark", "spark7162"):
        os.system("killall -9 showiframe")
    runReactor()
    print("[StartEnigma] Normal shutdown.")
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()
    profile("Wakeup")
    nowTime = time()  # Get currentTime.
    # if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == "gigablue":
    if not config.misc.SyncTimeUsing.value == "0" or BOX_TYPE.startswith(
            "gb") or getBrandOEM().startswith("ini"):
        print(
            "[StartEnigma] DVB time sync disabled, so set RTC now to current Linux time!  (%s)"
            % strftime("%Y/%m/%d %H:%M", localtime(nowTime)))
        setRTCtime(nowTime)
    # Record timer.
    if session.nav.isRecordTimerImageStandard:  # Check RecordTimer instance.
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    # Zap timer.
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    # Power timer.
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    # Plugin timer.
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]  # "pluginname | pluginfolder"
    tmp = tmp[1].lower()
    # Start in standby, depending on plugin type.
    if "epgrefresh" in tmp:
        nextPluginName = "EPGRefresh"
        nextPluginTimeInStandby = 1
    elif "vps" in tmp:
        nextPluginName = "VPS"
        nextPluginTimeInStandby = 1
    elif "serienrecorder" in tmp:
        nextPluginName = "SerienRecorder"
        nextPluginTimeInStandby = 0  # Plugin function for deep standby from standby not compatible (not available).
    elif "elektro" in tmp:
        nextPluginName = "Elektro"
        nextPluginTimeInStandby = 1
    elif "minipowersave" in tmp:
        nextPluginName = "MiniPowersave"
        nextPluginTimeInStandby = 1
    elif "enhancedpowersave" in tmp:
        nextPluginName = "EnhancedPowersave"
        nextPluginTimeInStandby = 1
    else:
        # Default for plugins.
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0
    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()
    print("=" * 100)
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        # Wakeup time before timer begins.
        wptime = startTime[0] - (config.workaround.wakeuptime.value * 60)
        if (wptime - nowTime) < 120:  # No time to switch box back on.
            wptime = int(nowTime) + 120  # So switch back on in 120 seconds.
        # Check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup.
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            # When next record starts in 15 mins.
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            # By vps-plugin.
            elif startTime[1] == 3 and nextPluginName == "VPS":
                setStandby = forceNextRecord = 1
        if startTime[1] == 3:
            nextPluginName = " (%s)" % nextPluginName
        else:
            nextPluginName = ""
        print("[StartEnigma] Set next wakeup type to '%s'%s %s" %
              ({
                  0: "record-timer",
                  1: "zap-timer",
                  2: "power-timer",
                  3: "plugin-timer"
              }[startTime[1]], nextPluginName, {
                  0: "and starts normal",
                  1: "and starts in standby"
              }[setStandby]))
        if forceNextRecord:
            print(
                "[StartEnigma] Set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag."
            )
        print("[StartEnigma] Set next wakeup time to %s." %
              strftime("%a, %Y/%m/%d %H:%M:%S", localtime(wptime)))
        # Set next wakeup.
        setFPWakeuptime(wptime)
        # Set next standby only after shutdown in deep standby.
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2  # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby.
        config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d,%d" % (
            int(nowTime), wptime, startTime[0], startTime[1], setStandby,
            nextRecordTime, forceNextRecord)
    else:
        config.misc.nextWakeup.value = "%d,-1,-1,0,0,-1,0" % (int(nowTime))
        if not BOX_TYPE.startswith(
                "azboxm"
        ):  # Skip for Azbox (mini)ME - setting wakeup time to past reboots box.
            setFPWakeuptime(
                int(nowTime) -
                3600)  # Minus one hour -> overwrite old wakeup time.
        print("[StartEnigma] No next wakeup time set.")
    config.misc.nextWakeup.save()
    print("=" * 100)
    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()
    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()
    return 0
コード例 #58
0
SystemInfo["CanNotDoSimultaneousTranscodeAndPIP"] = getBoxType() in (
    'vusolo4k', 'gbquad4k')
SystemInfo["CommonInterfaceCIDelay"] = fileCheck("/proc/stb/tsmux/rmx_delay")
SystemInfo["CanDoTranscodeAndPIP"] = getBoxType() in ('vusolo4k', 'gbquad4k')
SystemInfo["hasXcoreVFD"] = getBoxType() in (
    'osmega', 'spycat4k', 'spycat4kmini', 'spycat4kcombo') and fileCheck(
        "/sys/module/brcmstb_%s/parameters/pt6302_cgram" % getBoxType())
SystemInfo["HasHDMIin"] = getMachineBuild() in (
    'inihdp', 'hd2400', 'et10000', 'et13000', 'dm7080', 'dm820', 'dm900',
    'vuultimo4k', 'vuuno4kse') or getBoxType() in ('gbquad4k')
SystemInfo["HasHDMI-CEC"] = fileExists(
    "/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
SystemInfo["HaveTouchSensor"] = getBoxType() in ('dm520', 'dm525', 'dm900')
SystemInfo["DefaultDisplayBrightness"] = getBoxType() == 'dm900' and 8 or 5
SystemInfo["RecoveryMode"] = fileCheck("/proc/stb/fp/boot_mode")
SystemInfo["HasInfoButton"] = getBrandOEM() in ('broadmedia', 'ceryon', 'dags',
                                                'formuler', 'gfutures',
                                                'gigablue', 'ini', 'octagon',
                                                'odin', 'skylake', 'tiviar',
                                                'xcore', 'xp', 'xtrend')
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["canMultiBoot"] = getMachineBuild() in ('hd51') and (
    1, 4) or getBoxType() in ('gbue4k', 'gbquad4k') and (3, 3)
SystemInfo["canMode12"] = getMachineBuild() in ('hd51') and (
    '440M@328M brcm_cma=192M@768M', '520M@248M brcm_cma=200M@768M')
SystemInfo["supportPcmMultichannel"] = fileCheck(
    "/proc/stb/audio/multichannel_pcm")
SystemInfo["CanAACTranscode"] = fileExists(
    "/proc/stb/audio/aac_transcode_choices") and fileCheck(
        "/proc/stb/audio/aac_transcode")
SystemInfo["CanDownmixAC3"] = fileHas("/proc/stb/audio/ac3_choices", "downmix")
コード例 #59
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.skinName = "Standby"
        self.avswitch = AVSwitch()

        print "[Standby] enter standby"

        self["actions"] = ActionMap(["StandbyActions"], {
            "power": self.Power,
            "discrete_on": self.Power
        }, -1)

        globalActionMap.setEnabled(False)

        self.standbyStopServiceTimer = eTimer()
        self.standbyStopServiceTimer.callback.append(self.stopService)
        self.timeHandler = None

        #mute adc
        self.setMute()

        if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]:
            # set LCDminiTV off
            setLCDModeMinitTV("0")

        self.paused_service = None
        self.prev_running_service = None

        self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup(
        )
        service = self.prev_running_service and self.prev_running_service.toString(
        )
        if service:
            if service.startswith("1:") and service.rsplit(
                    ":", 1)[1].startswith("/"):
                self.paused_service = self.session.current_dialog
                self.paused_service.pauseService()
        if not self.paused_service:
            self.timeHandler = eDVBLocalTimeHandler.getInstance()
            if self.timeHandler.ready():
                if self.session.nav.getCurrentlyPlayingServiceOrGroup():
                    self.stopService()
                else:
                    self.standbyStopServiceTimer.startLongTimer(5)
                self.timeHandler = None
            else:
                self.timeHandler.m_timeUpdated.get().append(self.stopService)

        if self.session.pipshown:
            from Screens.InfoBar import InfoBar
            InfoBar.instance and hasattr(
                InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()

        #set input to vcr scart
        if SystemInfo["ScartSwitch"]:
            self.avswitch.setInput("SCART")
        else:
            self.avswitch.setInput("AUX")
        if (getBrandOEM() in ('fulan')):
            open("/proc/stb/hdmi/output", "w").write("off")

        if int(
                config.usage.hdd_standby_in_standby.value
        ) != -1:  # HDD standby timer value (box in standby) / -1 = same as when box is active
            for hdd in harddiskmanager.HDDList():
                hdd[1].setIdleTime(
                    int(config.usage.hdd_standby_in_standby.value))

        self.onFirstExecBegin.append(self.__onFirstExecBegin)
        self.onClose.append(self.__onClose)
コード例 #60
0
SystemInfo["CanDownmixAC3"] = fileHas("/proc/stb/audio/ac3_choices", "downmix")
SystemInfo["CanDownmixAC3Plus"] = fileHas("/proc/stb/audio/ac3plus_choices",
                                          "downmix")
SystemInfo["CanDownmixDTS"] = fileHas("/proc/stb/audio/dts_choices", "downmix")
SystemInfo["CanDownmixDTSHD"] = fileHas("/proc/stb/audio/dtshd_choices",
                                        "downmix")
SystemInfo["CanDownmixAAC"] = fileHas("/proc/stb/audio/aac_choices", "downmix")
SystemInfo["CanDownmixAACPlus"] = fileHas("/proc/stb/audio/aacplus_choices",
                                          "downmix")
SystemInfo["HDMIAudioSource"] = fileCheck("/proc/stb/hdmi/audio_source")
SystemInfo["MBbootdevice"] = getMBbootdevice()
SystemInfo["canMultiBoot"] = getMultibootslots()
SystemInfo["canMode12"] = getMachineBuild() in (
    'hd51', 'vs1500', 'h7') and ('brcm_cma=440M@328M brcm_cma=192M@768M',
                                 'brcm_cma=520M@248M brcm_cma=200M@768M')
SystemInfo["HAScmdline"] = fileCheck("/boot/cmdline.txt")
SystemInfo["HasMMC"] = fileHas(
    "/proc/cmdline",
    "root=/dev/mmcblk") or SystemInfo["canMultiBoot"] and fileHas(
        "/proc/cmdline", "root=/dev/sda")
SystemInfo["HasSDmmc"] = SystemInfo["canMultiBoot"] and "sd" in SystemInfo[
    "canMultiBoot"][2] and "mmcblk" in getMachineMtdRoot()
SystemInfo["HasSDswap"] = getMachineBuild() in (
    "h9", "i55plus") and pathExists("/dev/mmcblk0p1")
SystemInfo["CanProc"] = SystemInfo["HasMMC"] and getBrandOEM() != "vuplus"
SystemInfo["canRecovery"] = getMachineBuild() in ('gbmv200', ) and (
    'usb_update.bin', 'none')
SystemInfo["FlashOnlineBackup"] = getMachineBuild() not in ('dummy')
SystemInfo["LnbPowerAlwaysOn"] = getBoxType() in (
    'vusolo4k', 'vuduo4k', 'vuultimo4k') or getMachineBuild() in ('gb7252')