Fixed detection of current vt when not running as root.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401737
This commit is contained in:
parent
064c583f72
commit
9cbe216d62
1 changed files with 9 additions and 1 deletions
|
@ -55,6 +55,7 @@
|
||||||
#define GPM_NODE_FIFO "/dev/gpmdata"
|
#define GPM_NODE_FIFO "/dev/gpmdata"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*#define DEBUG_KEYBOARD*/
|
||||||
/*#define DEBUG_MOUSE*/
|
/*#define DEBUG_MOUSE*/
|
||||||
|
|
||||||
/* The translation tables from a console scancode to a SDL keysym */
|
/* The translation tables from a console scancode to a SDL keysym */
|
||||||
|
@ -281,8 +282,15 @@ int FB_OpenKeyboard(_THIS)
|
||||||
}
|
}
|
||||||
if ( keyboard_fd < 0 ) {
|
if ( keyboard_fd < 0 ) {
|
||||||
/* Last resort, maybe our tty is a usable VT */
|
/* Last resort, maybe our tty is a usable VT */
|
||||||
current_vt = 0;
|
struct vt_stat vtstate;
|
||||||
|
|
||||||
keyboard_fd = open("/dev/tty", O_RDWR);
|
keyboard_fd = open("/dev/tty", O_RDWR);
|
||||||
|
|
||||||
|
if ( ioctl(keyboard_fd, VT_GETSTATE, &vtstate) == 0 ) {
|
||||||
|
current_vt = vtstate.v_active;
|
||||||
|
} else {
|
||||||
|
current_vt = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_KEYBOARD
|
#ifdef DEBUG_KEYBOARD
|
||||||
fprintf(stderr, "Current VT: %d\n", current_vt);
|
fprintf(stderr, "Current VT: %d\n", current_vt);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue