code cleanup ... use more /proc/stb/avs/0/* auto functions
authorghost <andreas.monzner@multimedia-labs.de>
Fri, 6 Feb 2009 16:58:59 +0000 (17:58 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Fri, 6 Feb 2009 16:58:59 +0000 (17:58 +0100)
this change needs current drivers (SRCDATE >= 20090206)

lib/driver/avswitch.cpp
lib/driver/avswitch.h
lib/python/Components/AVSwitch.py
lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py

index dbfebf5f2e15ee0d45a9ffe506bd4478ff338a6c..f05bdd9551b27f0baca3c3082f6fd36df2c7a61c 100644 (file)
@@ -132,23 +132,6 @@ void eAVSwitch::setInput(int val)
 
        write(fd, input[val], strlen(input[val]));
        close(fd);
 
        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)
 }
 
 void eAVSwitch::setColorFormat(int format)
@@ -284,18 +267,5 @@ void eAVSwitch::setWSS(int val) // 0 = auto, 1 = auto(4:3_off)
        close(fd);
 }
 
        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<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");
 //FIXME: correct "run/startlevel"
 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");
index 8fdafdd1b4faab33f14999fccdf172dd185bf68d..bcb29c40eb405491c10b539a0fbbd22c06c0b82a 100644 (file)
@@ -26,12 +26,10 @@ public:
        static eAVSwitch *getInstance();
        bool haveScartSwitch();
        int getVCRSlowBlanking();
        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 setColorFormat(int format);
        void setAspectRatio(int ratio);
        void setVideomode(int mode);
        void setInput(int val);
-       void setSlowblank(int val);
        void setWSS(int val);
        PSignal1<void, int> vcr_sb_notifier;
 };
        void setWSS(int val);
        PSignal1<void, int> vcr_sb_notifier;
 };
index 1f529cfd86a95ee00e906f9fee433bdd3275816d..3188469a836f7cc28c018cb61f8ee020de64904d 100644 (file)
@@ -3,27 +3,15 @@ from enigma import eAVSwitch, getDesktop
 from SystemInfo import SystemInfo
 
 class AVSwitch:
 from SystemInfo import SystemInfo
 
 class AVSwitch:
-       INPUT = { "ENCODER": (0, 4), "SCART": (1, 3), "AUX": (2, 4) }
-
        def setInput(self, input):
        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)
 
        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)
 
        def setSystem(self, value):
                eAVSwitch.getInstance().setVideomode(value)
@@ -69,35 +57,12 @@ class AVSwitch:
                return val
 
        def setAspectWSS(self, aspect=None):
                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)
 
                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)
 def InitAVSwitch():
        config.av = ConfigSubsection()
        config.av.yuvenabled = ConfigBoolean(default=False)
index 7149504a5603a6584d867ea343663b5a1223788c..6a85c4da9338d6c40802ef8a6c396e13b6ecda9a 100644 (file)
@@ -90,7 +90,6 @@ class VideoHardware:
        def __init__(self):
                self.last_modes_preferred =  [ ]
                self.on_hotplug = CList()
        def __init__(self):
                self.last_modes_preferred =  [ ]
                self.on_hotplug = CList()
-               self.standby = False
                self.current_mode = None
                self.current_port = None
 
                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 = [ ]
                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)
                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)
 
 #              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]
        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
                        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()
 
 config.av.edid_override = ConfigYesNo(default = False)
 video_hw = VideoHardware()