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()
20 eAVSwitch::~eAVSwitch()
24 eAVSwitch *eAVSwitch::getInstance()
29 void eAVSwitch::setInput(int val)
37 char *input[] = {"encoder", "scart", "aux"};
41 if((fd = open("/proc/stb/avs/0/input", O_WRONLY)) < 0) {
42 printf("cannot open /proc/stb/avs/0/input\n");
46 write(fd, input[val], strlen(input[val]));
53 void eAVSwitch::setFastBlank(int val)
56 char *fb[] = {"low", "high", "vcr"};
58 if((fd = open("/proc/stb/avs/0/fb", O_WRONLY)) < 0) {
59 printf("cannot open /proc/stb/avs/0/fb\n");
63 write(fd, fb[val], strlen(fb[0]));
67 void eAVSwitch::setColorFormat(int format)
76 char *svideo="svideo";
80 if((fd = open("/proc/stb/avs/0/colorformat", O_WRONLY)) < 0) {
81 printf("cannot open /proc/stb/avs/0/colorformat\n");
86 write(fd, cvbs, strlen(cvbs));
89 write(fd, rgb, strlen(rgb));
92 write(fd, svideo, strlen(svideo));
95 write(fd, yuv, strlen(yuv));
101 void eAVSwitch::setAspectRatio(int ratio)
112 char *aspect[] = {"4:3", "4:3", "any", "16:9", "16:10", "16:10"};
113 char *policy[] = {"letterbox", "panscan", "bestfit", "panscan", "letterbox", "panscan"};
116 if((fd = open("/proc/stb/video/aspect", O_WRONLY)) < 0) {
117 printf("cannot open /proc/stb/video/aspect\n");
120 // eDebug("set aspect to %s", aspect[ratio]);
121 write(fd, aspect[ratio], strlen(aspect[ratio]));
124 if((fd = open("/proc/stb/video/policy", O_WRONLY)) < 0) {
125 printf("cannot open /proc/stb/video/policy\n");
128 // eDebug("set ratio to %s", policy[ratio]);
129 write(fd, policy[ratio], strlen(policy[ratio]));
134 void eAVSwitch::setVideomode(int mode)
139 if (mode == m_video_mode)
144 if((fd = open("/proc/stb/video/videomode", O_WRONLY)) < 0) {
145 printf("cannot open /proc/stb/video/videomode\n");
150 write(fd, pal, strlen(pal));
153 write(fd, ntsc, strlen(ntsc));
161 void eAVSwitch::setWSS(int val) // 0 = auto, 1 = auto(4:3_off)
164 if((fd = open("/proc/stb/denc/0/wss", O_WRONLY)) < 0) {
165 printf("cannot open /proc/stb/denc/0/wss\n");
169 "off", "auto", "auto(4:3_off)", "4:3_full_format", "16:9_full_format",
170 "14:9_letterbox_center", "14:9_letterbox_top", "16:9_letterbox_center",
171 "16:9_letterbox_top", ">16:9_letterbox_center", "14:9_full_format"
173 write(fd, wss[val], strlen(wss[val]));
174 // eDebug("set wss to %s", wss[val]);
178 void eAVSwitch::setSlowblank(int val)
181 if((fd = open("/proc/stb/avs/0/sb", O_WRONLY)) < 0) {
182 printf("cannot open /proc/stb/avs/0/sb\n");
185 char *sb[] = {"0", "6", "12", "vcr", "auto"};
186 write(fd, sb[val], strlen(sb[val]));
187 // eDebug("set slow blanking to %s", sb[val]);
191 //FIXME: correct "run/startlevel"
192 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");