Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed detection of current vt when not running as root.
  • Loading branch information
slouken committed May 8, 2006
1 parent 55c0d1f commit 835f3e5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/video/fbcon/SDL_fbevents.c
Expand Up @@ -55,6 +55,7 @@
#define GPM_NODE_FIFO "/dev/gpmdata"
#endif

/*#define DEBUG_KEYBOARD*/
/*#define DEBUG_MOUSE*/

/* The translation tables from a console scancode to a SDL keysym */
Expand Down Expand Up @@ -281,8 +282,15 @@ int FB_OpenKeyboard(_THIS)
}
if ( keyboard_fd < 0 ) {
/* Last resort, maybe our tty is a usable VT */
current_vt = 0;
struct vt_stat vtstate;

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
fprintf(stderr, "Current VT: %d\n", current_vt);
Expand Down

0 comments on commit 835f3e5

Please sign in to comment.