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"};
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)
110 char *aspect[] = {"4:3", "4:3", "any", "16:9"};
111 char *policy[] = {"letterbox", "panscan", "bestfit", "panscan"};
114 if((fd = open("/proc/stb/video/aspect", O_WRONLY)) < 0) {
115 printf("cannot open /proc/stb/video/aspect\n");
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 write(fd, policy[ratio], strlen(policy[ratio]));
130 void eAVSwitch::setVideomode(int mode)
137 //FIXME: bug in driver (cannot set PAL)
138 if((fd = open("/proc/stb/video/videomode", O_WRONLY)) < 0) {
139 printf("cannot open /proc/stb/video/videomode\n");
144 write(fd, pal, strlen(pal));
147 write(fd, ntsc, strlen(ntsc));
153 //FIXME: correct "run/startlevel"
154 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");