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)
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");
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<void, int> vcr_sb_notifier;
};
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)
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)
def __init__(self):
self.last_modes_preferred = [ ]
self.on_hotplug = CList()
- self.standby = False
self.current_mode = None
self.current_port = None
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)
# 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]
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()