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]));
50 void eAVSwitch::setColorFormat(int format)
59 char *svideo="svideo";
62 if((fd = open("/proc/stb/avs/0/colorformat", O_WRONLY)) < 0) {
63 printf("cannot open /proc/stb/avs/0/colorformat\n");
68 write(fd, cvbs, strlen(cvbs));
71 write(fd, rgb, strlen(rgb));
74 write(fd, svideo, strlen(svideo));
80 void eAVSwitch::setAspectRatio(int ratio)
89 char *aspect[] = {"4:3", "4:3", "any", "16:9"};
90 char *policy[] = {"letterbox", "panscan", "bestfit", "panscan"};
93 if((fd = open("/proc/stb/video/aspect", O_WRONLY)) < 0) {
94 printf("cannot open /proc/stb/video/aspect\n");
97 write(fd, aspect[ratio], strlen(aspect[ratio]));
100 if((fd = open("/proc/stb/video/policy", O_WRONLY)) < 0) {
101 printf("cannot open /proc/stb/video/policy\n");
104 write(fd, policy[ratio], strlen(policy[ratio]));
109 void eAVSwitch::setVideomode(int mode)
116 //FIXME: bug in driver (cannot set PAL)
117 if((fd = open("/proc/stb/video/videomode", O_WRONLY)) < 0) {
118 printf("cannot open /proc/stb/video/videomode\n");
123 write(fd, pal, strlen(pal));
126 write(fd, ntsc, strlen(ntsc));
132 //FIXME: correct "run/startlevel"
133 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");