diff options
authorThomas Hellstrom <>2010-09-02 10:53:28 +0200
committerPeter Hutterer <>2010-09-10 09:09:46 +1000
commitda31ca747f8e3993b2aca5d31b7d09b9907ad1d9 (patch)
parent52df92a563980a7af0fb61248da3654bd90e8232 (diff)
linux: Don't lose console events on non-evdev drivers (#29969)
The drain_console() function will race with new keyboard events being added by the hardware causing the server to lose keyboard events if the console fd is used for input. Only use the drain_console() when AllowEmptyInput is off which is the best indicator we have for whether the keyboard driver will be used. This patch will only fix the bug when hotplugging is disabled. What we really need is a way to figure out either whether we're _not_ using the keyboard driver (not predictable) or a way for the keyboard driver to disable drain_console(). X.Org Bug 29969 <> Signed-off-by: Thomas Hellstrom <> Reviewed-by: Peter Hutterer <> Reviewed-by: Adam Jackson <> Signed-off-by: Peter Hutterer <> (cherry picked from commit 71972c2534d490284d3d42b456c2f34b964b2894)
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index c8cec2ecb..92bfde48f 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -277,8 +277,9 @@ xf86OpenConsole(void)
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
/* need to keep the buffer clean, else the kernel gets angry */
- console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
- drain_console, NULL);
+ if (xf86Info.allowEmptyInput)
+ console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
+ drain_console, NULL);
/* we really should have a InitOSInputDevices() function instead
* of Init?$#*&Device(). So I just place it here */