Hello community, here is the log from the commit of package xorg-x11-server for openSUSE:Factory checked in at 2016-03-07 15:02:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xorg-x11-server (Old) and /work/SRC/openSUSE:Factory/.xorg-x11-server.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xorg-x11-server" Changes: -------- --- /work/SRC/openSUSE:Factory/xorg-x11-server/xorg-x11-server.changes 2016-02-29 09:12:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.xorg-x11-server.new/xorg-x11-server.changes 2016-03-07 15:02:51.000000000 +0100 @@ -1,0 +2,24 @@ +Mon Mar 7 11:06:53 UTC 2016 - [email protected] + +- Backport upstream patches for Xephyr input hot-plugging / + single-GPU multi-seat support: + * U_kdrive-fix-up-NewInputDeviceRequest-implementation.patch + * U_kdrive-set-evdev-driver-for-input-devices-automatica.patch + * U_ephyr-don-t-load-ephyr-input-driver-if-seat-option-i.patch + * U_kdrive-don-t-let-evdev-driver-overwrite-existing-dev.patch + * U_ephyr-ignore-Xorg-multiseat-command-line-options.patch + * U_ephyr-enable-option-sw-cursor-by-default-in-multi-se.patch + * U_kdrive-introduce-input-hot-plugging-support-for-udev.patch + * U_kdrive-add-options-to-set-default-XKB-properties.patch + * U_kdrive-evdev-update-keyboard-LEDs-22302.patch + * U_config-udev-distinguish-between-real-keyboards-and-o.patch + +------------------------------------------------------------------- +Fri Mar 4 18:42:10 UTC 2016 - [email protected] + +- u_os-connections-Check-for-stale-FDs.patch + Ignore file descriptor if socket or devices dies. + This prevents the Xserver to loop at 100% when + dbus dies (boo#954433). + +------------------------------------------------------------------- New: ---- U_config-udev-distinguish-between-real-keyboards-and-o.patch U_ephyr-don-t-load-ephyr-input-driver-if-seat-option-i.patch U_ephyr-enable-option-sw-cursor-by-default-in-multi-se.patch U_ephyr-ignore-Xorg-multiseat-command-line-options.patch U_kdrive-add-options-to-set-default-XKB-properties.patch U_kdrive-don-t-let-evdev-driver-overwrite-existing-dev.patch U_kdrive-evdev-update-keyboard-LEDs-22302.patch U_kdrive-fix-up-NewInputDeviceRequest-implementation.patch U_kdrive-introduce-input-hot-plugging-support-for-udev.patch U_kdrive-set-evdev-driver-for-input-devices-automatica.patch u_os-connections-Check-for-stale-FDs.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xorg-x11-server.spec ++++++ --- /var/tmp/diff_new_pack.SjcKl0/_old 2016-03-07 15:02:53.000000000 +0100 +++ /var/tmp/diff_new_pack.SjcKl0/_new 2016-03-07 15:02:53.000000000 +0100 @@ -183,6 +183,7 @@ Patch206: u_busfault_sigaction-Only-initialize-pointer-when-matched.patch Patch208: u_Panning-Set-panning-state-in-xf86RandR12ScreenSetSize.patch Patch209: u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch +Patch210: u_os-connections-Check-for-stale-FDs.patch Patch1000: n_xserver-optimus-autoconfig-hack.patch @@ -190,6 +191,17 @@ Patch1211: b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch Patch1222: b_sync-fix.patch +Patch1223: U_kdrive-fix-up-NewInputDeviceRequest-implementation.patch +Patch1224: U_kdrive-set-evdev-driver-for-input-devices-automatica.patch +Patch1225: U_ephyr-don-t-load-ephyr-input-driver-if-seat-option-i.patch +Patch1226: U_kdrive-don-t-let-evdev-driver-overwrite-existing-dev.patch +Patch1227: U_ephyr-ignore-Xorg-multiseat-command-line-options.patch +Patch1228: U_ephyr-enable-option-sw-cursor-by-default-in-multi-se.patch +Patch1229: U_kdrive-introduce-input-hot-plugging-support-for-udev.patch +Patch1230: U_kdrive-add-options-to-set-default-XKB-properties.patch +Patch1231: U_kdrive-evdev-update-keyboard-LEDs-22302.patch +Patch1232: U_config-udev-distinguish-between-real-keyboards-and-o.patch + %description This package contains the X.Org Server. @@ -271,7 +283,7 @@ %patch6 -p0 # %patch100 -p1 -%patch101 -p1 +#%patch101 -p1 %patch102 -p1 %patch104 -p1 %patch106 -p1 @@ -288,6 +300,7 @@ %patch206 -p1 %patch208 -p1 %patch209 -p1 +%patch210 -p1 %patch1000 -p1 @@ -298,6 +311,17 @@ ### patch222 might not be applicable anymore #%patch1222 -p1 +%patch1223 -p1 +%patch1224 -p1 +%patch1225 -p1 +%patch1226 -p1 +%patch1227 -p1 +%patch1228 -p1 +%patch1229 -p1 +%patch1230 -p1 +%patch1231 -p1 +%patch1232 -p1 + %build test -e source-file-list || \ find . -type f \! -name '*.orig' \! -path ./source-file-list > \ ++++++ U_config-udev-distinguish-between-real-keyboards-and-o.patch ++++++ >From daa6d2d58f65b9301b1b1f3c6df07719ecb5c03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 12 Feb 2016 14:18:02 -0200 Subject: [PATCH 56/56] config/udev: distinguish between real keyboards and other key devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch introduces a new flag ATTR_KEY for hotplugged input devices, so we can better distinguish between real keyboards (i.e. devices with udev property ID_INPUT_KEYBOARD="1") and other key input devices like lid switches, power buttons, etc. All supported hotplug backends (udev, hal, and wscons) will set both flags ATTR_KEY and ATTR_KEYBOARD for real keyboards, but udev backend will set ATTR_KEY, but not ATTR_KEYBOARD, for non-keyboard key input devices (hal and wscons will set both flags in any case). With this distinction, kdrive input hotplugging mechanism will be allowed to only grab real keyboards, as other key input devices are currently not supported. In order to don't break current behaviour, this patch will replace all ATTR_KEYBOARD occurrences with ATTR_KEY in hw/xfree86/common/xf86Xinput.c. [ajax: Just add ATTR_KEY, don't re-number the other attributes] Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- config/hal.c | 2 +- config/udev.c | 4 ++++ config/wscons.c | 2 +- hw/kdrive/src/kinput.c | 4 +++- hw/xfree86/common/xf86Xinput.c | 2 +- include/input.h | 1 + 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/hal.c b/config/hal.c index ea574ca..c76eced 100644 --- a/config/hal.c +++ b/config/hal.c @@ -170,7 +170,7 @@ device_added(LibHalContext * hal_ctx, const char *udi) free(hal_tags); if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL)) - attrs.flags |= ATTR_KEYBOARD; + attrs.flags |= ATTR_KEY | ATTR_KEYBOARD; if (libhal_device_query_capability(hal_ctx, udi, "input.mouse", NULL)) attrs.flags |= ATTR_POINTER; if (libhal_device_query_capability(hal_ctx, udi, "input.joystick", NULL)) diff --git a/config/udev.c b/config/udev.c index 08a954b..1a6e82a 100644 --- a/config/udev.c +++ b/config/udev.c @@ -240,6 +240,10 @@ device_added(struct udev_device *udev_device) } else if (!strcmp(key, "ID_INPUT_KEY")) { LOG_PROPERTY(path, key, value); + attrs.flags |= ATTR_KEY; + } + else if (!strcmp(key, "ID_INPUT_KEYBOARD")) { + LOG_PROPERTY(path, key, value); attrs.flags |= ATTR_KEYBOARD; } else if (!strcmp(key, "ID_INPUT_MOUSE")) { diff --git a/config/wscons.c b/config/wscons.c index fb114bd..ee45675 100644 --- a/config/wscons.c +++ b/config/wscons.c @@ -163,7 +163,7 @@ wscons_add_keyboard(void) } kbd_config_done: - attrs.flags |= ATTR_KEYBOARD; + attrs.flags |= ATTR_KEY | ATTR_KEYBOARD; rc = NewInputDeviceRequest(input_options, &attrs, &dev); if (rc != Success) goto unwind; diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 836db79..ae19a9d 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -2343,7 +2343,9 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, *pdev = ki->dixdev; } else { - ErrorF("unrecognised device identifier!\n"); + ErrorF("unrecognised device identifier: %s\n", + input_option_get_value(input_option_find(optionsdup, + "device"))); input_option_free_list(&optionsdup); return BadValue; } diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index a9ce62a..4f2e6c8 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -635,7 +635,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev, /* MatchIs* booleans */ if (iclass->is_keyboard.set && - iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEYBOARD)) + iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEY)) return FALSE; if (iclass->is_pointer.set && iclass->is_pointer.val != ! !(attrs->flags & ATTR_POINTER)) diff --git a/include/input.h b/include/input.h index d8bd9c6..9662123 100644 --- a/include/input.h +++ b/include/input.h @@ -236,6 +236,7 @@ typedef struct _InputAttributes { #define ATTR_TABLET (1<<3) #define ATTR_TOUCHPAD (1<<4) #define ATTR_TOUCHSCREEN (1<<5) +#define ATTR_KEY (1<<6) /* Key/Button has been run through all input processing and events sent to clients. */ #define KEY_PROCESSED 1 -- 2.6.2 ++++++ U_ephyr-don-t-load-ephyr-input-driver-if-seat-option-i.patch ++++++ >From da69f2f15a9917c3ed04e305061683c41338126e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 11 Dec 2015 11:43:14 -0200 Subject: [PATCH 04/56] ephyr: don't load ephyr input driver if -seat option is passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When used for single-GPU multi-seat purposes, there's no need to enable ephyr virtual input devices, since Xephyr is supposed to handle its own hardware devices. Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/ephyr/ephyrinit.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 9ddf86e..849a4e1 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -91,29 +91,30 @@ InitInput(int argc, char **argv) KdKeyboardInfo *ki; KdPointerInfo *pi; - KdAddKeyboardDriver(&EphyrKeyboardDriver); #ifdef KDRIVE_EVDEV KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver); -#endif - KdAddPointerDriver(&EphyrMouseDriver); -#ifdef KDRIVE_EVDEV KdAddPointerDriver(&LinuxEvdevMouseDriver); #endif - if (!kdHasKbd) { - ki = KdNewKeyboard(); - if (!ki) - FatalError("Couldn't create Xephyr keyboard\n"); - ki->driver = &EphyrKeyboardDriver; - KdAddKeyboard(ki); - } + if (!SeatId) { + KdAddKeyboardDriver(&EphyrKeyboardDriver); + KdAddPointerDriver(&EphyrMouseDriver); - if (!kdHasPointer) { - pi = KdNewPointer(); - if (!pi) - FatalError("Couldn't create Xephyr pointer\n"); - pi->driver = &EphyrMouseDriver; - KdAddPointer(pi); + if (!kdHasKbd) { + ki = KdNewKeyboard(); + if (!ki) + FatalError("Couldn't create Xephyr keyboard\n"); + ki->driver = &EphyrKeyboardDriver; + KdAddKeyboard(ki); + } + + if (!kdHasPointer) { + pi = KdNewPointer(); + if (!pi) + FatalError("Couldn't create Xephyr pointer\n"); + pi->driver = &EphyrMouseDriver; + KdAddPointer(pi); + } } KdInitInput(); -- 2.6.2 ++++++ U_ephyr-enable-option-sw-cursor-by-default-in-multi-se.patch ++++++ >From 851ff9ec04b73412c7dbad7b4911a1feac21f354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 12 Feb 2016 14:18:01 -0200 Subject: [PATCH 55/56] ephyr: enable option -sw-cursor by default in multi-seat mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Option -seat passed to Xephyr requires -sw-cursor to be passed as well, otherwise the mouse cursor will remain invisible for the given seat. This patch takes care of enabling -sw-cursor if -seat is passed. Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/ephyr/ephyrinit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 849a4e1..149ea98 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -373,6 +373,9 @@ OsVendorInit(void) { EPHYR_DBG("mark"); + if (SeatId) + hostx_use_sw_cursor(); + if (hostx_want_host_cursor()) ephyrFuncs.initCursor = &ephyrCursorInit; -- 2.6.2 ++++++ U_ephyr-ignore-Xorg-multiseat-command-line-options.patch ++++++ >From 7213e99cbc38a60f0076bc2115b144798ea4c3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 11 Dec 2015 11:43:13 -0200 Subject: [PATCH 03/56] ephyr: ignore Xorg multiseat command line options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multi-seat-capable display managers commonly pass command-line options like "-novtswitch", "-sharevts", or "-layout seatXXXX" to Xorg server, but Xephyr currently refuses to start if these options are passed to it, which may break Xephyr-based single-GPU multiseat setups. [ajax: shortened summary] Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/ephyr/ephyrinit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 6b6c4b1..9ddf86e 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -356,6 +356,13 @@ ddxProcessArgument(int argc, char **argv, int i) EphyrWantNoHostGrab = 1; return 1; } + else if (!strcmp(argv[i], "-sharevts") || + !strcmp(argv[i], "-novtswitch")) { + return 1; + } + else if (!strcmp(argv[i], "-layout")) { + return 2; + } return KdProcessArgument(argc, argv, i); } -- 2.6.2 ++++++ U_kdrive-add-options-to-set-default-XKB-properties.patch ++++++ >From 40e32e9fc9f3a1bd8287ee03dd399d8161cb98dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 12 Feb 2016 14:18:00 -0200 Subject: [PATCH 54/56] kdrive: add options to set default XKB properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch introduces convenient command-line options -xkb-rules, -xkb-model, -xkb-layout, -xkb-variant, and -xkb-options, to set default values for these properties. These options can be handful for cases in which compile-time default values don't match user locale, since kdrive doesn't support InputClass matching rules yet and not all Linux distros provide default rules to store these values in udev properties (which by the way is a discouraged practice). Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/src/kdrive.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/kdrive/src/kinput.c | 16 +++++++++++----- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 269b609..52bea5a 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -89,6 +89,11 @@ char *kdSwitchCmd; DDXPointRec kdOrigin; Bool kdHasPointer = FALSE; Bool kdHasKbd = FALSE; +const char *kdGlobalXkbRules = NULL; +const char *kdGlobalXkbModel = NULL; +const char *kdGlobalXkbLayout = NULL; +const char *kdGlobalXkbVariant = NULL; +const char *kdGlobalXkbOptions = NULL; static Bool kdCaughtSignal = FALSE; @@ -455,6 +460,11 @@ KdUseMsg(void) ("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n"); ErrorF ("-keybd driver [,,options] Specify the keyboard driver and its options\n"); + ErrorF("-xkb-rules Set default XkbRules value (can be overriden by -keybd options)\n"); + ErrorF("-xkb-model Set default XkbModel value (can be overriden by -keybd options)\n"); + ErrorF("-xkb-layout Set default XkbLayout value (can be overriden by -keybd options)\n"); + ErrorF("-xkb-variant Set default XkbVariant value (can be overriden by -keybd options)\n"); + ErrorF("-xkb-options Set default XkbOptions value (can be overriden by -keybd options)\n"); ErrorF("-zaphod Disable cursor screen switching\n"); ErrorF("-2button Emulate 3 button mouse\n"); ErrorF("-3button Disable 3 button mouse emulation\n"); @@ -563,6 +573,46 @@ KdProcessArgument(int argc, char **argv, int i) sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) { return 1; } + if (!strcmp(argv[i], "-xkb-rules")) { + if (i + 1 >= argc) { + UseMsg(); + FatalError("Missing argument for option -xkb-rules.\n"); + } + kdGlobalXkbRules = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkb-model")) { + if (i + 1 >= argc) { + UseMsg(); + FatalError("Missing argument for option -xkb-model.\n"); + } + kdGlobalXkbModel = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkb-layout")) { + if (i + 1 >= argc) { + UseMsg(); + FatalError("Missing argument for option -xkb-layout.\n"); + } + kdGlobalXkbLayout = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkb-variant")) { + if (i + 1 >= argc) { + UseMsg(); + FatalError("Missing argument for option -xkb-variant.\n"); + } + kdGlobalXkbVariant = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkb-options")) { + if (i + 1 >= argc) { + UseMsg(); + FatalError("Missing argument for option -xkb-options.\n"); + } + kdGlobalXkbOptions = argv[i + 1]; + return 2; + } if (!strcmp(argv[i], "-mouse") || !strcmp(argv[i], "-pointer")) { if (i + 1 >= argc) UseMsg(); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index fd6a952..836db79 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -102,6 +102,12 @@ static int kdNumInputFds; extern Bool kdRawPointerCoordinates; +extern const char *kdGlobalXkbRules; +extern const char *kdGlobalXkbModel; +extern const char *kdGlobalXkbLayout; +extern const char *kdGlobalXkbVariant; +extern const char *kdGlobalXkbOptions; + static void KdSigio(int sig) { @@ -909,11 +915,11 @@ KdNewKeyboard(void) ki->options = NULL; ki->name = strdup("Generic Keyboard"); ki->path = NULL; - ki->xkbRules = strdup(XKB_DFLT_RULES); - ki->xkbModel = strdup(XKB_DFLT_MODEL); - ki->xkbLayout = strdup(XKB_DFLT_LAYOUT); - ki->xkbVariant = strdup(XKB_DFLT_VARIANT); - ki->xkbOptions = strdup(XKB_DFLT_OPTIONS); + ki->xkbRules = strdup(kdGlobalXkbRules ? kdGlobalXkbRules : XKB_DFLT_RULES); + ki->xkbModel = strdup(kdGlobalXkbModel ? kdGlobalXkbModel : XKB_DFLT_MODEL); + ki->xkbLayout = strdup(kdGlobalXkbLayout ? kdGlobalXkbLayout : XKB_DFLT_LAYOUT); + ki->xkbVariant = strdup(kdGlobalXkbVariant ? kdGlobalXkbVariant :XKB_DFLT_VARIANT); + ki->xkbOptions = strdup(kdGlobalXkbOptions ? kdGlobalXkbOptions : XKB_DFLT_OPTIONS); return ki; } -- 2.6.2 ++++++ U_kdrive-don-t-let-evdev-driver-overwrite-existing-dev.patch ++++++ >From edd443f69ea385a957b8eae0b066ad8e77fb947b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 11 Dec 2015 11:43:11 -0200 Subject: [PATCH 02/56] kdrive: don't let evdev driver overwrite existing device names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KDrive evdev driver deliberately name grabbed devices as "Evdev mouse" or "Evdev keyboard". This patch will make it skip this step if grabbed devices are already named (i.e. from udev). Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/linux/evdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c index 63e8409..cdd45e7 100644 --- a/hw/kdrive/linux/evdev.c +++ b/hw/kdrive/linux/evdev.c @@ -220,7 +220,8 @@ EvdevPtrInit(KdPointerInfo * pi) close(fd); - pi->name = strdup("Evdev mouse"); + if (!pi->name) + pi->name = strdup("Evdev mouse"); return Success; } @@ -390,7 +391,8 @@ EvdevKbdInit(KdKeyboardInfo * ki) close(fd); - ki->name = strdup("Evdev keyboard"); + if (!ki->name) + ki->name = strdup("Evdev keyboard"); readMapping(ki); -- 2.6.2 ++++++ U_kdrive-evdev-update-keyboard-LEDs-22302.patch ++++++ >From 0461bca0cb2f7918c77ed45d2cbc756cf65021be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Mon, 22 Feb 2016 16:04:12 -0300 Subject: [PATCH 17/56] kdrive/evdev: update keyboard LEDs (#22302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement missing parts in kdrive evdev driver for correct update of evdev keyboard LEDs. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=22302 [ajax: Fixed deref-before-null-check bug] Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/linux/evdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c index cdd45e7..8415772 100644 --- a/hw/kdrive/linux/evdev.c +++ b/hw/kdrive/linux/evdev.c @@ -442,10 +442,16 @@ EvdevKbdEnable(KdKeyboardInfo * ki) static void EvdevKbdLeds(KdKeyboardInfo * ki, int leds) { -/* struct input_event event; + struct input_event event; Kevdev *ke; - ki->driverPrivate = ke; + if (!ki) + return; + + ke = ki->driverPrivate; + + if (!ke) + return; memset(&event, 0, sizeof(event)); @@ -468,7 +474,6 @@ EvdevKbdLeds(KdKeyboardInfo * ki, int leds) event.code = LED_COMPOSE; event.value = leds & (1 << 3) ? 1 : 0; write(ke->fd, (char *) &event, sizeof(event)); -*/ } static void -- 2.6.2 ++++++ U_kdrive-fix-up-NewInputDeviceRequest-implementation.patch ++++++ >From 6d6fd688ecf95f2e84f2af276d681ff42f9d5610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 11 Dec 2015 11:43:06 -0200 Subject: [PATCH 01/58] kdrive: fix up NewInputDeviceRequest() implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch simplifies NewInputDeviceRequest() implementation in kinput.c, making use of improved KdParseKbdOptions() / KdParsePointerOptions() and merging several "if (ki)"/"if (pi)" clauses. Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/src/kinput.c | 76 ++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 46 deletions(-) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 1fdaa52..980fd3e 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -1091,6 +1091,8 @@ KdParseKbdOptions(KdKeyboardInfo * ki) ki->xkbOptions = strdup(value); else if (!strcasecmp(key, "device")) ki->path = strdup(value); + else if (!strcasecmp(key, "driver")) + ki->driver = KdFindKeyboardDriver(value); else ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", key, value); @@ -1171,18 +1173,20 @@ KdParsePointerOptions(KdPointerInfo * pi) const char *key = input_option_get_key(option); const char *value = input_option_get_value(option); - if (!strcmp(key, "emulatemiddle")) + if (!strcasecmp(key, "emulatemiddle")) pi->emulateMiddleButton = TRUE; - else if (!strcmp(key, "noemulatemiddle")) + else if (!strcasecmp(key, "noemulatemiddle")) pi->emulateMiddleButton = FALSE; - else if (!strcmp(key, "transformcoord")) + else if (!strcasecmp(key, "transformcoord")) pi->transformCoordinates = TRUE; - else if (!strcmp(key, "rawcoord")) + else if (!strcasecmp(key, "rawcoord")) pi->transformCoordinates = FALSE; else if (!strcasecmp(key, "device")) pi->path = strdup(value); else if (!strcasecmp(key, "protocol")) pi->protocol = strdup(value); + else if (!strcasecmp(key, "driver")) + pi->driver = KdFindPointerDriver(value); else ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", key, value); @@ -2152,68 +2156,48 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, #endif } - if (!ki && !pi) { - ErrorF("unrecognised device identifier!\n"); - return BadValue; - } - - /* FIXME: change this code below to use KdParseKbdOptions and - * KdParsePointerOptions */ - nt_list_for_each_entry(option, options, list.next) { - const char *key = input_option_get_key(option); - const char *value = input_option_get_value(option); + if (pi) { + pi->options = options; + KdParsePointerOptions(pi); - if (strcmp(key, "device") == 0) { - if (pi && value) - pi->path = strdup(value); - else if (ki && value) - ki->path = strdup(value); - } - else if (strcmp(key, "driver") == 0) { - if (pi) { - pi->driver = KdFindPointerDriver(value); - if (!pi->driver) { - ErrorF("couldn't find driver!\n"); - KdFreePointer(pi); - return BadValue; - } - pi->options = options; - } - else if (ki) { - ki->driver = KdFindKeyboardDriver(value); - if (!ki->driver) { - ErrorF("couldn't find driver!\n"); - KdFreeKeyboard(ki); - return BadValue; - } - ki->options = options; - } + if (!pi->driver) { + ErrorF("couldn't find driver!\n"); + KdFreePointer(pi); + return BadValue; } - } - if (pi) { if (KdAddPointer(pi) != Success || ActivateDevice(pi->dixdev, TRUE) != Success || EnableDevice(pi->dixdev, TRUE) != TRUE) { ErrorF("couldn't add or enable pointer\n"); return BadImplementation; } + + *pdev = pi->dixdev; } else if (ki) { + ki->options = options; + KdParseKbdOptions(ki); + + if (!ki->driver) { + ErrorF("couldn't find driver!\n"); + KdFreeKeyboard(ki); + return BadValue; + } + if (KdAddKeyboard(ki) != Success || ActivateDevice(ki->dixdev, TRUE) != Success || EnableDevice(ki->dixdev, TRUE) != TRUE) { ErrorF("couldn't add or enable keyboard\n"); return BadImplementation; } - } - if (pi) { - *pdev = pi->dixdev; - } - else if (ki) { *pdev = ki->dixdev; } + else { + ErrorF("unrecognised device identifier!\n"); + return BadValue; + } return Success; } -- 2.6.2 ++++++ U_kdrive-introduce-input-hot-plugging-support-for-udev.patch ++++++ >From 0cf3d72be6bd99cd2c66b7885339322c7e5bf73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 12 Feb 2016 14:17:59 -0200 Subject: [PATCH 53/56] kdrive: introduce input hot-plugging support for udev and hal backends (#33140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch introduces input hot-plugging support for kdrive-based applications in multi-seat context. This feature is enabled by passing -seat option with desired seat name. All keyboard/mouse devices assigned to that seat will be automatically grabbed by kdrive. It supports udev and hal backends for input hot-plugging support. Another patches may be required for wscons backend. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=33140 Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/src/Makefile.am | 8 +++ hw/kdrive/src/kdrive.c | 46 +++++++++++++ hw/kdrive/src/kinfo.c | 4 ++ hw/kdrive/src/kinput.c | 162 +++++++++++++++++++++++++++++++++++++++------- 4 files changed, 198 insertions(+), 22 deletions(-) diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am index d69f0dd..b7f94b0 100644 --- a/hw/kdrive/src/Makefile.am +++ b/hw/kdrive/src/Makefile.am @@ -23,3 +23,11 @@ libkdrive_la_SOURCES = \ kshadow.c \ $(KDRIVE_XV_SOURCES) \ $(top_srcdir)/mi/miinitext.c + +if CONFIG_UDEV +libkdrive_la_LIBADD = $(top_builddir)/config/libconfig.la +else +if CONFIG_HAL +libkdrive_la_LIBADD = $(top_builddir)/config/libconfig.la +endif +endif diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 582ff66..269b609 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -45,6 +45,14 @@ #include <signal.h> +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) +#include <hotplug.h> +#endif + +/* This stub can be safely removed once we can + * split input and GPU parts in hotplug.h et al. */ +#include <systemd-logind.h> + typedef struct _kdDepths { CARD8 depth; CARD8 bpp; @@ -1125,6 +1133,11 @@ KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) KdAddScreen(pScreenInfo, screen, argc, argv); OsRegisterSigWrapper(KdSignalWrapper); + +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + if (SeatId) /* Enable input hot-plugging */ + config_pre_init(); +#endif } void @@ -1143,3 +1156,36 @@ DPMSSupported(void) { return FALSE; } + +/* These stubs can be safely removed once we can + * split input and GPU parts in hotplug.h et al. */ +#ifdef CONFIG_UDEV_KMS +void +NewGPUDeviceRequest(struct OdevAttributes *attribs) +{ +} + +void +DeleteGPUDeviceRequest(struct OdevAttributes *attribs) +{ +} +#endif + +struct xf86_platform_device * +xf86_find_platform_device_by_devnum(int major, int minor) +{ + return NULL; +} + +#ifdef SYSTEMD_LOGIND +void +systemd_logind_vtenter(void) +{ +} + +void +systemd_logind_release_fd(int major, int minor, int fd) +{ + close(fd); +} +#endif diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c index 01ae1e4..f91d575 100644 --- a/hw/kdrive/src/kinfo.c +++ b/hw/kdrive/src/kinfo.c @@ -134,6 +134,7 @@ KdFreePointer(KdPointerInfo * pi) free(pi->name); free(pi->path); input_option_free_list(&pi->options); + pi->next = NULL; free(pi); } @@ -145,6 +146,9 @@ KdFreeKeyboard(KdKeyboardInfo * ki) free(ki->xkbRules); free(ki->xkbModel); free(ki->xkbLayout); + free(ki->xkbVariant); + free(ki->xkbOptions); + input_option_free_list(&ki->options); ki->next = NULL; free(ki); } diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 3a1c6a0..fd6a952 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -51,6 +51,10 @@ #include "inpututils.h" #include "optionstr.h" +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) +#include <hotplug.h> +#endif + #ifdef KDRIVE_EVDEV #define DEV_INPUT_EVENT_PREFIX "/dev/input/event" #define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1) @@ -407,7 +411,8 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff) #endif if (!pi->driver) { if (!pi->driverPrivate) { - ErrorF("no driver specified for %s\n", pi->name); + ErrorF("no driver specified for pointer device \"%s\" (%s)\n", + pi->name ? pi->name : "(unnamed)", pi->path); return BadImplementation; } @@ -727,7 +732,8 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff) #endif if (!ki->driver) { if (!ki->driverPrivate) { - ErrorF("no driver specified!\n"); + ErrorF("no driver specified for keyboard device \"%s\" (%s)\n", + ki->name ? ki->name : "(unnamed)", ki->path); return BadImplementation; } @@ -901,6 +907,8 @@ KdNewKeyboard(void) ki->bellDuration = 200; ki->next = NULL; ki->options = NULL; + ki->name = strdup("Generic Keyboard"); + ki->path = NULL; ki->xkbRules = strdup(XKB_DFLT_RULES); ki->xkbModel = strdup(XKB_DFLT_MODEL); ki->xkbLayout = strdup(XKB_DFLT_LAYOUT); @@ -1084,18 +1092,52 @@ KdParseKbdOptions(KdKeyboardInfo * ki) const char *key = input_option_get_key(option); const char *value = input_option_get_value(option); - if (strcasecmp(key, "XkbRules") == 0) + if ( +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + strcasecmp(key, "xkb_rules") == 0 || +#endif + strcasecmp(key, "XkbRules") == 0) ki->xkbRules = strdup(value); - else if (strcasecmp(key, "XkbModel") == 0) + else if ( +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + strcasecmp(key, "xkb_model") == 0 || +#endif + strcasecmp(key, "XkbModel") == 0) ki->xkbModel = strdup(value); - else if (strcasecmp(key, "XkbLayout") == 0) + else if ( +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + strcasecmp(key, "xkb_layout") == 0 || +#endif + strcasecmp(key, "XkbLayout") == 0) ki->xkbLayout = strdup(value); - else if (strcasecmp(key, "XkbVariant") == 0) + else if ( +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + strcasecmp(key, "xkb_variant") == 0 || +#endif + strcasecmp(key, "XkbVariant") == 0) ki->xkbVariant = strdup(value); - else if (strcasecmp(key, "XkbOptions") == 0) + else if ( +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + strcasecmp(key, "xkb_options") == 0 || +#endif + strcasecmp(key, "XkbOptions") == 0) ki->xkbOptions = strdup(value); - else if (!strcasecmp(key, "device")) + else if (!strcasecmp(key, "device")) { + if (ki->path != NULL) + free(ki->path); ki->path = strdup(value); + } +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + else if (!strcasecmp(key, "path")) { + if (ki->path != NULL) + free(ki->path); + ki->path = strdup(value); + } + else if (!strcasecmp(key, "name")) { + free(ki->name); + ki->name = strdup(value); + } +#endif else if (!strcasecmp(key, "driver")) ki->driver = KdFindKeyboardDriver(value); else @@ -1196,8 +1238,22 @@ KdParsePointerOptions(KdPointerInfo * pi) pi->transformCoordinates = TRUE; else if (!strcasecmp(key, "rawcoord")) pi->transformCoordinates = FALSE; - else if (!strcasecmp(key, "device")) + else if (!strcasecmp(key, "device")) { + if (pi->path != NULL) + free(pi->path); + pi->path = strdup(value); + } +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + else if (!strcasecmp(key, "path")) { + if (pi->path != NULL) + free(pi->path); pi->path = strdup(value); + } + else if (!strcasecmp(key, "name")) { + free(pi->name); + pi->name = strdup(value); + } +#endif else if (!strcasecmp(key, "protocol")) pi->protocol = strdup(value); else if (!strcasecmp(key, "driver")) @@ -1320,11 +1376,21 @@ KdInitInput(void) } mieqInit(); + +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + if (SeatId) /* Enable input hot-plugging */ + config_init(); +#endif } void KdCloseInput(void) { +#if defined(CONFIG_UDEV) || defined(CONFIG_HAL) + if (SeatId) /* Input hot-plugging is enabled */ + config_fini(); +#endif + mieqFini(); } @@ -2141,24 +2207,29 @@ int NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, DeviceIntPtr *pdev) { - InputOption *option = NULL; + InputOption *option = NULL, *optionsdup = NULL; KdPointerInfo *pi = NULL; KdKeyboardInfo *ki = NULL; nt_list_for_each_entry(option, options, list.next) { const char *key = input_option_get_key(option); const char *value = input_option_get_value(option); + optionsdup = input_option_new(optionsdup, key, value); if (strcmp(key, "type") == 0) { if (strcmp(value, "pointer") == 0) { pi = KdNewPointer(); - if (!pi) + if (!pi) { + input_option_free_list(&optionsdup); return BadAlloc; + } } else if (strcmp(value, "keyboard") == 0) { ki = KdNewKeyboard(); - if (!ki) + if (!ki) { + input_option_free_list(&optionsdup); return BadAlloc; + } } else { ErrorF("unrecognised device type!\n"); @@ -2168,25 +2239,66 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, #ifdef CONFIG_HAL else if (strcmp(key, "_source") == 0 && strcmp(value, "server/hal") == 0) { - ErrorF("Ignoring device from HAL.\n"); - return BadValue; + if (SeatId) { + /* Input hot-plugging is enabled */ + if (attrs->flags & ATTR_POINTER) { + pi = KdNewPointer(); + if (!pi) { + input_option_free_list(&optionsdup); + return BadAlloc; + } + } + else if (attrs->flags & ATTR_KEYBOARD) { + ki = KdNewKeyboard(); + if (!ki) { + input_option_free_list(&optionsdup); + return BadAlloc; + } + } + } + else { + ErrorF("Ignoring device from HAL.\n"); + input_option_free_list(&optionsdup); + return BadValue; + } } #endif #ifdef CONFIG_UDEV else if (strcmp(key, "_source") == 0 && strcmp(value, "server/udev") == 0) { - ErrorF("Ignoring device from udev.\n"); - return BadValue; + if (SeatId) { + /* Input hot-plugging is enabled */ + if (attrs->flags & ATTR_POINTER) { + pi = KdNewPointer(); + if (!pi) { + input_option_free_list(&optionsdup); + return BadAlloc; + } + } + else if (attrs->flags & ATTR_KEYBOARD) { + ki = KdNewKeyboard(); + if (!ki) { + input_option_free_list(&optionsdup); + return BadAlloc; + } + } + } + else { + ErrorF("Ignoring device from udev.\n"); + input_option_free_list(&optionsdup); + return BadValue; + } } #endif } if (pi) { - pi->options = options; + pi->options = optionsdup; KdParsePointerOptions(pi); if (!pi->driver) { - ErrorF("couldn't find driver!\n"); + ErrorF("couldn't find driver for pointer device \"%s\" (%s)\n", + pi->name ? pi->name : "(unnamed)", pi->path); KdFreePointer(pi); return BadValue; } @@ -2194,18 +2306,21 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, if (KdAddPointer(pi) != Success || ActivateDevice(pi->dixdev, TRUE) != Success || EnableDevice(pi->dixdev, TRUE) != TRUE) { - ErrorF("couldn't add or enable pointer\n"); + ErrorF("couldn't add or enable pointer \"%s\" (%s)\n", + pi->name ? pi->name : "(unnamed)", pi->path); + KdFreePointer(pi); return BadImplementation; } *pdev = pi->dixdev; } else if (ki) { - ki->options = options; + ki->options = optionsdup; KdParseKbdOptions(ki); if (!ki->driver) { - ErrorF("couldn't find driver!\n"); + ErrorF("couldn't find driver for keyboard device \"%s\" (%s)\n", + ki->name ? ki->name : "(unnamed)", ki->path); KdFreeKeyboard(ki); return BadValue; } @@ -2213,7 +2328,9 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, if (KdAddKeyboard(ki) != Success || ActivateDevice(ki->dixdev, TRUE) != Success || EnableDevice(ki->dixdev, TRUE) != TRUE) { - ErrorF("couldn't add or enable keyboard\n"); + ErrorF("couldn't add or enable keyboard \"%s\" (%s)\n", + ki->name ? ki->name : "(unnamed)", ki->path); + KdFreeKeyboard(ki); return BadImplementation; } @@ -2221,6 +2338,7 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, } else { ErrorF("unrecognised device identifier!\n"); + input_option_free_list(&optionsdup); return BadValue; } -- 2.6.2 ++++++ U_kdrive-set-evdev-driver-for-input-devices-automatica.patch ++++++ >From 0b80da0d18713df4712c05973388b6226bb0227f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <[email protected]> Date: Fri, 11 Dec 2015 11:43:07 -0200 Subject: [PATCH 01/56] kdrive: set "evdev" driver for input devices automatically, if available. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If kdrive input driver "evdev" is available, no other driver was explicitly set for a given input device, and its kernel device node is /dev/input/event*, this patch will make kdrive set "evdev" driver automatically for such device. Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Laércio de Sousa <[email protected]> --- hw/kdrive/src/kinput.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 980fd3e..3a1c6a0 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -51,6 +51,11 @@ #include "inpututils.h" #include "optionstr.h" +#ifdef KDRIVE_EVDEV +#define DEV_INPUT_EVENT_PREFIX "/dev/input/event" +#define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1) +#endif + #define AtomFromName(x) MakeAtom(x, strlen(x), 1) struct KdConfigDevice { @@ -1097,6 +1102,16 @@ KdParseKbdOptions(KdKeyboardInfo * ki) ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", key, value); } + +#ifdef KDRIVE_EVDEV + if (!ki->driver && ki->path != NULL && + strncasecmp(ki->path, + DEV_INPUT_EVENT_PREFIX, + DEV_INPUT_EVENT_PREFIX_LEN) == 0) { + ki->driver = KdFindKeyboardDriver("evdev"); + ki->options = input_option_new(ki->options, "driver", "evdev"); + } +#endif } KdKeyboardInfo * @@ -1191,6 +1206,16 @@ KdParsePointerOptions(KdPointerInfo * pi) ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", key, value); } + +#ifdef KDRIVE_EVDEV + if (!pi->driver && pi->path != NULL && + strncasecmp(pi->path, + DEV_INPUT_EVENT_PREFIX, + DEV_INPUT_EVENT_PREFIX_LEN) == 0) { + pi->driver = KdFindPointerDriver("evdev"); + pi->options = input_option_new(pi->options, "driver", "evdev"); + } +#endif } KdPointerInfo * -- 2.6.2 ++++++ u_os-connections-Check-for-stale-FDs.patch ++++++ From: Egbert Eich <[email protected]> Date: Fri Jan 29 11:05:46 2016 +0100 Subject: [PATCH]os/connections: Check for stale FDs Patch-mainline: to be upstreamed Git-repo: git://anongit.freedesktop.org/git/xorg/xserver References: bsc#954433 Signed-off-by: Egbert Eich <[email protected]> So far we've only checked for stale client connections. However, our main select loop checks file descriptors of devices and sockets of services like dbus. These file descriptors may become stale as well, for instance, when the underlying service has died. In this case, select will return immediately with EBADF. Without removing these stale FDs, the Xserver will loop rapidly in WaitFor(). Thus, simply remove the respective bit from AllSockets. Signed-off-by: Egbert Eich <[email protected]> --- include/os.h | 3 +++ os/WaitFor.c | 5 +++++ os/connection.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/include/os.h b/include/os.h index 461d5d6..a3e433c 100644 --- a/include/os.h +++ b/include/os.h @@ -51,6 +51,7 @@ SOFTWARE. #include <stdarg.h> #include <stdint.h> #include <string.h> +#include <sys/select.h> #define SCREEN_SAVER_ON 0 #define SCREEN_SAVER_OFF 1 @@ -141,6 +142,8 @@ extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ , extern _X_EXPORT void CheckConnections(void); +extern _X_EXPORT void CheckFDs(fd_set *); + extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ ); extern _X_EXPORT void AddGeneralSocket(int /*fd */ ); diff --git a/os/WaitFor.c b/os/WaitFor.c index e839d61..6cc967e 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -229,7 +229,12 @@ WaitForSomething(int *pClientsReady) return 0; if (i < 0) { if (selecterr == EBADF) { /* Some client disconnected */ + fd_set mask; + XFD_COPYSET(&LastSelectMask, &mask); + XFD_UNSET(&mask, &AllClients); CheckConnections(); + if (XFD_ANYSET(&mask)) + CheckFDs(&mask); if (!XFD_ANYSET(&AllClients)) return 0; } diff --git a/os/connection.c b/os/connection.c index 4c1ba4b..d6943f2 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1022,6 +1022,43 @@ CheckConnections(void) } /***************** + * CheckFDs + *****************/ +void +CheckFDs(fd_set *fdbits) +{ + fd_mask mask; + fd_set tmask; + int curbit, curoff; + int i; + struct timeval notime; + int r; + notime.tv_sec = 0; + notime.tv_usec = 0; + + for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) { + mask = fdbits->fds_bits[i]; + while (mask) { + curoff = mffs(mask) - 1; + curbit = curoff + (i * (sizeof(fd_mask) * 8)); + FD_ZERO(&tmask); + FD_SET(curbit, &tmask); + do { + r = Select(curbit + 1, &tmask, NULL, NULL, ¬ime); + } while (r < 0 && (errno == EINTR || errno == EAGAIN)); + if (r < 0 && errno == EBADF) { + //RemoveNotifyFd(curbit); + FD_CLR(curbit, &EnabledDevices); + FD_CLR(curbit, &AllSockets); + if (GrabInProgress) + FD_CLR(curbit, &SavedAllSockets); + } + mask &= ~((fd_mask) 1 << curoff); + } + } +} + +/***************** * CloseDownConnection * Delete client from AllClients and free resources *****************/
