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::setColorFormat(int format)
38 char *svideo="svideo";
41 if((fd = open("/proc/stb/avs/0/colorformat", O_WRONLY)) < 0) {
42 printf("cannot open /proc/stb/avs/0/colorformat\n");
47 write(fd, cvbs, strlen(cvbs));
50 write(fd, rgb, strlen(rgb));
53 write(fd, svideo, strlen(svideo));
59 void eAVSwitch::setAspectRatio(int ratio)
68 char *aspect[] = {"4:3", "4:3", "any", "16:9"};
69 char *policy[] = {"letterbox", "panscan", "bestfit", "panscan"};
72 if((fd = open("/proc/stb/video/aspect", O_WRONLY)) < 0) {
73 printf("cannot open /proc/stb/video/aspect\n");
76 write(fd, aspect[ratio], strlen(aspect[ratio]));
79 if((fd = open("/proc/stb/video/policy", O_WRONLY)) < 0) {
80 printf("cannot open /proc/stb/video/policy\n");
83 write(fd, policy[ratio], strlen(policy[ratio]));
88 void eAVSwitch::setVideomode(int mode)
95 //FIXME: bug in driver (cannot set PAL)
96 if((fd = open("/proc/stb/video/videomode", O_WRONLY)) < 0) {
97 printf("cannot open /proc/stb/video/videomode\n");
102 write(fd, pal, strlen(pal));
105 write(fd, ntsc, strlen(ntsc));
111 //FIXME: correct "run/startlevel"
112 eAutoInitP0<eAVSwitch> init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver");