From d00d32df526b88b146c711ce8951008d72ec6a56 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Feb 2009 17:58:59 +0100 Subject: [PATCH 1/1] code cleanup ... use more /proc/stb/avs/0/* auto functions this change needs current drivers (SRCDATE >= 20090206) --- lib/driver/avswitch.cpp | 30 ------------ lib/driver/avswitch.h | 2 - lib/python/Components/AVSwitch.py | 47 +++---------------- .../SystemPlugins/Videomode/VideoHardware.py | 44 ----------------- 4 files changed, 6 insertions(+), 117 deletions(-) diff --git a/lib/driver/avswitch.cpp b/lib/driver/avswitch.cpp index dbfebf5f..f05bdd95 100644 --- a/lib/driver/avswitch.cpp +++ b/lib/driver/avswitch.cpp @@ -132,23 +132,6 @@ void eAVSwitch::setInput(int val) write(fd, input[val], strlen(input[val])); close(fd); - - if (val == 1) - setFastBlank(2); -} - -void eAVSwitch::setFastBlank(int val) -{ - int fd; - const char *fb[] = {"low", "high", "vcr"}; - - if((fd = open("/proc/stb/avs/0/fb", O_WRONLY)) < 0) { - eDebug("cannot open /proc/stb/avs/0/fb"); - return; - } - - write(fd, fb[val], strlen(fb[0])); - close(fd); } void eAVSwitch::setColorFormat(int format) @@ -284,18 +267,5 @@ void eAVSwitch::setWSS(int val) // 0 = auto, 1 = auto(4:3_off) close(fd); } -void eAVSwitch::setSlowblank(int val) -{ - int fd; - if((fd = open("/proc/stb/avs/0/sb", O_WRONLY)) < 0) { - eDebug("cannot open /proc/stb/avs/0/sb"); - return; - } - const char *sb[] = {"0", "6", "12", "vcr", "auto"}; - write(fd, sb[val], strlen(sb[val])); -// eDebug("set slow blanking to %s", sb[val]); - close(fd); -} - //FIXME: correct "run/startlevel" eAutoInitP0 init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver"); diff --git a/lib/driver/avswitch.h b/lib/driver/avswitch.h index 8fdafdd1..bcb29c40 100644 --- a/lib/driver/avswitch.h +++ b/lib/driver/avswitch.h @@ -26,12 +26,10 @@ public: static eAVSwitch *getInstance(); bool haveScartSwitch(); int getVCRSlowBlanking(); - void setFastBlank(int val); void setColorFormat(int format); void setAspectRatio(int ratio); void setVideomode(int mode); void setInput(int val); - void setSlowblank(int val); void setWSS(int val); PSignal1 vcr_sb_notifier; }; diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 1f529cfd..3188469a 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -3,27 +3,15 @@ from enigma import eAVSwitch, getDesktop from SystemInfo import SystemInfo class AVSwitch: - INPUT = { "ENCODER": (0, 4), "SCART": (1, 3), "AUX": (2, 4) } - def setInput(self, input): - eAVSwitch.getInstance().setInput(self.INPUT[input][0]) - if self.INPUT[input][1] == 4: - aspect = self.getAspectRatioSetting() - self.setAspectWSS(aspect) - self.setAspectSlowBlank(aspect) - else: - eAVSwitch.getInstance().setSlowblank(self.INPUT[input][1]) - # FIXME why do we have to reset the colorformat? bug in avs-driver? - map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} - eAVSwitch.getInstance().setColorFormat(map[config.av.colorformat.value]) + INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } + eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): eAVSwitch.getInstance().setColorFormat(value) def setAspectRatio(self, value): eAVSwitch.getInstance().setAspectRatio(value) - self.setAspectWSS(value) - self.setAspectSlowBlank(value) def setSystem(self, value): eAVSwitch.getInstance().setVideomode(value) @@ -69,35 +57,12 @@ class AVSwitch: return val def setAspectWSS(self, aspect=None): - if aspect is None: - aspect = self.getAspectRatioSetting() - if aspect == 0 or aspect == 1: # letterbox or panscan - if not config.av.wss.value: - value = 0 # wss off - else: - value = 3 # 4:3_full_format - elif aspect == 2: # 16:9 - if not config.av.wss.value: - value = 2 # auto(4:3_off) - else: - value = 1 # auto - elif aspect == 3 or aspect == 6: # always 16:9 - value = 4 # 16:9_full_format - elif aspect == 4 or aspect == 5: # 16:10 - value = 10 # 14:9_full_format + if not config.av.wss.value: + value = 2 # auto(4:3_off) + else: + value = 1 # auto eAVSwitch.getInstance().setWSS(value) - def setAspectSlowBlank(self, aspect=None): - if aspect is None: - aspect = self.getAspectRatioSetting() - if aspect == 0 or aspect == 1: # letterbox or panscan - value = 2 # 12 V - elif aspect == 2: # 16:9 - value = 4 # auto - elif aspect == 3 or aspect == 4 or aspect == 5 or aspect == 6: # always 16:9 - value = 1 # 6V - eAVSwitch.getInstance().setSlowblank(value) - def InitAVSwitch(): config.av = ConfigSubsection() config.av.yuvenabled = ConfigBoolean(default=False) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 7149504a..6a85c4da 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -90,7 +90,6 @@ class VideoHardware: def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() - self.standby = False self.current_mode = None self.current_port = None @@ -107,7 +106,6 @@ class VideoHardware: config.av.aspectratio.notifiers = [ ] config.av.tvsystem.notifiers = [ ] config.av.wss.notifiers = [ ] - AVSwitch.setInput = self.AVSwitchSetInput AVSwitch.getOutputAspect = self.getOutputAspect config.av.aspect.addNotifier(self.updateAspect) @@ -120,12 +118,6 @@ class VideoHardware: # self.timer.callback.append(self.readPreferredModes) # self.timer.start(1000) - config.av.colorformat.addNotifier(self.updateFastblank) - - def AVSwitchSetInput(self, mode): - self.standby = mode == "SCART" - self.updateStandby() - def readAvailableModes(self): try: modes = open("/proc/stb/video/videomode_choices").read()[:-1] @@ -322,42 +314,6 @@ class VideoHardware: open("/proc/stb/video/policy2", "w").write(policy2) except IOError: pass - self.updateSlowblank() - self.updateFastblank() - - def updateSlowblank(self): - if self.standby: - from Components.SystemInfo import SystemInfo - if SystemInfo["ScartSwitch"]: - input = "scart" - sb = "vcr" - else: - input = "off" - sb = "0" - else: - input = "encoder" - sb = "auto" - - open("/proc/stb/avs/0/sb", "w").write(sb) - open("/proc/stb/avs/0/input", "w").write(input) - - def updateStandby(self): - self.updateSlowblank() - self.updateFastblank() - - def updateFastblank(self, *args): - if self.standby: - from Components.SystemInfo import SystemInfo - if SystemInfo["ScartSwitch"]: - fb = "vcr" - else: - fb = "low" - else: - if self.current_port == "Scart" and config.av.colorformat.value == "rgb": - fb = "high" - else: - fb = "low" - open("/proc/stb/avs/0/fb", "w").write(fb) config.av.edid_override = ConfigYesNo(default = False) video_hw = VideoHardware() -- 2.30.2