]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/slutils/slutils-0.1.0/slfb/slfb.c
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / slutils / slutils-0.1.0 / slfb / slfb.c
1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <stdlib.h>
4 #include <sys/ioctl.h>
5
6 int main(int argc, char ** argv) {
7   int fd = open("/dev/fb0", O_WRONLY|O_NONBLOCK );
8   int on;
9   int res = 0;
10
11   if (argc != 2) {
12     printf("You must specify on or off\n");
13     return 0;
14   }
15
16   on = !strncmp(argv[1], "on", (strlen(argv[1]) > 1 ? 2 : 1));
17
18   printf((on ? "on\n" : "off\n"));
19
20   if ( fd )
21     {
22       int ioctlnum = 0x4611;
23       int vesaMode = on ? 0 : 3;
24       res = ioctl ( fd, ioctlnum, vesaMode );
25       printf("%i\n", res);
26       close ( fd );
27     }
28   else
29     {
30       printf("failed\n");
31     }
32   return res;
33 }
34