1 #include <lib/driver/avswitch.h>
7 #include <lib/base/init.h>
8 #include <lib/base/init_num.h>
9 #include <lib/base/eerror.h>
11 eAVSwitch *eAVSwitch::instance = 0;
13 eAVSwitch::eAVSwitch()
19 eAVSwitch::~eAVSwitch()
23 eAVSwitch *eAVSwitch::getInstance()
28 void eAVSwitch::setInput(int val)
36 char *input[] = {"encoder", "scart", "aux"};
40 if((fd = open("/proc/stb/avs/0/input", O_WRONLY)) < 0) {
41 printf("cannot open /proc/stb/avs/0/input\n");
45 write(fd, input[val], strlen(input[val]));
52 void eAVSwitch::setFastBlank(int val)
55 char *fb[] = {"low", "high", "vcr"};
57 if((fd = open("/proc/stb/avs/0/fb", O_WRONLY)) < 0) {
58 printf("cannot open /proc/stb/avs/0/fb\n");
62 write(fd, fb[val], strlen(fb[0]));
66 void eAVSwitch::setColorFormat(int format)
75 char *svideo="svideo";
79 if((fd = open("/proc/stb/avs/0/colorformat", O_WRONLY)) < 0) {
80 printf("cannot open /proc/stb/avs/0/colorformat\n");
85 write(fd, cvbs, strlen(cvbs));
88 write(fd, rgb, strlen(rgb));
91 write(fd, svideo, strlen(svideo));
94 write(fd, yuv, strlen(yuv));
100 void eAVSwitch::setAspectRatio(int ratio)
109 char *aspect[] = {"4:3", "4:3", "any", "16:9"};
110 char *policy[] = {"letterbox", "panscan", "bestfit", "panscan"};
113 if((fd = open("/proc/stb/video/aspect", O_WRONLY)) < 0) {
114 printf("cannot open /proc/stb/video/aspect\n");
117 // eDebug("set aspect to %s", aspect[ratio]);
118 write(fd, aspect[ratio], strlen(aspect[ratio]));
121 if((fd = open("/proc/stb/video/policy", O_WRONLY)) < 0) {
122 printf("cannot open /proc/stb/video/policy\n");
125 // eDebug("set ratio to %s", policy[ratio]);
126 write(fd, policy[ratio], strlen(policy[ratio]));
131 void eAVSwitch::setVideomode(int mode)
137 if((fd = open("/proc/stb/video/videomode", O_WRONLY)) < 0) {
138 printf("cannot open /proc/stb/video/videomode\n");
143 write(fd, pal, strlen(pal));
146 write(fd, ntsc, strlen(ntsc));
152 void eAVSwitch::setWSS(int val) // 0 = auto, 1 = auto(4:3_off)
155 if((fd = open("/proc/stb/denc/0/wss", O_WRONLY)) < 0) {
156 printf("cannot open /proc/stb/denc/0/wss\n");
160 "off", "auto", "auto(4:3_off)", "4:3_full_format", "16:9_full_format",
161 "14:9_letterbox_center", "14:9_letterbox_top", "16:9_letterbox_center",
162 "16:9_letterbox_top", ">16:9_letterbox_center", "14:9_full_format"
164 write(fd, wss[val], strlen(wss[val]));
165 // eDebug("set wss to %s", wss[val]);
169 void eAVSwitch::setSlowblank(int val)
172 if((fd = open("/proc/stb/avs/0/sb", O_WRONLY)) < 0) {
173 printf("cannot open /proc/stb/avs/0/sb\n");
176 char *sb[] = {"0", "6", "12", "vcr", "auto"};
177 write(fd, sb[val], strlen(sb[val]));
178 // eDebug("set slow blanking to %s", sb[val]);
182 //FIXME: correct "run/startlevel"
183 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");