oshide: drop termios dump/restore, OS already handles that
[libpicofe.git] / pandora / picorestore.c
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include <fcntl.h>
5 #include <unistd.h>
6 #include <sys/ioctl.h>
7 #include <linux/fb.h>
8 #include <linux/kd.h>
9
10 int main()
11 {
12         struct fb_var_screeninfo fbvar;
13         int ret, fbdev, kbdfd;
14
15         fbdev = open("/dev/fb0", O_RDWR);
16         if (fbdev == -1) {
17                 perror("open");
18                 return 1;
19         }
20
21         ret = ioctl(fbdev, FBIOGET_VSCREENINFO, &fbvar);
22         if (ret == -1) {
23                 perror("FBIOGET_VSCREENINFO ioctl");
24                 goto end_fb;
25         }
26
27         if (fbvar.yoffset != 0) {
28                 printf("fixing yoffset.. ");
29                 fbvar.yoffset = 0;
30                 ret = ioctl(fbdev, FBIOPAN_DISPLAY, &fbvar);
31                 if (ret < 0)
32                         perror("ioctl FBIOPAN_DISPLAY");
33                 else
34                         printf("ok\n");
35         }
36
37 end_fb:
38         close(fbdev);
39
40         kbdfd = open("/dev/tty", O_RDWR);
41         if (kbdfd == -1) {
42                 perror("open /dev/tty");
43                 return 1;
44         }
45
46         if (ioctl(kbdfd, KDSETMODE, KD_TEXT) == -1)
47                 perror("KDSETMODE KD_TEXT");
48
49         close(kbdfd);
50
51         return 0;
52 }