2 * picorestore - clean up after an omapfb program crash
4 * Copyright (c) GraÅžvydas "notaz" Ignotas, 2010
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the organization nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/types.h>
34 #include <sys/ioctl.h>
36 #include <linux/omapfb.h>
41 struct fb_var_screeninfo fbvar;
42 struct omapfb_plane_info pi;
43 struct omapfb_mem_info mi;
44 int ret, fbdev, kbdfd;
46 fbdev = open("/dev/fb0", O_RDWR);
52 ret = ioctl(fbdev, FBIOGET_VSCREENINFO, &fbvar);
54 perror("FBIOGET_VSCREENINFO ioctl");
58 if (fbvar.yoffset != 0) {
59 printf("fixing yoffset.. ");
61 ret = ioctl(fbdev, FBIOPAN_DISPLAY, &fbvar);
63 perror("ioctl FBIOPAN_DISPLAY");
72 fbdev = open("/dev/fb1", O_RDWR);
78 ret = ioctl(fbdev, OMAPFB_QUERY_PLANE, &pi);
79 ret |= ioctl(fbdev, OMAPFB_QUERY_MEM, &mi);
84 ret = ioctl(fbdev, OMAPFB_SETUP_PLANE, &pi);
86 perror("SETUP_PLANE");
89 ret = ioctl(fbdev, OMAPFB_SETUP_MEM, &mi);
97 kbdfd = open("/dev/tty", O_RDWR);
99 perror("open /dev/tty");
103 if (ioctl(kbdfd, KDSETMODE, KD_TEXT) == -1)
104 perror("KDSETMODE KD_TEXT");