Beispiel #1
0
 def final_scroll_delay(configElement):
     if BoxInfo.getItem("VFDDelay"):
         fileWriteLine(BoxInfo.getItem("VFD_final_scroll_delay"),
                       hex(int(configElement.value)))
     else:
         fileWriteLine(BoxInfo.getItem("VFD_final_scroll_delay"),
                       configElement.value)
Beispiel #2
0
 def setPower(self, value):
     if exists("/proc/stb/power/vfd"):
         print("[Lcd] setLCDPower='%s'." % value)
         fileWriteLine("/proc/stb/power/vfd", value)
     elif exists("/proc/stb/lcd/vfd"):
         print("[Lcd] setLCDPower='%s'." % value)
         fileWriteLine("/proc/stb/lcd/vfd", value)
Beispiel #3
0
	def activateTimezone(self, zone, area, runCallbacks=True):
		tz = zone if area in ("Classic", "Generic") else pathjoin(area, zone)
		file = pathjoin(TIMEZONE_DATA, tz)
		if not isfile(file):
			print("[Timezones] Error: The time zone '%s' is not available!  Using 'UTC' instead." % tz)
			tz = "UTC"
			file = pathjoin(TIMEZONE_DATA, tz)
		print("[Timezones] Setting time zone to '%s'." % tz)
		try:
			unlink("/etc/localtime")
		except (IOError, OSError) as err:
			if err.errno != ENOENT:  # No such file or directory.
				print("[Timezones] Error %d: Unlinking '/etc/localtime'!  (%s)" % (err.errno, err.strerror))
		try:
			symlink(file, "/etc/localtime")
		except (IOError, OSError) as err:
			print("[Timezones] Error %d: Linking '%s' to '/etc/localtime'!  (%s)" % (err.errno, file, err.strerror))
		fileWriteLine("/etc/timezone", "%s\n" % tz, source=MODULE_NAME)
		environ["TZ"] = ":%s" % tz
		try:
			tzset()
		except Exception:
			from enigma import e_tzset
			e_tzset()
		if exists("/proc/stb/fp/rtc_offset"):
			setRTCoffset()
		timeFormat = "%a %d-%b-%Y %H:%M:%S"
		print("[Timezones] Local time is '%s'  -  UTC time is '%s'." % (strftime(timeFormat, localtime(None)), strftime(timeFormat, gmtime(None))))
		if runCallbacks:
			for callback in self.callbacks:
				callback()
Beispiel #4
0
 def lcdLiveTvChanged(configElement):
     if "live_enable" in BoxInfo.getItem("LcdLiveTV"):
         fileWriteLine(
             BoxInfo.getItem("LcdLiveTV"),
             configElement.value and "enable" or "disable")
     else:
         fileWriteLine(BoxInfo.getItem("LcdLiveTV"),
                       configElement.value and "0" or "1")
     try:
         InfoBarInstance = InfoBar.instance
         InfoBarInstance and InfoBarInstance.session.open(
             dummyScreen)
     except:
         pass
def setFPWakeuptime(wutime):
	if not fileWriteLine("/proc/stb/fp/wakeup_time", str(wutime), source=MODULE_NAME):
		try:
			with open("/dev/dbox/fp0") as fd:
				ioctl(fd.fileno(), 6, pack('L', wutime))  # Set wake up time.
		except (IOError, OSError) as err:
			print("[StbHardware] Error %d: Unable to write to '/dev/dbox/fp0', setFPWakeuptime failed!  (%s)" % (err.errno, err.strerror))
def clearFPWasTimerWakeup():
	if not fileWriteLine("/proc/stb/fp/was_timer_wakeup", "0", source=MODULE_NAME):
		try:
			with open("/dev/dbox/fp0") as fd:
				ioctl(fd.fileno(), 10)
		except (IOError, OSError) as err:
			print("[StbHardware] Error %d: Unable to update '/dev/dbox/fp0', clearFPWasTimerWakeup failed!  (%s)" % (err.errno, err.strerror))
Beispiel #7
0
def getFPWasTimerWakeup(check=False):
    global wasTimerWakeup
    isError = False
    if wasTimerWakeup is not None:
        if check:
            return wasTimerWakeup, isError
        return wasTimerWakeup
    wasTimerWakeup = fileReadLine("/proc/stb/fp/was_timer_wakeup",
                                  source=MODULE_NAME)
    if wasTimerWakeup is not None:
        wasTimerWakeup = int(wasTimerWakeup) and True or False
        if not fileWriteLine("/tmp/was_timer_wakeup.txt",
                             str(wasTimerWakeup),
                             source=MODULE_NAME):
            try:
                with open("/dev/dbox/fp0") as fd:
                    wasTimerWakeup = unpack('B', ioctl(
                        fd.fileno(), 9, ' '))[0] and True or False
            except (IOError, OSError) as err:
                isError = True
                print(
                    "[StbHardware] Error %d: Unable to read '/dev/dbox/fp0', getFPWasTimerWakeup failed!  (%s)"
                    % (err.errno, err.strerror))
    else:
        wasTimerWakeup = False
    if wasTimerWakeup:
        clearFPWasTimerWakeup()  # Clear hardware status.
    if check:
        return wasTimerWakeup, isError
    return wasTimerWakeup
def setRTCoffset(forsleep=None):
	forsleep = 7200 + timezone if localtime().tm_isdst == 0 else 3600 - timezone
	# t_local = localtime(int(time()))  # This line does nothing!
	# Set RTC OFFSET (diff. between UTC and Local Time)
	if fileWriteLine("/proc/stb/fp/rtc_offset", str(forsleep), source=MODULE_NAME):
		print("[StbHardware] Set RTC offset to %s sec." % forsleep)
	else:
		print("[StbHardware] Error: Write to '/proc/stb/fp/rtc_offset' failed!")
def setRTCtime(wutime):
	if exists("/proc/stb/fp/rtc_offset"):
		setRTCoffset()
	if not fileWriteLine("/proc/stb/fp/rtc", str(wutime), source=MODULE_NAME):
		try:
			with open("/dev/dbox/fp0") as fd:
				ioctl(fd.fileno(), 0x101, pack('L', wutime))  # Set time.
		except (IOError, OSError) as err:
			print("[StbHardware] Error %d: Unable to write to '/dev/dbox/fp0', setRTCtime failed!  (%s)" % (err.errno, err.strerror))
Beispiel #10
0
def setRTCoffset():
    forsleep = (localtime(time()).tm_hour - gmtime(time()).tm_hour) * 3600
    if fileWriteLine("/proc/stb/fp/rtc_offset",
                     str(forsleep),
                     source=MODULE_NAME):
        print("[StbHardware] Set RTC offset to %s sec." % forsleep)
    else:
        print(
            "[StbHardware] Error: Write to '/proc/stb/fp/rtc_offset' failed!")
Beispiel #11
0
 def jobTask(self):
     linkState = 0
     if exists("/sys/class/net/wlan0/operstate"):
         linkState = fileReadLine("/sys/class/net/wlan0/operstate")
         if linkState != "down":
             linkState = fileReadLine("/sys/class/net/wlan0/carrier")
     elif exists("/sys/class/net/eth0/operstate"):
         linkState = fileReadLine("/sys/class/net/eth0/operstate")
         if linkState != "down":
             linkState = fileReadLine("/sys/class/net/eth0/carrier")
     linkState = linkState[:1]
     if exists("/proc/stb/lcd/symbol_network"
               ) and config.lcd.mode.value == "1":
         fileWriteLine("/proc/stb/lcd/symbol_network", linkState)
     elif exists("/proc/stb/lcd/symbol_network"
                 ) and config.lcd.mode.value == "0":
         fileWriteLine("/proc/stb/lcd/symbol_network", "0")
     USBState = 0
     for bus in busses():
         devices = bus.devices
         for dev in devices:
             if dev.deviceClass != 9 and dev.deviceClass != 2 and dev.idVendor != 3034 and dev.idVendor > 0:
                 USBState = 1
     if exists("/proc/stb/lcd/symbol_usb"):
         fileWriteLine("/proc/stb/lcd/symbol_usb", USBState)
     self.timer.startLongTimer(30)
 def finished(self, gotoStep=None, *args, **kwargs):
     print("[Wizard] In finished.")
     currStep = self.currStep
     if self.updateValues not in self.onShown:
         self.onShown.append(self.updateValues)
     if self.showConfig:
         if self.wizard[currStep]["config"]["type"] == "dynamic":
             eval("self." + self.wizard[currStep]["config"]["evaluation"])()
     if self.showList:
         if len(self.wizard[currStep]["evaluatedlist"]) > 0:
             print("[Wizard] current: '%s'." % str(self["list"].current))
             nextStep = self["list"].current[1]
             if "listevaluation" in self.wizard[currStep]:
                 exec("self." +
                      self.wizard[self.currStep]["listevaluation"] + "('" +
                      nextStep + "')")
             else:
                 self.currStep = self.getStepWithID(nextStep)
     print_now = True
     if (currStep == self.numSteps
             and self.wizard[currStep]["nextstep"] is None
         ) or self.wizard[currStep]["id"] == "end":  # wizard finished
         print("[Wizard] Wizard finished.")
         self.markDone()
         self.exit()
     else:
         self.codeafter = True
         self.runCode(self.wizard[currStep]["codeafter"])
         self.prevStep = currStep
         self.gotoStep = gotoStep
         if not self.runCode(self.wizard[currStep]["codeafter_async"]):
             self.afterAsyncCode()
         else:
             if self.updateValues in self.onShown:
                 self.onShown.remove(self.updateValues)
     fileWriteLine("/proc/progress", "100")
     if print_now:
         print("[Wizard] Now: '%s'." % str(self.currStep))
Beispiel #13
0
 def setXcoreVFD(configElement):
     if exists("/sys/module/brcmstb_osmega/parameters/pt6302_cgram"):
         fileWriteLine(
             "/sys/module/brcmstb_osmega/parameters/pt6302_cgram",
             configElement.value)
     if exists("/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram"):
         fileWriteLine(
             "/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram",
             configElement.value)
     if exists(
             "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram"
     ):
         fileWriteLine(
             "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram",
             configElement.value)
     if exists(
             "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram"
     ):
         fileWriteLine(
             "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram",
             configElement.value)
Beispiel #14
0
 def setPower4x7Suspend(configElement):
     if exists("/proc/stb/fp/power4x7suspend"):
         fileWriteLine("/proc/stb/fp/power4x7suspend",
                       "on" if configElement.value else "off")
Beispiel #15
0
 def setPower4x7Standby(configElement):
     if exists("/proc/stb/fp/power4x7standby"):
         fileWriteLine("/proc/stb/fp/power4x7standby",
                       "on" if configElement.value else "off")
Beispiel #16
0
 def setLedFadeControlColor(configElement):
     if exists("/proc/stb/fp/led_fade"):
         fileWriteLine("/proc/stb/fp/led_fade", configElement.value)
Beispiel #17
0
 def setLedColorControlColor(configElement):
     if exists("/proc/stb/fp/led_color"):
         fileWriteLine("/proc/stb/fp/led_color", configElement.value)
Beispiel #18
0
 def setLedBrightnessControl(configElement):
     if exists("/proc/stb/fp/led_brightness"):
         fileWriteLine("/proc/stb/fp/led_brightness",
                       configElement.value)
Beispiel #19
0
 def setLedBlinkControlColor(configElement):
     if exists("/proc/stb/fp/led_blink"):
         fileWriteLine("/proc/stb/fp/led_blink", configElement.value)
Beispiel #20
0
 def setLCDMiniTVFPS(self, value):
     if exists("/proc/stb/lcd/fps"):
         print("[Lcd] setLCDMiniTVFPS='%s'." % value)
         fileWriteLine("/proc/stb/lcd/fps", value)
Beispiel #21
0
 def setLedStandbyColor(configElement):
     if exists("/proc/stb/fp/ledstandbycolor"):
         fileWriteLine("/proc/stb/fp/ledstandbycolor",
                       configElement.value)
Beispiel #22
0
 def setLedPowerColor(configElement):
     if exists("/proc/stb/fp/ledpowercolor"):
         fileWriteLine("/proc/stb/fp/ledpowercolor",
                       configElement.value)
Beispiel #23
0
 def setPowerLEDdeepstanbystate(configElement):
     if exists("/proc/stb/power/suspendled"):
         fileWriteLine("/proc/stb/power/suspendled",
                       "on" if configElement.value else "off")
Beispiel #24
0
	def writeRemoteControlType(self, rcType):
		if rcType > 0:
			fileWriteLine("/proc/stb/ir/rc/type", rcType, source=MODULE_NAME)
Beispiel #25
0
 def setLCDModeMinitTV(configElement):
     print("[Lcd] setLCDModeMinitTV='%s'." % configElement.value)
     fileWriteLine("/proc/stb/lcd/mode", configElement.value)
Beispiel #26
0
 def setLedSuspendColor(configElement):
     if exists("/proc/stb/fp/ledsuspendledcolor"):
         fileWriteLine("/proc/stb/fp/ledsuspendledcolor",
                       configElement.value)
Beispiel #27
0
 def setMiniTVFPS(configElement):
     print("[Lcd] setMiniTVFPS='%s'." % configElement.value)
     fileWriteLine("/proc/stb/lcd/fps", configElement.value)
Beispiel #28
0
 def setLCDMiniTVMode(self, value):
     if exists("/proc/stb/lcd/mode"):
         print("[Lcd] setLCDMiniTVMode='%s'." % value)
         fileWriteLine("/proc/stb/lcd/mode", value)
def profile(checkPoint):
    now = time() - profileStart
    if profileFd:
        profileFd.write("%7.3f\t%s\n" % (now, checkPoint))
        if checkPoint in profileData:
            timeStamp = profileData[checkPoint]
            if totalTime:
                percentage = timeStamp * (PERCENTAGE_END - PERCENTAGE_START
                                          ) / totalTime + PERCENTAGE_START
            else:
                percentage = PERCENTAGE_START
            if model == "axodin":
                fileWriteLine("/dev/dbox/oled0",
                              "%d" % percentage,
                              source=MODULE_NAME)
            elif model == "beyonwizu4":
                fileWriteLine("/dev/dbox/oled0",
                              "Loading %d%%\n" % percentage,
                              source=MODULE_NAME)
            elif model in ("gb800solo", "gb800se", "gb800seplus", "gbultrase"):
                fileWriteLine("/dev/mcu",
                              "%d  \n" % percentage,
                              source=MODULE_NAME)
            elif model in ("sezammarvel", "xpeedlx3", "atemionemesis"):
                fileWriteLine("/proc/vfd",
                              "Loading %d%% " % percentage,
                              source=MODULE_NAME)
            elif model in ("ebox5000", "osmini", "spycatmini", "osminiplus",
                           "spycatminiplus"):
                fileWriteLine("/proc/progress",
                              "%d" % percentage,
                              source=MODULE_NAME)
            elif isfile("/proc/progress"):
                fileWriteLine("/proc/progress",
                              "%d \n" % percentage,
                              source=MODULE_NAME)
Beispiel #30
0
 def setPowerLEDstate2(configElement):
     if exists("/proc/stb/power/powerled2"):
         fileWriteLine("/proc/stb/power/powerled2",
                       "on" if configElement.value else "off")