mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
tweaking pandora frontend
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@874 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
03065bb617
commit
be672de78d
16 changed files with 378 additions and 144 deletions
67
platform/pandora/picorestore.c
Normal file
67
platform/pandora/picorestore.c
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <termios.h>
|
||||
#include <linux/kd.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
struct fb_var_screeninfo fbvar;
|
||||
struct termios kbd_termios;
|
||||
int ret, fbdev, kbdfd;
|
||||
FILE *tios_f;
|
||||
|
||||
fbdev = open("/dev/fb0", O_RDWR);
|
||||
if (fbdev == -1) {
|
||||
perror("open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = ioctl(fbdev, FBIOGET_VSCREENINFO, &fbvar);
|
||||
if (ret == -1) {
|
||||
perror("FBIOGET_VSCREENINFO ioctl");
|
||||
goto end_fb;
|
||||
}
|
||||
|
||||
if (fbvar.yoffset != 0) {
|
||||
printf("fixing yoffset.. ");
|
||||
fbvar.yoffset = 0;
|
||||
ret = ioctl(fbdev, FBIOPAN_DISPLAY, &fbvar);
|
||||
if (ret < 0)
|
||||
perror("ioctl FBIOPAN_DISPLAY");
|
||||
else
|
||||
printf("ok\n");
|
||||
}
|
||||
|
||||
end_fb:
|
||||
close(fbdev);
|
||||
|
||||
tios_f = fopen("/tmp/pico_tios", "rb");
|
||||
if (tios_f != NULL) {
|
||||
kbdfd = open("/dev/tty", O_RDWR);
|
||||
if (kbdfd == -1) {
|
||||
perror("open /dev/tty");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fread(&kbd_termios, sizeof(kbd_termios), 1, tios_f) == 1) {
|
||||
if (ioctl(kbdfd, KDSETMODE, KD_TEXT) == -1)
|
||||
perror("KDSETMODE KD_TEXT");
|
||||
|
||||
printf("restoring termios.. ");
|
||||
if (tcsetattr(kbdfd, TCSAFLUSH, &kbd_termios) == -1)
|
||||
perror("tcsetattr");
|
||||
else
|
||||
printf("ok\n");
|
||||
}
|
||||
|
||||
close(kbdfd);
|
||||
fclose(tios_f);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue