Example #1
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.session = session

		self.selection = 0
		self.list = self.list_files("/boot")
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()

		Screen.setTitle(self, _("Flash On the Fly"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = StaticText(_("STARTUP"))
			self.read_current_multiboot()
		else:
			self["key_yellow"] = StaticText("")
		self["key_green"] = StaticText(_("Online"))
		self["key_red"] = StaticText(_("Exit"))
		self["key_blue"] = StaticText(_("Local"))
		self["info-local"] = Label(_("Local = Flash an image from local path /hdd/images"))
		self["info-online"] = Label(_("Online = Download an image and flash it"))
		
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], 
		{
			"blue": self.blue,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.quit,
			"cancel": self.quit,
		}, -2)
		if SystemInfo["HaveMultiBoot"]:
			self.multi = self.read_startup("/boot/" + self.list[self.selection]).split(".",1)[1].split(" ",1)[0]
			self.multi = self.multi[-1:]
			print "[Flash Online] MULTI:",self.multi
Example #2
0
	def __init__(self, session, updatebackup=False):
		Screen.__init__(self, session)
		self.Console = Console()
		self.BackupDevice = config.imagemanager.backuplocation.value
		print "[ImageManager] Device: " + self.BackupDevice
		self.BackupDirectory = config.imagemanager.backuplocation.value + 'imagebackups/'
		print "[ImageManager] Directory: " + self.BackupDirectory
		self.BackupDate = getImageVersion() + '.' + getImageBuild() + '-' + strftime('%Y%m%d_%H%M%S', localtime())
		self.WORKDIR = self.BackupDirectory + config.imagemanager.folderprefix.value + '-temp'
		self.TMPDIR = self.BackupDirectory + config.imagemanager.folderprefix.value + '-mount'
		if updatebackup:
			self.MAINDESTROOT = self.BackupDirectory + config.imagemanager.folderprefix.value + '-SoftwareUpdate-' + self.BackupDate
		else:
			self.MAINDESTROOT = self.BackupDirectory + config.imagemanager.folderprefix.value + '-' + self.BackupDate
		self.kernelMTD = getMachineMtdKernel()
		self.kernelFILE = getMachineKernelFile()
		self.rootMTD = getMachineMtdRoot()
		self.rootFILE = getMachineRootFile()
		self.MAINDEST = self.MAINDESTROOT + '/' + getImageFolder() + '/'
		print 'MTD: Kernel:',self.kernelMTD
		print 'MTD: Root:',self.rootMTD
		if getImageFileSystem() == 'ubi':
			self.ROOTFSTYPE = 'ubifs'
		else:
			self.ROOTFSTYPE= 'jffs2'
		self.swapdevice = ""
		self.RamChecked = False
		self.SwapCreated = False
		self.Stage1Completed = False
		self.Stage2Completed = False
		self.Stage3Completed = False
		self.Stage4Completed = False
		self.Stage5Completed = False
Example #3
0
	def keyResstore4(self, result, retval, extra_args=None):
		if retval == 0:
			kernelMTD = getMachineMtdKernel()
			rootMTD = getMachineMtdRoot()
			MAINDEST = '%s/%s' % (self.TEMPDESTROOT,getImageFolder())
			CMD = '/usr/bin/ofgwrite -r%s -k%s %s/' % (rootMTD, kernelMTD, MAINDEST)
			config.imagemanager.restoreimage.setValue(self.sel)
			print '[ImageManager] running commnd:',CMD
			self.Console.ePopen(CMD)
Example #4
0
	def keyResstore3(self, result, retval, extra_args=None):
		if retval == 0:
			kernelMTD = getMachineMtdKernel()
			kernelFILE = getMachineKernelFile()
			rootMTD = getMachineMtdRoot()
			rootFILE = getMachineRootFile()
			MAINDEST = '/tmp/imagerestore/' + getImageFolder() + '/'

			config.imagemanager.restoreimage.setValue(self.sel)
			self.Console.ePopen('ofgwrite -r -k -r' + rootMTD + ' -k' + kernelMTD + ' ' + MAINDEST)
Example #5
0
	def getBlockDevInfo(self, blockdev):
		devpath = "/sys/block/" + blockdev
		error = False
		removable = False
		z = open('/proc/cmdline', 'r').read()
		BLACKLIST=[]
		if SystemInfo["HasMMC"]:
			BLACKLIST=["%s" %(getMachineMtdRoot()[0:7])]
		if SystemInfo["HasMMC"] and "root=/dev/mmcblk0p1" in z:
			BLACKLIST=["mmcblk0p1"]
		blacklisted = False
		if blockdev[:7] in BLACKLIST:
			blacklisted = True
		if blockdev.startswith("mmcblk") and (re.search(r"mmcblk\dboot", blockdev) or re.search(r"mmcblk\drpmb", blockdev)):
			blacklisted = True
		is_cdrom = False
		partitions = []
		try:
			if os.path.exists(devpath + "/removable"):
				removable = bool(int(readFile(devpath + "/removable")))
			if os.path.exists(devpath + "/dev"):
				dev = int(readFile(devpath + "/dev").split(':')[0])
			else:
				dev = None
			blacklisted = dev in [1, 7, 31, 253, 254] + (SystemInfo["HasMMC"] and [179] or []) #ram, loop, mtdblock, romblock, ramzswap, mmc
			if blockdev[0:2] == 'sr':
				is_cdrom = True
			if blockdev[0:2] == 'hd':
				try:
					media = readFile("/proc/ide/%s/media" % blockdev)
					if "cdrom" in media:
						is_cdrom = True
				except IOError:
					error = True
			# check for partitions
			if not is_cdrom and os.path.exists(devpath):
				for partition in os.listdir(devpath):
					if partition[0:len(blockdev)] != blockdev:
						continue
					if dev == 179 and not re.search(r"mmcblk\dp\d+", partition):
						continue
					partitions.append(partition)
			else:
				self.cd = blockdev
		except IOError:
			error = True
		# check for medium
		medium_found = True
		try:
			if os.path.exists("/dev/" + blockdev):
				open("/dev/" + blockdev).close()
		except IOError, err:
			if err.errno == 159: # no medium present
				medium_found = False
Example #6
0
	def run(self):
		if self.SDmmc == self.LastRun:
			self.part2 = getMachineMtdRoot()	# process mmc slot
			self.slot2 = 1
		else:
			self.part2 = "%s" %(self.part + str(self.slot * 2 + self.firstslot))
			if self.SDmmc == self.FirstRun:
				self.slot2 += 1			# allow for mmc slot"
		if self.phase == self.MOUNT:
			self.imagelist[self.slot2] = { 'imagename': _("Empty slot"), 'part': '%s' %self.part2 }
		self.container.ePopen('mount /dev/%s /tmp/testmount' %self.part2 if self.phase == self.MOUNT else 'umount /tmp/testmount', self.appClosed)
Example #7
0
	def __init__(self, Contents, callback):
		self.callback = callback
		self.container = Console()
		(self.firstslot, self.numberofslots, self.mtdboot) = SystemInfo["canMultiBoot"]
		self.slot = Contents
		if not os.path.isdir('/tmp/testmount'):
			os.mkdir('/tmp/testmount')
		if SystemInfo["HasSDmmc"]:			# allow for mmc & SDcard in passed slot number, so SDcard slot -1
			self.slot -= 1
		self.part = "%s%s" %(self.mtdboot, str(self.slot * 2 + self.firstslot))
		if SystemInfo["HasSDmmc"] and self.slot == 0:	# this is the mmc slot, so pick up from MtdRoot
			self.part = getMachineMtdRoot()
		self.phase = self.MOUNT
		self.run()
Example #8
0
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		self.list = self.list_files("/boot")
		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()
		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] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE

		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = Button(_("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"] = Button("")
			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)
Example #9
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		if getMachineBuild() in ("hd51","vs1500","h7","8100s"):
			self.devrootfs = "/dev/mmcblk0p3"
		elif getMachineBuild() in ("gb7252"):
			self.devrootfs = "/dev/mmcblk0p4"
		else:
			self.devrootfs = "/dev/mmcblk1p3"
		self.multi = 1
		self.list = self.list_files("/boot")
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()

		Screen.setTitle(self, _("Flash On the Fly"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_blue"] = Button(_("Multiboot Select"))
			self.read_current_multiboot()
		else:
			self["key_blue"] = Button(_(" "))
		self["key_green"] = Button(_("Online"))
		self["key_red"] = Button(_("Exit"))
		self["key_yellow"] = Button(_("Local"))
		self["info-local"] = Label(_("Local = Flash a image from local path /hdd/images"))
		self["info-online"] = Label(_("Online = Download a image and flash it"))

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.blue,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.quit,
			"cancel": self.quit,
		}, -2)
		if SystemInfo["HaveMultiBoot"]:
			if SystemInfo["HasRootSubdir"]:
				self.multi = self.find_rootfssubdir(self.list[self.selection])
			elif getMachineBuild() in ("gb7252"):
				self.multi = self.read_startup("/boot/" + self.list[self.selection]).split(".",1)[1].split(":",1)[0]
			else:
				self.multi = self.read_startup("/boot/" + self.list[self.selection]).split(".",1)[1].split(" ",1)[0]
			self.multi = self.multi[-1:]
			print "[Flash Online] MULTI:",self.multi
Example #10
0
	def run(self):
		if SystemInfo["HasRootSubdir"]:
			if self.slot == 1 and os.path.islink("/dev/block/by-name/linuxrootfs"):
				self.part2 = os.readlink("/dev/block/by-name/linuxrootfs")[5:]
				self.container.ePopen('mount /dev/block/by-name/linuxrootfs /tmp/testmount' if self.phase == self.MOUNT else 'umount /tmp/testmount', self.appClosed)
			else:
				self.part2 = os.readlink("/dev/block/by-name/userdata")[5:]
				self.container.ePopen('mount /dev/block/by-name/userdata /tmp/testmount' if self.phase == self.MOUNT else 'umount /tmp/testmount', self.appClosed)
			if self.phase == self.MOUNT:
				self.imagelist[self.slot2] = { 'imagename': _("Empty slot"), 'part': '%s' %self.part2 }
		else:
			if self.SDmmc == self.LastRun:
				self.part2 = getMachineMtdRoot()	# process mmc slot
				self.slot2 = 1
			else:
				self.part2 = "%s" %(self.part + str(self.slot * 2 + self.firstslot))
				if self.SDmmc == self.FirstRun:
					self.slot2 += 1			# allow for mmc slot"
			if self.phase == self.MOUNT:
				self.imagelist[self.slot2] = { 'imagename': _("Empty slot"), 'part': '%s' %self.part2 }
			self.container.ePopen('mount /dev/%s /tmp/testmount' %self.part2 if self.phase == self.MOUNT else 'umount /tmp/testmount', self.appClosed)
Example #11
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		self.skinName = "MultiBoot"
		screentitle = _("Multiboot Image Restart")
		self["key_red"] = StaticText(_("Cancel"))
		if not SystemInfo["HasSDmmc"] or SystemInfo["HasSDmmc"] and pathExists('/dev/%s4' %(SystemInfo["canMultiBoot"][2])):
			self["labe14"] = StaticText(_("Use the cursor keys to select an installed image and then Reboot button."))
		else:
			self["labe14"] = StaticText(_("SDcard is not initialised for multiboot - Exit and use ViX MultiBoot Manager to initialise"))			
		self["labe15"] = StaticText(_(" "))
		self["key_green"] = StaticText(_("Reboot"))
		if SystemInfo["canMode12"]:
			self["labe15"] = StaticText(_("Mode 1 suppports Kodi, PiP may not work.\nMode 12 supports PiP, Kodi may not work."))
		self["config"] = ChoiceList(list=[ChoiceEntryComponent('',((_("Retrieving image slots - Please wait...")), "Queued"))])
		imagedict = []
		self.mtdboot = "%s1" % SystemInfo["canMultiBoot"][2]
 		if SystemInfo["canMultiBoot"][2] == "sda":
			self.mtdboot = "%s3" %getMachineMtdRoot()[0:8]
		self.getImageList = None
		self.title = screentitle
		if not SystemInfo["HasSDmmc"] or SystemInfo["HasSDmmc"] and pathExists('/dev/%s4' %(SystemInfo["canMultiBoot"][2])):
			self.startit()

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "KeyboardInputActions", "MenuActions"],
		{
			"red": boundFunction(self.close, None),
			"green": self.reboot,
			"ok": self.reboot,
			"cancel": boundFunction(self.close, None),
			"up": self.keyUp,
			"down": self.keyDown,
			"left": self.keyLeft,
			"right": self.keyRight,
			"upRepeated": self.keyUp,
			"downRepeated": self.keyDown,
			"leftRepeated": self.keyLeft,
			"rightRepeated": self.keyRight,
			"menu": boundFunction(self.close, True),
		}, -1)
		self.onLayoutFinish.append(self.layoutFinished)
Example #12
0
def GetCurrentRoot():
	if SystemInfo["HasRootSubdir"]:
		return SystemInfo["HasRootSubdir"] and (int(open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read()[:-1].split("root=/dev/mmcblk0p")[1].split(' ')[0]))
	return getMachineMtdRoot()
Example #13
0
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', 'dinobot', 'edision', 'formuler', 'gfutures', 'gigablue', 'ini', 'maxytec', 'octagon', 'odin', 'skylake', 'tiviar', 'xcore', 'xp', 'xtrend')
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["HasRootSubdir"] = fileHas("/proc/cmdline", "rootsubdir=")
SystemInfo["RecoveryMode"] = SystemInfo["HasRootSubdir"] and getMachineBuild() not in ('hd51','h7') or fileCheck("/proc/stb/fp/boot_mode")
SystemInfo["AndroidMode"] = SystemInfo["RecoveryMode"] and getMachineBuild() in ('multibox',)
SystemInfo["canMultiBoot"] = getMachineBuild() in ('hd51', 'h7', 'h9combo', 'multibox') and (1, 4, 'mmcblk0p') or getBoxType() in ('gbue4k', 'gbquad4k') and (3, 3, 'mmcblk0p') or getMachineBuild() in ('viper4k', 'gbmv200', 'sf8008', 'beyonwizv2') and fileCheck("/dev/sda") and (0, 2, 'sda') or getMachineBuild() in ('osmio4k', 'osmio4kplus') and (1, 4, 'mmcblk1p')
SystemInfo["canBackupEMC"] = getMachineBuild() in ('hd51','h7') and ('disk.img', 'mmcblk0p1') or getMachineBuild() in ('osmio4k', 'osmio4kplus') and ('emmc.img', 'mmcblk1p1') or getMachineBuild() in ('viper4k', 'gbmv200','sf8008','beyonwizv2') and ('usb_update.bin','none')
SystemInfo["HasHiSi"] = pathExists('/proc/hisi')
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 SystemInfo["canMultiBoot"] and fileHas("/proc/cmdline", "root=/dev/sda")
SystemInfo["HasSDmmc"] = SystemInfo["canMultiBoot"] and "sd" in SystemInfo["canMultiBoot"][2] and "mmcblk" in getMachineMtdRoot() 
SystemInfo["HasH9SD"] = getMachineBuild() in ("h9", "i55plus") and pathExists("/dev/mmcblk0p1")
SystemInfo["HasSDnomount"] = getMachineBuild() in ('h9', 'i55plus') and ('No', 'none') or getMachineBuild() in ('multibox', 'h9combo') and ('Yes', '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")
SystemInfo["supportPcmMultichannel"] = fileCheck("/proc/stb/audio/multichannel_pcm")
SystemInfo["CanDownmixAC3"] = fileHas("/proc/stb/audio/ac3_choices", "downmix")
SystemInfo["CanAC3Transcode"] = fileHas("/proc/stb/audio/ac3plus_choices", "force_ac3")
SystemInfo["CanDownmixDTS"] = fileHas("/proc/stb/audio/dts_choices", "downmix")
SystemInfo["CanDTSHD"] = 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["CanAACTranscode"] = fileHas("/proc/stb/audio/aac_transcode_choices", "off")
Example #14
0
from Screens.Console import Console
from Screens.HelpMenu import HelpableScreen
from Screens.TaskView import JobView
from Tools.Downloader import downloadWithProgress
from enigma import fbClass
import urllib2
import os
import shutil
import math
from boxbranding import getBoxType,  getImageDistro, getMachineName, getMachineBrand, getImageVersion, getMachineKernelFile, getMachineRootFile, getMachineBuild, getMachineMtdKernel, getMachineMtdRoot
distro =  getImageDistro()
ImageVersion = getImageVersion()
ROOTFSBIN = getMachineRootFile()
KERNELBIN = getMachineKernelFile()
MTDKERNEL = getMachineMtdKernel()
MTDROOTFS = getMachineMtdRoot()

#############################################################################################################
image = 0 # 0=OpenPlus / 1=openMips
if distro.lower() == "openmips":
	image = 1
elif distro.lower() == "openplus":
	image = 0
feedurl_atv = 'http://feeds.open-plus.es/openplus/%s' %ImageVersion

if ImageVersion == '2.1':
	ImageVersion2= '2.3'
else:
	ImageVersion2= '2.0'
feedurl_atv2= 'http://feeds.open-plus.es/openplus/%s' %ImageVersion2
feedurl_om = 'http://image.openmips.com/5.3'
Example #15
0
SystemInfo["XcoreVFD"] = getMachineBuild() in ("xc7346", "xc7439")
SystemInfo["HDMIin"] = getMachineBuild() in (
    "inihdp", "hd2400", "et10000", "dm7080", "dm820", "dm900", "dm920",
    "vuultimo4k", "et13000", "sf5008", "vuuno4kse", "vuduo4k",
    "vuduo4kse") or model in ("spycat4k", "spycat4kcombo", "gbquad4k")
SystemInfo["HAVEEDIDDECODE"] = fileCheck(
    "/proc/stb/hdmi/raw_edid") and fileCheck("/usr/bin/edid-decode")
SystemInfo["HaveRCA"] = getHaveRCA() == "True"
SystemInfo["HaveDVI"] = getHaveDVI() == "True"
SystemInfo["HaveAVJACK"] = getHaveAVJACK() == "True"
SystemInfo["HAVESCART"] = getHaveSCART() == "True"
SystemInfo["HAVESCARTYUV"] = getHaveSCARTYUV() == "True"
SystemInfo["HAVEYUV"] = getHaveYUV() == "True"
SystemInfo["HAVEHDMI"] = getHaveHDMI() == "True"
SystemInfo["HasMMC"] = fileHas(
    "/proc/cmdline", "root=/dev/mmcblk") or "mmcblk" in getMachineMtdRoot()
SystemInfo["CanProc"] = SystemInfo["HasMMC"] and getBrandOEM() != "vuplus"
SystemInfo["HasHiSi"] = pathExists("/proc/hisi")
SystemInfo["canMultiBoot"] = MultiBoot.getBootSlots()
SystemInfo["RecoveryMode"] = fileCheck(
    "/proc/stb/fp/boot_mode") or MultiBoot.hasRecovery()
SystemInfo["HasMMC"] = fileHas(
    "/proc/cmdline",
    "root=/dev/mmcblk") or MultiBoot.canMultiBoot() and fileHas(
        "/proc/cmdline", "root=/dev/sda")
SystemInfo["HasSDmmc"] = MultiBoot.canMultiBoot(
) and "sd" in MultiBoot.getBootSlots()["2"] and "mmcblk" in getMachineMtdRoot(
)
SystemInfo["HasSDswap"] = getMachineBuild() in (
    "h9", "i55plus") and pathExists("/dev/mmcblk0p1")
SystemInfo["HasFullHDSkinSupport"] = model not in ("et4000", "et5000", "sh1",
Example #16
0
SystemInfo["ForceToneBurstChanged"] = fileCheck("/proc/stb/frontend/fbc/force_toneburst")
SystemInfo["USETunersetup"] = SystemInfo["ForceLNBPowerChanged"] or SystemInfo["ForceToneBurstChanged"]
SystemInfo["HDMIin"] = getMachineBuild() in ("inihdp", "hd2400", "et10000", "dm7080", "dm820", "dm900", "dm920", "vuultimo4k", "et13000", "sf5008", "vuuno4kse", "vuduo4k") or getBoxType() in ("spycat4k", "spycat4kcombo", "gbquad4k")
SystemInfo["HaveRCA"] = getHaveRCA() == "True"
SystemInfo["HaveDVI"] = getHaveDVI() == "True"
SystemInfo["HaveAVJACK"] = getHaveAVJACK() == "True"
SystemInfo["HAVESCART"] = getHaveSCART() == "True"
SystemInfo["HAVESCARTYUV"] = getHaveSCARTYUV() == "True"
SystemInfo["HAVEYUV"] = getHaveYUV() == "True"
SystemInfo["HAVEHDMI"] = getHaveHDMI() == "True"
SystemInfo["MBbootdevice"] = getMBbootdevice()
SystemInfo["canMultiBoot"] = getMultibootslots()
SystemInfo["canMode12"] = getMachineBuild() in ('hd51', 'vs1500', 'h7') and ('brcm_cma=440M@328M brcm_cma=192M@768M', 'brcm_cma=520M@248M brcm_cma=200M@768M')
SystemInfo["HAScmdline"] = fileCheck("/boot/cmdline.txt")
SystemInfo["HasHiSi"] = pathExists("/proc/hisi")
SystemInfo["HasMMC"] = fileHas("/proc/cmdline", "root=/dev/mmcblk") or "mmcblk" in getMachineMtdRoot()
SystemInfo["HasSDmmc"] = SystemInfo["canMultiBoot"] and "sd" in SystemInfo["canMultiBoot"][2] and "mmcblk" in getMachineMtdRoot() 
SystemInfo["HasSDswap"] = getMachineBuild() in ("h9", "i55plus") and pathExists("/dev/mmcblk0p1")
SystemInfo["CanProc"] = SystemInfo["HasMMC"] and getBrandOEM() != "vuplus"
SystemInfo["canRecovery"] = getMachineBuild() in ('hd51', 'vs1500', 'h7', '8100s') and ('disk.img', 'mmcblk0p1') or getMachineBuild() in ('xc7439', 'osmio4k', 'osmio4kplus', 'osmini4k') and ('emmc.img', 'mmcblk1p1') or getMachineBuild() in ('gbmv200', 'cc1', 'sf8008', 'sf8008m', 'ustym4kpro', 'beyonwizv2', 'viper4k') and ('usb_update.bin', 'none')
SystemInfo["VfdDisplay"] = getBoxType() not in ('anadol4k', 'dinobot4kl', 'dinobot4k', 'dinobot4kse', 'vuultimo', 'xpeedlx3', 'et10000', 'mutant2400', 'quadbox2400', 'atemionemesis') and fileExists("/dev/dbox/oled0")
SystemInfo["LEDButtons"] = getBoxType() == 'vuultimo'
SystemInfo["loadcidriver"] = getBoxType() == 'formuler1'
SystemInfo["loadci3driver"] = getBoxType() == 'formuler3'
SystemInfo["loadci4driver"] = getBoxType() == 'formuler4'
SystemInfo["VFD_scroll_repeats"] = fileCheck("/proc/stb/lcd/scroll_repeats")
SystemInfo["VFD_scroll_delay"] = fileCheck("/proc/stb/lcd/scroll_delay")
SystemInfo["VFD_initial_scroll_delay"] = fileCheck("/proc/stb/lcd/initial_scroll_delay")
SystemInfo["VFD_final_scroll_delay"] = fileCheck("/proc/stb/lcd/final_scroll_delay")
SystemInfo["LCDMiniTV4k"] = fileExists("/proc/stb/lcd/live_enable") and getBoxType() in ('vusolo4k', 'e4hdultra')
SystemInfo["LcdLiveTVPiP"] = fileCheck("/proc/stb/lcd/live_decoder")
Example #17
0
def GetCurrentRoot():
	if SystemInfo["HasRootSubdir"]:
		return SystemInfo["HasRootSubdir"] and (int(open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read()[:-1].split("root=/dev/mmcblk0p")[1].split(' ')[0]))
	return getMachineMtdRoot()
Example #18
0
import boxbranding
print "getMachineBuild=%s" %boxbranding.getMachineBuild()
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 "getImageDistro=%s" %boxbranding.getImageDistro()
print "getImageFolder=%s" %boxbranding.getImageFolder()
print "getImageFileSystem=%s" %boxbranding.getImageFileSystem()
Example #19
0
class AVSwitch:

    has_rca = getHaveRCA() in ('True', )
    has_dvi = getHaveDVI() in ('True', )
    has_jack = getHaveAVJACK() in ('True', )
    has_scart = getHaveSCART() in ('True', )

    print "SystemInfo", "MachineBuild", getMachineBuild()
    print "SystemInfo", "BoxType", getBoxType()
    print "SystemInfo", "BrandOEM", getBrandOEM()
    print "SystemInfo", "DisplayType", getDisplayType()
    print "SystemInfo", "HaveRCA", getHaveRCA()
    print "SystemInfo", "getHaveDVI", getHaveDVI()
    print "SystemInfo", "HaveYUV", getHaveYUV()
    print "SystemInfo", "HaveSCART", getHaveSCART()
    print "SystemInfo", "HaveAVJACK", getHaveAVJACK()
    print "SystemInfo", "HaveSCARTYUV", getHaveSCARTYUV()
    print "SystemInfo", "HaveHDMI", getHaveHDMI()
    print "SystemInfo", "MachineMtdRoot", getMachineMtdRoot()
    print "VideoWizard", "has_dvi", has_dvi
    print "VideoWizard", "has_rca", has_rca
    print "VideoWizard", "has_jack", has_jack
    print "VideoWizard", "has_scart", has_scart
    print "AVSwitch", "Scart-YPbPr", SystemInfo["Scart-YPbPr"]
    print "AVSwitch", "no_YPbPr", SystemInfo["no_YPbPr"]
    print "AVSwitch", "yellow_RCA_no_scart", SystemInfo["yellow_RCA_no_scart"]
    print "AVSwitch", "no_yellow_RCA__no_scart", SystemInfo[
        "no_yellow_RCA__no_scart"]

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

    rates["PAL"] = {
        "50Hz": {
            50: "pal"
        },
        "60Hz": {
            60: "pal60"
        },
        "multi": {
            50: "pal",
            60: "pal60"
        }
    }

    rates["NTSC"] = {"60Hz": {60: "ntsc"}}

    rates["Multi"] = {"multi": {50: "pal", 60: "ntsc"}}

    rates["480i"] = {"60Hz": {60: "480i"}}

    rates["576i"] = {"50Hz": {50: "576i"}}

    rates["480p"] = {"60Hz": {60: "480p"}}

    rates["576p"] = {"50Hz": {50: "576p"}}

    rates["720p"] = {
        "50Hz": {
            50: "720p50"
        },
        "60Hz": {
            60: "720p"
        },
        "multi": {
            50: "720p50",
            60: "720p"
        }
    }

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

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

    rates["2160p"] = {
        "50Hz": {
            50: "2160p50"
        },
        "60Hz": {
            60: "2160p"
        },
        "multi": {
            50: "2160p50",
            60: "2160p"
        }
    }

    rates["2160p30"] = {"multi": {50: "2160p25", 60: "2160p30"}}

    rates["PC"] = {
        "1024x768": {
            60: "1024x768"
        },  # not possible on DM7025
        "800x600": {
            60: "800x600"
        },  # also not possible
        "720x480": {
            60: "720x480"
        },
        "720x576": {
            60: "720x576"
        },
        "1280x720": {
            60: "1280x720"
        },
        "1280x720 multi": {
            50: "1280x720_50",
            60: "1280x720"
        },
        "1920x1080": {
            60: "1920x1080"
        },
        "1920x1080 multi": {
            50: "1920x1080",
            60: "1920x1080_50"
        },
        "1280x1024": {
            60: "1280x1024"
        },
        "1366x768": {
            60: "1366x768"
        },
        "1366x768 multi": {
            50: "1366x768",
            60: "1366x768_50"
        },
        "1280x768": {
            60: "1280x768"
        },
        "640x480": {
            60: "640x480"
        }
    }

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

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

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

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

    # if "DVI-PC" in modes and not getModeList("DVI-PC"):
    # 	print "[VideoHardware] remove DVI-PC because of not existing modes"
    # 	del modes["DVI-PC"]

    if "YPbPr" in modes and SystemInfo["no_YPbPr"]:
        del modes["YPbPr"]

    if "Scart" in modes and SystemInfo["yellow_RCA_no_scart"]:
        modes["RCA"] = modes["Scart"]
        del modes["Scart"]

    if "Scart" in modes and SystemInfo["no_yellow_RCA__no_scart"]:
        del modes["Scart"]

    def __init__(self):
        self.last_modes_preferred = []
        self.on_hotplug = CList()
        self.current_mode = None
        self.current_port = None

        self.readAvailableModes()

        self.createConfig()
        self.readPreferredModes()

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

    def readPreferredModes(self):
        try:
            f = open("/proc/stb/video/videomode_preferred")
            modes = f.read()[:-1]
            f.close()
            self.modes_preferred = modes.split(' ')
        except IOError:
            print "[VideoHardware] reading preferred modes failed, using all modes"
            self.modes_preferred = self.readAvailableModes()

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

    # check if a high-level mode with a given rate is available.
    def isModeAvailable(self, port, mode, rate):
        rate = self.rates[mode][rate]
        for mode in rate.values():
            if mode not in self.readAvailableModes():
                return False
        return True

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

    def setMode(self, port, mode, rate, force=None):
        print "[VideoHardware] setMode - port: %s, mode: %s, rate: %s" % (
            port, mode, rate)

        # config.av.videoport.setValue(port)
        # we can ignore "port"
        self.current_mode = mode
        self.current_port = port
        modes = self.rates[mode][rate]

        mode_50 = modes.get(50)
        mode_60 = modes.get(60)
        if mode_50 is None or force == 60:
            mode_50 = mode_60
        if mode_60 is None or force == 50:
            mode_60 = mode_50

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

    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
Example #20
0
from Screens.TaskView import JobView
from Tools.Downloader import downloadWithProgress
from enigma import fbClass
import urllib
from urllib2 import Request, urlopen, URLError, HTTPError
import urllib2
import os
import shutil
import math
from boxbranding import getBoxType, getImageDistro, getMachineName, getMachineBrand, getImageVersion, getMachineKernelFile, getMachineRootFile, getMachineBuild, getMachineMtdKernel, getMachineMtdRoot
distro = getImageDistro()
ImageVersion = getImageVersion()
ROOTFSBIN = getMachineRootFile()
KERNELBIN = getMachineKernelFile()
MTDKERNEL = getMachineMtdKernel()
MTDROOTFS = getMachineMtdRoot()


##### edit lululla
from Components.config import config, getConfigListEntry, ConfigText, ConfigInteger, ConfigSelection, ConfigSubsection, ConfigYesNo
from Components.ConfigList import ConfigListScreen

def mount_flsh():
    mnt_flsh = []
    if os.path.isfile('/proc/mounts'):
        for line in open('/proc/mounts'):
            if '/dev/sd' in line or '/dev/disk/by-uuid/' in line or '/dev/mmc' in line or '/dev/mtdblock' in line:
                drive = line.split()[1].replace('\\040', ' ') #+ '/'
                if not drive in mnt_flsh: 
                      mnt_flsh.append(drive)
    # mnt_flsh.append('/media/hdd')
    def getBlockDevInfo(self, blockdev):
        devpath = "/sys/block/" + blockdev
        error = False
        removable = False
        BLACKLIST = []
        if SystemInfo["HasMMC"]:
            BLACKLIST = ["%s" % (getMachineMtdRoot()[0:7])]
        if SystemInfo["HasMMC"] and "root=/dev/mmcblk0p1" in open(
                '/proc/cmdline', 'r').read():
            BLACKLIST = ["mmcblk0p1"]
        blacklisted = False
        if blockdev[:7] in BLACKLIST:
            blacklisted = True
        if blockdev.startswith("mmcblk") and (
                re.search(r"mmcblk\dboot", blockdev)
                or re.search(r"mmcblk\drpmb", blockdev)):
            blacklisted = True
        is_cdrom = False
        is_mmc = False
        partitions = []
        try:
            if os.path.exists(devpath + "/removable"):
                removable = bool(int(readFile(devpath + "/removable")))
            if os.path.exists(devpath + "/dev"):
                dev = readFile(devpath + "/dev")
                subdev = False if int(dev.split(':')[1]) % 32 == 0 else True
                dev = int(dev.split(':')[0])
            else:
                dev = None
                subdev = False
            # blacklist ram, loop, mtdblock, romblock, ramzswap
            blacklisted = dev in [1, 7, 31, 253, 254]
            # blacklist non-root eMMC devices
            if not blacklisted and dev == 179:
                is_mmc = True
                if (SystemInfo['BootDevice'] and blockdev.startswith(
                        SystemInfo['BootDevice'])) or subdev:
                    blacklisted = True
            if blockdev[0:2] == 'sr':
                is_cdrom = True
            if blockdev[0:2] == 'hd':
                try:
                    if "cdrom" in readFile("/proc/ide/%s/media" % blockdev):
                        is_cdrom = True
                except IOError:
                    error = True
            # check for partitions
            if not is_cdrom and not is_mmc and os.path.exists(devpath):
                for partition in os.listdir(devpath):
                    if partition[0:len(blockdev)] != blockdev:
                        continue
                    if dev == 179 and not re.search(r"mmcblk\dp\d+",
                                                    partition):
                        continue
                    partitions.append(partition)
            else:
                self.cd = blockdev
        except IOError:
            error = True
        # check for medium
        medium_found = True
        try:
            if os.path.exists("/dev/" + blockdev):
                open("/dev/" + blockdev).close()
        except IOError as err:
            if err.errno == 159:  # no medium present
                medium_found = False

        return error, blacklisted, removable, is_cdrom, partitions, medium_found
Example #22
0
SystemInfo["AndroidMode"] = SystemInfo["RecoveryMode"] and getMachineBuild(
) in ("multibox", )
SystemInfo["MBbootdevice"] = getMBbootdevice()
SystemInfo["canMultiBoot"] = getMultibootslots()
SystemInfo["HasHiSi"] = pathExists("/proc/hisi") and getBoxType() not in (
    "viper4kv20", )
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", "h9se", "i55plus", "i55se") and pathExists("/dev/mmcblk0p1")
SystemInfo["HasSDnomount"] = getMachineBuild() in (
    "h9", "h9se", "i55plus", "i55se") and (False, "none") or getMachineBuild(
    ) in ("multibox", "h9combo", "h9combose", "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")
SystemInfo["supportPcmMultichannel"] = fileCheck(
    "/proc/stb/audio/multichannel_pcm")
SystemInfo["CanDownmixAC3"] = fileHas("/proc/stb/audio/ac3_choices", "downmix")
Example #23
0
	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.HDFIMAGEVERSION = getImageVersion()
		self.HDFIMAGEBUILD = getImageBuild()
		self.HDFIMAGENAME = getImageDistro()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem().strip()

		if self.MACHINEBUILD in ("hd51","vs1500","h7","8100s"):
			self.MTDBOOT = "mmcblk0p1"
			self.EMMCIMG = "disk.img"
		elif self.MACHINEBUILD in ("xc7439","osmio4k"):
			self.MTDBOOT = "mmcblk1p1"
			self.EMMCIMG = "emmc.img"
		elif self.MACHINEBUILD in ("cc1","sf8008","ustym4kpr"):
			self.MTDBOOT = "none"
			self.EMMCIMG = "usb_update.bin"
		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] ROOTFSBIN = >%s<" %self.ROOTFSBIN
		print "[FULL BACKUP] KERNELBIN = >%s<" %self.KERNELBIN
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] EMMCIMG = >%s<" %self.EMMCIMG
		if isDreamboxXZ:
			self.IMAGEFOLDER = self.MODEL
# fix me to xz
			self.ROOTFSTYPE = "tar.gz"
			self.ROOTFSBIN = "root.tar.gz"

		self.error_files = ''
		self.list = self.list_files("/boot")
		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = Button(_("Select Multiboot"))
			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."))
			self.read_current_multiboot()
		else:
			self["key_yellow"] = Button("")
			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)
		self.onShown.append(self.show_Errors)
Example #24
0
SystemInfo["XcoreVFD"] = getMachineBuild() in ("xc7346", "xc7439")
SystemInfo["HDMIin"] = getMachineBuild() in (
    "inihdp", "hd2400", "et10000", "dm7080", "dm820", "dm900", "dm920",
    "vuultimo4k", "et13000", "sf5008", "vuuno4kse", "vuduo4k",
    "vuduo4kse") or getBoxType() in ("spycat4k", "spycat4kcombo", "gbquad4k")
SystemInfo["HAVEEDIDDECODE"] = fileCheck(
    "/proc/stb/hdmi/raw_edid") and fileCheck("/usr/bin/edid-decode")
SystemInfo["HaveRCA"] = getHaveRCA() == "True"
SystemInfo["HaveDVI"] = getHaveDVI() == "True"
SystemInfo["HaveAVJACK"] = getHaveAVJACK() == "True"
SystemInfo["HAVESCART"] = getHaveSCART() == "True"
SystemInfo["HAVESCARTYUV"] = getHaveSCARTYUV() == "True"
SystemInfo["HAVEYUV"] = getHaveYUV() == "True"
SystemInfo["HAVEHDMI"] = getHaveHDMI() == "True"
SystemInfo["HasMMC"] = fileHas(
    "/proc/cmdline", "root=/dev/mmcblk") or "mmcblk" in getMachineMtdRoot()
SystemInfo["CanProc"] = SystemInfo["HasMMC"] and getBrandOEM() != "vuplus"
SystemInfo["HasHiSi"] = pathExists("/proc/hisi")
SystemInfo["MBbootdevice"] = getMBbootdevice()
SystemInfo["canMultiBoot"] = getMultibootslots()
SystemInfo["canDualBoot"] = fileExists("/dev/block/by-name/flag")
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()
 def getBlockDevInfo(self, blockdev):
     devpath = "/sys/block/" + blockdev
     error = False
     removable = False
     z = open('/proc/cmdline', 'r').read()
     BLACKLIST = []
     if SystemInfo["HasMMC"]:
         BLACKLIST = ["%s" % (getMachineMtdRoot()[0:7])]
     if SystemInfo["HasMMC"] and "root=/dev/mmcblk0p1" in z:
         BLACKLIST = ["mmcblk0p1"]
     blacklisted = False
     if blockdev[:7] in BLACKLIST:
         blacklisted = True
     if blockdev.startswith("mmcblk") and (
             re.search(r"mmcblk\dboot", blockdev)
             or re.search(r"mmcblk\drpmb", blockdev)):
         blacklisted = True
     is_cdrom = False
     partitions = []
     try:
         if os.path.exists(devpath + "/removable"):
             removable = bool(int(readFile(devpath + "/removable")))
         if os.path.exists(devpath + "/dev"):
             dev = int(readFile(devpath + "/dev").split(':')[0])
         else:
             dev = None
         blacklisted = dev in [1, 7, 31, 253, 254] + (
             SystemInfo["HasMMC"] and [179] or []
         )  #ram, loop, mtdblock, romblock, ramzswap, mmc
         if blockdev == "mmcblk1" and "mmcblk1" not in BLACKLIST:
             blacklisted = False
         if blockdev[0:2] == 'sr':
             is_cdrom = True
         if blockdev[0:2] == 'hd':
             try:
                 media = readFile("/proc/ide/%s/media" % blockdev)
                 if "cdrom" in media:
                     is_cdrom = True
             except IOError:
                 error = True
         # check for partitions
         if not is_cdrom and os.path.exists(devpath):
             for partition in os.listdir(devpath):
                 if partition[0:len(blockdev)] != blockdev:
                     continue
                 if dev == 179 and not re.search(r"mmcblk\dp\d+",
                                                 partition):
                     continue
                 partitions.append(partition)
         else:
             self.cd = blockdev
     except IOError:
         error = True
     # check for medium
     medium_found = True
     try:
         if os.path.exists("/dev/" + blockdev):
             open("/dev/" + blockdev).close()
     except IOError, err:
         if err.errno == 159:  # no medium present
             medium_found = False
Example #26
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import boxbranding
print("getOEVersion=%s<" %boxbranding.getOEVersion())
print("getImageDistro=%s<" %boxbranding.getImageDistro())
print("getBoxType=%s<" %boxbranding.getBoxType())
print("getBrandOEM=%s<" %boxbranding.getBrandOEM())
print("getMachineBrand=%s<" %boxbranding.getMachineBrand())
print("getMachineName=%s<" %boxbranding.getMachineName())
print("getMachineBuild=%s<" %boxbranding.getMachineBuild())
print("getMachineMake=%s<" %boxbranding.getMachineMake())
print("getImageVersion=%s<" %boxbranding.getImageVersion())
print("getImageBuild=%s<" %boxbranding.getImageBuild())
print("getImageDevBuild=%s<" %boxbranding.getImageDevBuild())
print("getImageType=%s<" %boxbranding.getImageType())
print("getFeedsUrl=%s<" %boxbranding.getFeedsUrl())
print("getImageFolder=%s<" %boxbranding.getImageFolder())
print("getImageFileSystem=%s<" %boxbranding.getImageFileSystem())
print("getMachineMtdBoot=%s<" %boxbranding.getMachineMtdBoot())
print("getMachineMtdRoot=%s<" %boxbranding.getMachineMtdRoot())
print("getMachineMtdKernel=%s<" %boxbranding.getMachineMtdKernel())
print("getMachineRootFile=%s<" %boxbranding.getMachineRootFile())
print("getMachineKernelFile=%s<" %boxbranding.getMachineKernelFile())
print("getMachineMKUBIFS=%s<" %boxbranding.getMachineMKUBIFS())
print("getMachineUBINIZE=%s<" %boxbranding.getMachineUBINIZE())
print("getImageArch=%s<" %boxbranding.getImageArch())
print("getHaveTranscoding=%s<" %boxbranding.getHaveTranscoding())
print("getHaveMultiTranscoding=%s<" %boxbranding.getHaveMultiTranscoding())
print("getMachineProcModel=%s<" %boxbranding.getMachineProcModel())
Example #27
0
    def doFullBackup(self, answer):
        if answer is not None:
            if answer[1]:
                self.RECOVERY = answer[3]
                self.DIRECTORY = "%s/fullbackup" % answer[2]
                if not os.path.exists(self.DIRECTORY):
                    try:
                        os.makedirs(self.DIRECTORY)
                    except:
                        self.session.open(MessageBox,
                                          _("Can't 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 'rootsubdir' in SystemInfo["canMultiBoot"][self.SLOT]:
                        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 = _("Full back-up 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["canMultiBoot"]:
                    if 'rootsubdir' in SystemInfo["canMultiBoot"][self.SLOT]:
                        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 'rootsubdir' in SystemInfo["canMultiBoot"][self.SLOT]:
                        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.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('cp -f /usr/share/bootargs.bin %s/baseparam.img' %(self.WORKDIR))
                    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 == "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'
                    )
                    if self.MACHINENAME in ("sf8008m"):
                        f.write(
                            '<Part Sel="1" PartitionName="userdata" FlashType="emmc" FileSystem="ext3/4" Start="130M" Length="3580M" SelectFile="rootfs.ext4"/>\n'
                        )
                    else:
                        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()
Example #28
0
SystemInfo["HaveMultiBootDS"] = fileCheck("/boot/STARTUP") and getMachineBuild(
) in ('cc1', 'sf8008', 'sf8008s', 'sf8008t',
      'ustym4kpro') and fileCheck("/dev/sda")
SystemInfo["canMultiBoot"] = getMachineBuild() in (
    'hd51', 'vs1500', 'h7', 'h9combo', 'hd60', 'hd61', 'multibox',
    '8100s') and (1, 4, 'mmcblk0p') or getMachineBuild() in ('gb7252') and (
        3, 3, 'mmcblk0p') or getMachineBuild() in (
            'gbmv200', 'cc1', 'sf8008', 'ustym4kpro', 'beyonwizv2', 'viper4k'
        ) and fileCheck("/dev/sda") and (0, 3, 'sda') or getMachineBuild() in (
            'osmio4k', 'osmio4kplus', 'xc7439') and (1, 4, 'mmcblk1p')
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 (
    'hd51', 'vs1500', 'h7',
    '8100s') and ('disk.img', 'mmcblk0p1') or getMachineBuild() in (
        'xc7439', 'osmio4k',
        'osmio4kplus') and ('emmc.img', 'mmcblk1p1') or getMachineBuild() in (
            'gbmv200', 'cc1', 'sf8008', 'ustym4kpro', 'beyonwizv2',
            'viper4k') and ('usb_update.bin', 'none')
Example #29
0
    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.HDFIMAGEVERSION = getImageVersion()
        self.HDFIMAGEBUILD = getImageBuild()
        self.UBINIZE_ARGS = getMachineUBINIZE()
        self.MKUBIFS_ARGS = getMachineMKUBIFS()
        self.MTDKERNEL = getMachineMtdKernel()
        self.MTDROOTFS = getMachineMtdRoot()
        self.ROOTFSBIN = getMachineRootFile()
        self.KERNELBIN = getMachineKernelFile()
        self.ROOTFSTYPE = getImageFileSystem().strip()

        if self.MACHINEBUILD in ("hd51", "vs1500", "h7", "ceryon7252"):
            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] ROOTFSBIN = >%s<" % self.ROOTFSBIN
        print "[FULL BACKUP] KERNELBIN = >%s<" % self.KERNELBIN
        print "[FULL BACKUP] ROOTFSTYPE = >%s<" % self.ROOTFSTYPE
        print "[FULL BACKUP] EMMCIMG = >%s<" % self.EMMCIMG
        if isDreamboxXZ:
            self.IMAGEFOLDER = self.MODEL
            # fix me to xz
            self.ROOTFSTYPE = "tar.gz"
            self.ROOTFSBIN = "root.tar.gz"

        self.error_files = ''
        self.list = self.list_files("/boot")
        self["key_green"] = Button("USB")
        self["key_red"] = Button("HDD")
        self["key_blue"] = Button(_("Exit"))
        if SystemInfo["HaveMultiBoot"]:
            self["key_yellow"] = Button(_("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"] = Button("")
            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)
        self.onShown.append(self.show_Errors)
Example #30
0
SystemInfo["Blindscan_t2_available"] = fileCheck("/proc/stb/info/vumodel")
SystemInfo["HasForceLNBOn"] = fileCheck("/proc/stb/frontend/fbc/force_lnbon")
SystemInfo["HasForceToneburst"] = fileCheck("/proc/stb/frontend/fbc/force_toneburst")
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')
SystemInfo["hasXcoreVFD"] = fileCheck("/sys/module/brcmstb_%s/parameters/pt6302_cgram" % getBoxType())
SystemInfo["HasHDMIin"] = getMachineBuild() in ('vuuno4kse', 'vuultimo4k')
SystemInfo["HasHDMI-CEC"] = fileExists("/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
SystemInfo["HasInfoButton"] = False
SystemInfo["Has24hz"] = fileCheck("/proc/stb/video/videomode_24hz")
SystemInfo["canMultiBoot"] = False
SystemInfo["HasHiSi"] = False
SystemInfo["canMode12"] = False
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["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")
SystemInfo["CanDownmixDTS"] = fileHas("/proc/stb/audio/dts_choices", "downmix")
SystemInfo["CanDownmixAAC"] = fileHas("/proc/stb/audio/aac_choices", "downmix")
SystemInfo["Canaudiosource"] = fileCheck("/proc/stb/hdmi/audio_source")
SystemInfo["Can3DSurround"] = fileExists("/proc/stb/audio/3d_surround_choices") and fileCheck("/proc/stb/audio/3d_surround")
SystemInfo["Can3DSpeaker"] = fileExists("/proc/stb/audio/3d_surround_speaker_position_choices") and fileCheck("/proc/stb/audio/3d_surround_speaker_position")
SystemInfo["CanAutoVolume"] = fileExists("/proc/stb/audio/avl_choices") and fileCheck("/proc/stb/audio/avl")
SystemInfo["havecolorspace"] = fileCheck("/proc/stb/video/hdmi_colorspace")
SystemInfo["havecolorimetry"] = fileCheck("/proc/stb/video/hdmi_colorimetry")
SystemInfo["havehdmicolordepth"] = fileCheck("/proc/stb/video/hdmi_colordepth")
SystemInfo["Canedidchecking"] = fileCheck("/proc/stb/hdmi/bypass_edid_checking")
SystemInfo["haveboxmode"] = fileExists("/proc/stb/info/boxmode")
SystemInfo["HasScaler_sharpness"] = pathExists("/proc/stb/vmpeg/0/pep_scaler_sharpness")
Example #31
0
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")
SystemInfo["supportPcmMultichannel"] = fileCheck("/proc/stb/audio/multichannel_pcm")
SystemInfo["CanDownmixAC3"] = fileHas("/proc/stb/audio/ac3_choices", "downmix")
SystemInfo["CanAC3Transcode"] = fileHas("/proc/stb/audio/ac3plus_choices", "force_ac3")
SystemInfo["CanDownmixDTS"] = fileHas("/proc/stb/audio/dts_choices", "downmix")
SystemInfo["CanDTSHD"] = 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["CanAACTranscode"] = fileHas("/proc/stb/audio/aac_transcode_choices", "off")