--- xc/programs/Xserver/hw/kdrive/linux/keyboard.c.orig 2001-11-08 10:26:24.000000000 +0000 +++ xc/programs/Xserver/hw/kdrive/linux/keyboard.c 2003-03-11 21:13:09.000000000 +0000 @@ -397,12 +397,13 @@ static struct termios LinuxTermios; static int LinuxKbdType; -void +int LinuxKeyboardEnable (int fd, void *closure) { struct termios nTty; unsigned char buf[256]; int n; + int fd_orig_flags; ioctl (fd, KDGKBMODE, &LinuxKbdTrans); tcgetattr (fd, &LinuxTermios); @@ -420,9 +421,18 @@ tcsetattr(fd, TCSANOW, &nTty); /* * Flush any pending keystrokes + * + * Also set to nonblock, just to be safe */ + fd_orig_flags = fcntl( fd , F_GETFL, 0 ); + fcntl ( fd, F_SETFL, fd_orig_flags | O_NONBLOCK ); + while ((n = read (fd, buf, sizeof (buf))) > 0) - ; + ; + + fcntl ( fd , F_SETFL, fd_orig_flags ); + + return fd; } void