Home | History | Annotate | Download | only in fbcon
      1 Index: SDL_fbevents.c
      2 ===================================================================
      3 --- SDL_fbevents.c	(revision 2338)
      4 +++ SDL_fbevents.c	(working copy)
      5 @@ -55,6 +55,7 @@
      6  #define GPM_NODE_FIFO	"/dev/gpmdata"
      7  #endif
      8  
      9 +/*#define DEBUG_KEYBOARD*/
     10  /*#define DEBUG_MOUSE*/
     11  
     12  /* The translation tables from a console scancode to a SDL keysym */
     13 @@ -281,8 +282,15 @@
     14  		}
     15   		if ( keyboard_fd < 0 ) {
     16  			/* Last resort, maybe our tty is a usable VT */
     17 -			current_vt = 0;
     18 +			struct vt_stat vtstate;
     19 +
     20  			keyboard_fd = open("/dev/tty", O_RDWR);
     21 +
     22 +			if ( ioctl(keyboard_fd, VT_GETSTATE, &vtstate) == 0 ) {
     23 +				current_vt = vtstate.v_active;
     24 +			} else {
     25 +				current_vt = 0;
     26 +			}
     27   		}
     28  #ifdef DEBUG_KEYBOARD
     29  		fprintf(stderr, "Current VT: %d\n", current_vt);
     30