1 #include <lib/driver/avswitch.h>
7 #include <lib/base/init.h>
8 #include <lib/base/init_num.h>
9 #include <lib/base/econfig.h>
10 #include <lib/base/eerror.h>
12 eAVSwitch *eAVSwitch::instance = 0;
14 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"};
59 if((fd = open("/proc/stb/avs/0/fb", O_WRONLY)) < 0) {
60 printf("cannot open /proc/stb/avs/0/fb\n");
64 write(fd, fb[val], strlen(fb[0]));
68 void eAVSwitch::setColorFormat(int format)
77 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));
98 void eAVSwitch::setAspectRatio(int ratio)
107 char *aspect[] = {"4:3", "4:3", "any", "16:9"};
108 char *policy[] = {"letterbox", "panscan", "bestfit", "panscan"};
111 if((fd = open("/proc/stb/video/aspect", O_WRONLY)) < 0) {
112 printf("cannot open /proc/stb/video/aspect\n");
115 write(fd, aspect[ratio], strlen(aspect[ratio]));
118 if((fd = open("/proc/stb/video/policy", O_WRONLY)) < 0) {
119 printf("cannot open /proc/stb/video/policy\n");
122 write(fd, policy[ratio], strlen(policy[ratio]));
127 void eAVSwitch::setVideomode(int mode)
134 //FIXME: bug in driver (cannot set PAL)
135 if((fd = open("/proc/stb/video/videomode", O_WRONLY)) < 0) {
136 printf("cannot open /proc/stb/video/videomode\n");
141 write(fd, pal, strlen(pal));
144 write(fd, ntsc, strlen(ntsc));
150 //FIXME: correct "run/startlevel"
151 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");