From 3075df24e7931901c6f0526e10a89631fd73c4d0 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 26 Aug 2005 07:35:55 +0000 Subject: [PATCH] Subvert SIGUSR2 to reload all input devices. (Ubuntu #020) --- hw/xfree86/common/xf86Events.c | 20 ++++++++++++++++++++ hw/xfree86/os-support/linux/lnx_init.c | 1 + 2 files changed, 21 insertions(+) diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 5503e2425..d9157b163 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -1735,6 +1735,26 @@ XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, #endif /* XTESTEXT1 */ +void +xf86ReloadInputDevs(int sig) +{ + InputInfoPtr pInfo; + + signal(sig, (void(*)(int))xf86ReloadInputDevs); + + DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); + EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); + + pInfo = xf86InputDevs; + while (pInfo) { + DisableDevice(pInfo->dev); + EnableDevice(pInfo->dev); + pInfo = pInfo->next; + } + + return; +} + #ifdef WSCONS_SUPPORT /* XXX Currently XKB is mandatory. */ diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index a52073d0a..9933c6f7b 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -289,6 +289,7 @@ xf86OpenConsole(void) } else { /* ShareVTs */ close(xf86Info.consoleFd); } + signal(SIGUSR2, xf86ReloadInputDevs); } else { /* serverGeneration != 1 */ if (!ShareVTs && VTSwitch) {