ChangeLog | 338 +++++++++++++++++++ Xext/sync.c | 7 Xi/exevents.c | 22 + Xi/xichangehierarchy.c | 4 Xi/xipassivegrab.c | 6 config/hal.c | 16 config/udev.c | 15 configure.ac | 6 debian/changelog | 22 + debian/control | 4 debian/patches/02_kbsd-input-devd.diff | 551 ++++++++++++++++++++++++++++++++ debian/patches/series | 1 debian/rules | 10 dix/devices.c | 1 dix/dixfonts.c | 9 dix/getevents.c | 2 dix/inpututils.c | 3 hw/xfree86/common/xf86Helper.c | 7 hw/xquartz/GL/indirect.c | 4 hw/xquartz/X11Application.m | 13 hw/xquartz/X11Controller.m | 2 hw/xquartz/applewm.c | 16 hw/xquartz/darwinfb.h | 2 hw/xquartz/mach-startup/stub.c | 4 hw/xquartz/quartz.c | 3 hw/xquartz/xpr/appledri.c | 10 hw/xquartz/xpr/x-hook.c | 27 - os/utils.c | 27 + test/xi2/protocol-xipassivegrabdevice.c | 9 29 files changed, 1080 insertions(+), 61 deletions(-)
New commits: commit ba11fa8a18828b5fda0b75fa63e616b5e89eda5c Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Wed Apr 9 15:36:09 2014 +0200 Merge rc1 from released debian unstable. diff --git a/debian/changelog b/debian/changelog index ab7ac06..e4fcd31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xorg-server (2:1.15.0.901-1ubuntu1) UNRELEASED; urgency=low + + * Merge rc1 from released debian unstable. + + -- Maarten Lankhorst <maarten.lankho...@ubuntu.com> Wed, 09 Apr 2014 15:31:23 +0200 + xorg-server (2:1.15.0.901-1) unstable; urgency=medium [ Robert Millan ] commit 97e46f6721051789d490859a30f77c3c562e3af3 Author: Julien Cristau <jcris...@debian.org> Date: Mon Mar 31 12:21:00 2014 +0200 Upload to unstable diff --git a/debian/changelog b/debian/changelog index 84b4a26..95966e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -xorg-server (2:1.15.0.901-1) UNRELEASED; urgency=medium +xorg-server (2:1.15.0.901-1) unstable; urgency=medium [ Robert Millan ] * Add devd input backend for kFreeBSD, and use it instead of hal (closes: @@ -7,7 +7,7 @@ xorg-server (2:1.15.0.901-1) UNRELEASED; urgency=medium [ Julien Cristau ] * New upstream release - -- Julien Cristau <jcris...@debian.org> Mon, 31 Mar 2014 12:12:51 +0200 + -- Julien Cristau <jcris...@debian.org> Mon, 31 Mar 2014 12:19:57 +0200 xorg-server (2:1.15.0-2) unstable; urgency=medium commit b1e1771a10240d14c92ae61542a3032e6bd2b817 Author: Julien Cristau <jcris...@debian.org> Date: Mon Mar 31 12:16:31 2014 +0200 Bump changelogs to 1.15.0.901 diff --git a/ChangeLog b/ChangeLog index 109ce8c..1ff4f4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,341 @@ +commit 300458fb8ad0a7957e941cd65f47d204c7886e22 +Author: Matt Dew <mar...@osource.org> +Date: Fri Mar 21 23:49:41 2014 -0600 + + Bump bersion to 1.15.0.901 + +commit c971864565eb114e4b34f17b0d2244e8e6e1e005 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Wed Feb 26 07:54:56 2014 +1000 + + config: search for PnPID on all parents (#75513) + + The PnPID for a device may not be on the immediate parent, so search up the + device tree until we find one. + + X.Org Bug 75513 <http://bugs.freedesktop.org/show_bug.cgi?id=75513> + + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Tested-by: Benjamin Tissoires <benjamin.tissoi...@gmail.com> + (cherry picked from commit 795066477ee81b5b82e490eac8bed6b656d01f17) + +commit 2cbbe80efc485d2d05b06efe1e2e01f81f3e06f6 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Thu Feb 20 13:18:05 2014 +1000 + + Xi: check for invalid modifiers for XI2 passive grabs + + The other values are checked correctly, but if a modifier was outside the + allowed range, it would go unnoticed and cause a out-of-bounds read error for + any mask equal or larger than 256. The DetailRec where we store the grab masks + is only sized to 8 * sizeof(Mask). + + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Reviewed-by: Alan Coopersmith <alan.coopersm...@oracle.com> + (cherry picked from commit 0f10cfd4b903d4db293ec47c8a9a0d8b33965803) + +commit b3656c0b52d57333c64f932676a237d0f3a97f36 +Author: Mark Kettenis <kette...@openbsd.org> +Date: Sun Dec 15 14:31:10 2013 +0100 + + sync: Avoid ridiculously long timeouts + + On OpenBSD, passing a timeout longer than 100000000 seconds to select(2) will + make it fail with EINVAL. As this is original 4.4BSD behaviour it is not + inconceivable that other systems suffer from the same problem. And Linux, + though not suffering from any 4.4BSD heritage, briefly did something similar: + + <https://lkml.org/lkml/2012/8/31/263> + + So avoid calling AdjustWaitForDelay() instead of setting the timeout to + (effectively) ULONG_MAX milliseconds. + + Signed-off-by: Mark Kettenis <kette...@openbsd.org> + Reviewed-by: Matthieu Herrb <matth...@herrb.eu> + (cherry picked from commit ddeca927498c9df3b5e62c7bf05e31e2a3aeaa52) + +commit b332cd20ee14049606e3656490d13a8efa6b23ee +Merge: f41ab8c 5e0432f +Author: Matt Dew <mar...@osource.org> +Date: Thu Mar 6 22:03:03 2014 -0700 + + Merge branch 'server-1.15-branch' of git://people.freedesktop.org/~jeremyhu/xserver into server-1.15-branch + +commit f41ab8c60780ea8f87354e536e5b73cb23878eb7 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Fri Jan 24 18:32:54 2014 +1000 + + dix: prevent a driver from initializing or submitting buttons > MAX_BUTTONS + + The server internally relies on arrays with a MAX_BUTTONS maximum size (which + is the max the core protocol can transport). Make sure a driver adheres to + that. + + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Reviewed-by: Daniel Stone <dan...@fooishbar.org> + (cherry picked from commit 87ca80a7196949597113225405f3e4ee03bbee13) + +commit 4447d71b9a74afe91aaf4cc01eae12a44ef09306 +Author: Alan Coopersmith <alan.coopersm...@oracle.com> +Date: Tue Jan 28 20:27:51 2014 -0800 + + xf86DeleteScreen: move check for NULL pScrn before first dereference + + Flagged by cppcheck 1.62: + [hw/xfree86/common/xf86Helper.c:220] -> [hw/xfree86/common/xf86Helper.c:231]: + (warning) Possible null pointer dereference: pScrn - otherwise it is + redundant to check it against null. + + Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> + Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> + Signed-off-by: Keith Packard <kei...@keithp.com> + (cherry picked from commit c1ac89c793614797e08d3d8e7fc9ba55be899130) + +commit 2ac840a14958fe74170518ee2c3a6b2dd88b20bd +Author: Alan Coopersmith <alan.coopersm...@oracle.com> +Date: Tue Jan 28 20:27:50 2014 -0800 + + On realloc failure, free font_path_string instead of leaking it + + Flagged by cppcheck 1.62: + [dix/dixfonts.c:1792]: (error) Common realloc mistake: + 'font_path_string' nulled but not freed upon failure + + Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> + Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> + Signed-off-by: Keith Packard <kei...@keithp.com> + (cherry picked from commit e6733ae91b7be52930f22a87de15fa05819ef948) + +commit 157cc02fc13c998bba70e1652907972015e15e8e +Author: Alan Coopersmith <alan.coopersm...@oracle.com> +Date: Fri Jan 24 23:42:49 2014 -0800 + + Check for calloc() failure in add_master() + + Reported-by: Ilja Van Sprundel <ivansprun...@ioactive.com> + Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> + Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + (cherry picked from commit 9fc19168e7ca6308275bf8769d1ccb982f88465b) + +commit f11c5938d732af717aeebbbf3b356138f3411bb7 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Fri Jan 24 16:51:02 2014 +1000 + + Xi: fix modifier offset in XIPassiveGrab swapping function + + The request is followed by mask_len 4-byte units, then followed by the actual + modifiers. + + Also fix up the swapping test, which had the same issue. + + Reported-by: Alan Coopersmith <alan.coopersm...@oracle.com> + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Reviewed-by: Alan Coopersmith <alan.coopersm...@oracle.com> + (cherry picked from commit 76b3be75b62657e346731444736f7e4d200beb5b) + + Conflicts: + test/xi2/protocol-xipassivegrabdevice.c + +commit 345b7ead1dd262020e10b4aeb71044d46d16e134 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Mon Jan 13 17:00:23 2014 +1000 + + os: restrict display names to digits + + We call atoi() on the server's display to get the socket but otherwise use the + unmodified display for log file name, xkb paths, etc. This results in + Xorg :banana being the equivalent of Xorg :0, except for the log files being + in /var/log/Xorg.banana.log. I'm not sure there's a good use-case for this + behaviour. + + Check the display for something that looks reasonable, i.e. digits only, but + do allow for :0.0 (i.e. digits, followed by a period, followed by one or two + digits). + + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Reviewed-by: Keith Packard <kei...@keithp.com> + (cherry picked from commit 71baa466b1f6b02fe503f9a3089b7b9d61aa0f80) + +commit 940d6a8e9d3544696654d5e68c615ab887f81945 +Author: Carlos Garnacho <carl...@gnome.org> +Date: Thu Jan 2 21:33:30 2014 +0100 + + Xi: Ensure DeviceChanged is emitted after grabs are deactivated + + When a grab on a slave device is deactivated, the master device must + be checked, just in case there were events from other devices while + the slave device was stolen away by the passive grab. This may + introduce misbehaviors on mismatching valuators and device features + later on UpdateDeviceState(). + + Signed-off-by: Carlos Garnacho <carl...@gnome.org> + Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + (cherry picked from commit b2d5ee2e3684951b611fd2068d57cc65fd8305a3) + +commit 47da6e3f47a55aeeef2c849067dd2d09fc2fe481 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Fri Jan 24 18:16:54 2014 +1000 + + dix: fix button state check before changing a button mapping + + dev->button->down is a bitmask, not a normal array. Use the helper function to + check, we technically allow the mapping to change after the physical button + has been pressed (but not yet processed yet), so only check BUTTON_PROCESSED. + + From XSetPointerMapping(3): + "If any of the buttons to be altered are logically in the down state, + XSetPointerMapping returns MappingBusy, and the mapping is not changed." + + Reported-by: Ilja Van Sprundel <ivansprun...@ioactive.com> + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Reviewed-by: Daniel Stone <dan...@fooishbar.org> + (cherry picked from commit 25d10464f440b8b34594b7c988a99a830ea39a29) + +commit 5e0432f797d58fe1a69ef538694f65bbba38737f +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Wed Jan 1 11:10:41 2014 -0800 + + XQuartz: Avoid passing uninitialized pointers to X11ApplicationSetWindowMenu in AppleWMSetWindowMenu + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit 77df653ae3d8448be21221711851acde12c6bc1a) + +commit 859ced56d9ee168796c2fcf7fa6056e0c1491f3a +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Wed Jan 1 11:04:07 2014 -0800 + + XQuartz: Check for allocated memory before using it in AppleWMSetWindowMenu + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit 3bc608a361a01043b226fb9aaebf88f6fd852925) + +commit 9444955d16f85926c75ee8eafb0ca796dcf16439 +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Wed Jan 1 11:00:40 2014 -0800 + + XQuartz: Silence a clang static analysis warning about a memory leak + + It seems the alanyzer can't comprehend dixSetPrivate(). + + quartz.c:119:12: warning: Potential leak of memory pointed to by 'displayInfo' + return quartzProcs->AddScreen(index, pScreen); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit 64327226ddfba8f0653615cd678d2d4336fb993d) + +commit 64b0669d1c062e7e11fb0e3b8ea7fe56113fc86f +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Wed Jan 1 10:55:10 2014 -0800 + + XQuartz: Silence a clang static analysis warning about a possible memory leak on exit + + stub.c:356:9: warning: Potential leak of memory pointed to by 'newargv' + asl_log(aslc, NULL, ASL_LEVEL_ERR, + ^~~~~~~ + stub.c:356:9: warning: Potential leak of memory pointed to by 'newenvp' + asl_log(aslc, NULL, ASL_LEVEL_ERR, + ^~~~~~~ + 2 warnings generated. + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit b2f6b3497c33a4897afae80a2cf69c596b9f81e8) + +commit 472e8e5d1c26573cef4bd42451230ef47791ed6f +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Wed Jan 1 10:47:52 2014 -0800 + + XQuartz: Validate length in appledri before swapping + + Avoids potential memory corruption from bad requests + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit a03f096a85537d9e881cedaa6cb71aca43a97086) + +commit 782fe5c174def75a9e4cb188c00c2fec72821472 +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Wed Jan 1 10:39:56 2014 -0800 + + XQuartz: Validate screen in AppleDRIQueryDirectRenderingCapable requests + + Return an error to the caller rather than crashing the server on + invalid screens. + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit b3572c0d1ab7888ac26d6b2b8be6d1d19ed9af3f) + +commit 045122566c0532378b50c1af3ffec3254e416fe2 +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Sun Dec 29 12:45:23 2013 -0800 + + XQuartz: Simplify hook_run to quiet static analyzer + + x-hook.c:96:9: warning: Called function pointer is an uninitalized pointer value + (*fun[i])(arg, data[i]); + ^~~~~~~~~~~~~~~~~~~~~~~ + 1 warning generated. + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit 959e8f23af7850fcaf40d6c67f5228241a36a9ab) + +commit 33b2ae0f3b4a80fd962d876f7437d98fcfc27791 +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Sun Dec 29 12:41:18 2013 -0800 + + XQuartz: Mark applicationWillTerminate: noreturn + + X11Controller.m:938:1: warning: method 'applicationWillTerminate:' could be declared with attribute 'noreturn' + [-Wmissing-noreturn,Semantic Issue] + { + ^ + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit f79af1941776fd6f1ec26c50603fcc35ca7d514b) + +commit 404f26866147be1c26585e59d9795e87e0c3e5fa +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Sun Dec 29 12:36:51 2013 -0800 + + XQuartz: Fix get_proc_address signature + + indirect.c:675:28: warning: incompatible pointer types passing 'glx_gpa_proc (*)(const char *)' to parameter of type + 'glx_gpa_proc' (aka 'glx_func_ptr (*)(const char *)') [-Wincompatible-pointer-types,Semantic Issue] + __glXsetGetProcAddress(&get_proc_address); + ^~~~~~~~~~~~~~~~~ + ../../../glx/glxserver.h:122:42: note: passing argument to parameter 'get_proc_address' here [Semantic Issue] + void __glXsetGetProcAddress(glx_gpa_proc get_proc_address); + ^ + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit ea80279e292e59a9fe9651489f03e9f2f39810d9) + +commit 7803c4075b824ece79af0425cee736025c41d901 +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Sun Dec 29 12:31:23 2013 -0800 + + XQuartz: Fix darwinfb.h header guard + + ./darwinfb.h:28:9: warning: '_DARWIN_FB_H' is used as a header guard here, followed by #define of a different macro + [-Wheader-guard,Lexical or Preprocessor Issue] + ^~~~~~~~~~~~ + ./darwinfb.h:29:9: note: '_DARWIN_DB_H' is defined here; did you mean '_DARWIN_FB_H'? [Lexical or Preprocessor Issue] + ^~~~~~~~~~~~ + _DARWIN_FB_H + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit 2e3ebec9520719a8e5c3c92390e83bcb5216f978) + +commit 6c055f0d78349ff08a570c5dcc92c6f7b6924993 +Author: Jeremy Huddleston Sequoia <jerem...@apple.com> +Date: Sun Dec 29 12:22:55 2013 -0800 + + XQuartz: Silence some static analyzer warnings by annotating referencing counts + + Signed-off-by: Jeremy Huddleston Sequoia <jerem...@apple.com> + (cherry picked from commit 9da6c0918f40359f28fe8889d5b7cae7efcc8377) + commit 2ea973e12f5d954211e1d10085a4c74581b43aca Author: Keith Packard <kei...@keithp.com> Date: Fri Dec 27 09:50:55 2013 -0800 diff --git a/debian/changelog b/debian/changelog index 0ac45c4..84b4a26 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,13 @@ -xorg-server (2:1.15.0-3) UNRELEASED; urgency=medium +xorg-server (2:1.15.0.901-1) UNRELEASED; urgency=medium [ Robert Millan ] * Add devd input backend for kFreeBSD, and use it instead of hal (closes: #736765, #710196, #683833) - -- Julien Cristau <jcris...@debian.org> Sun, 16 Mar 2014 13:54:27 +0100 + [ Julien Cristau ] + * New upstream release + + -- Julien Cristau <jcris...@debian.org> Mon, 31 Mar 2014 12:12:51 +0200 xorg-server (2:1.15.0-2) unstable; urgency=medium commit 300458fb8ad0a7957e941cd65f47d204c7886e22 Author: Matt Dew <mar...@osource.org> Date: Fri Mar 21 23:49:41 2014 -0600 Bump bersion to 1.15.0.901 diff --git a/configure.ac b/configure.ac index 8f82386..abd4604 100644 --- a/configure.ac +++ b/configure.ac @@ -26,9 +26,9 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.15.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="2013-12-27" -RELEASE_NAME="Egg Nog" +AC_INIT([xorg-server], 1.15.0.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2014-03-21" +RELEASE_NAME="Heart Candy-rc1" AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AC_USE_SYSTEM_EXTENSIONS commit bce647e4622ec2527592e4e98ddd1527d91bc3c5 Author: Robert Millan <r...@debian.org> Date: Sun Mar 16 13:57:57 2014 +0100 Add devd input backend for kFreeBSD, and use it instead of hal Closes: #736765, #710196, #683833 diff --git a/debian/changelog b/debian/changelog index 1d372ef..0ac45c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +xorg-server (2:1.15.0-3) UNRELEASED; urgency=medium + + [ Robert Millan ] + * Add devd input backend for kFreeBSD, and use it instead of hal (closes: + #736765, #710196, #683833) + + -- Julien Cristau <jcris...@debian.org> Sun, 16 Mar 2014 13:54:27 +0100 + xorg-server (2:1.15.0-2) unstable; urgency=medium [ Julien Cristau ] diff --git a/debian/control b/debian/control index aaad746..a18ea62 100644 --- a/debian/control +++ b/debian/control @@ -45,8 +45,6 @@ Build-Depends: libpciaccess-dev (>= 0.12.901), libgcrypt-dev, nettle-dev, - libdbus-1-dev [kfreebsd-any], - libhal-dev [kfreebsd-any], libudev-dev (>= 151-3) [linux-any], libselinux1-dev (>= 2.0.80) [linux-any], libaudit-dev [linux-any], @@ -97,6 +95,7 @@ Depends: xserver-common (>= ${source:Version}), keyboard-configuration [linux-any kfreebsd-any], udev (>= 149) [linux-any], + devd [kfreebsd-any], ${shlibs:Depends}, ${misc:Depends}, Recommends: libgl1-mesa-dri (>= 7.10.2-4) @@ -157,6 +156,7 @@ Depends: x11-xkb-utils-udeb, # disabled: keyboard-configuration [linux-any kfreebsd-any], udev-udeb (>= 149) [linux-any], + devd-udeb [kfreebsd-any], ${shlibs:Depends}, ${misc:Depends}, Provides: diff --git a/debian/patches/02_kbsd-input-devd.diff b/debian/patches/02_kbsd-input-devd.diff new file mode 100644 index 0000000..bdadae2 --- /dev/null +++ b/debian/patches/02_kbsd-input-devd.diff @@ -0,0 +1,551 @@ +>From d96e2bd2a2b48ede527ad7071d3e0eeda9861b73 Mon Sep 17 00:00:00 2001 +From: Robert Millan <r...@debian.org> +Date: Mon, 24 Feb 2014 23:22:57 +0100 +Subject: [PATCH] Add devd config backend for FreeBSD (and GNU/kFreeBSD) + +Based on original code by Baptiste Daroussin, with some fixes made +by Koop Mast and myself. + +Signed-off-by: Robert Millan <r...@freebsd.org> +--- + config/Makefile.am | 4 + + config/config-backends.h | 5 + + config/config.c | 5 + + config/devd.c | 387 +++++++++++++++++++++++++++++++++++++++ + configure.ac | 16 ++ + hw/xfree86/common/xf86Config.c | 7 +- + hw/xfree86/common/xf86Globals.c | 3 +- + include/dix-config.h.in | 3 + + 8 files changed, 427 insertions(+), 3 deletions(-) + create mode 100644 config/devd.c + +Index: xorg-server/config/Makefile.am +=================================================================== +--- xorg-server.orig/config/Makefile.am ++++ xorg-server/config/Makefile.am +@@ -40,6 +40,10 @@ if CONFIG_WSCONS + libconfig_la_SOURCES += wscons.c + endif # CONFIG_WSCONS + ++if CONFIG_DEVD ++libconfig_la_SOURCES += devd.c ++endif ++ + endif # CONFIG_NEED_DBUS + + endif # !CONFIG_UDEV +Index: xorg-server/config/config-backends.h +=================================================================== +--- xorg-server.orig/config/config-backends.h ++++ xorg-server/config/config-backends.h +@@ -75,3 +75,8 @@ void config_hal_fini(void); + int config_wscons_init(void); + void config_wscons_fini(void); + #endif ++ ++#ifdef CONFIG_DEVD ++int config_devd_init(void); ++void config_devd_fini(void); ++#endif +Index: xorg-server/config/config.c +=================================================================== +--- xorg-server.orig/config/config.c ++++ xorg-server/config/config.c +@@ -64,6 +64,9 @@ config_init(void) + #elif defined(CONFIG_WSCONS) + if (!config_wscons_init()) + ErrorF("[config] failed to initialise wscons\n"); ++#elif defined(CONFIG_DEVD) ++ if (!config_devd_init()) ++ ErrorF("[config] failed to initialise devd\n"); + #endif + } + +@@ -82,6 +85,8 @@ config_fini(void) + config_dbus_core_fini(); + #elif defined(CONFIG_WSCONS) + config_wscons_fini(); ++#elif defined(CONFIG_DEVD) ++ config_devd_fini(); + #endif + } + +Index: xorg-server/config/devd.c +=================================================================== +--- /dev/null ++++ xorg-server/config/devd.c +@@ -0,0 +1,387 @@ ++/* ++ * Copyright © 2012 Baptiste Daroussin ++ * Copyright © 2014 Robert Millan ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ * ++ * Author: Baptiste Daroussin <b...@freebsd.org> ++ */ ++ ++#ifdef HAVE_DIX_CONFIG_H ++#include <dix-config.h> ++#endif ++ ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <sys/sysctl.h> ++#include <sys/un.h> ++ ++#include <ctype.h> ++#include <errno.h> ++#include <fcntl.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include <stdarg.h> ++#include <stdbool.h> ++#include <unistd.h> ++ ++#include "input.h" ++#include "inputstr.h" ++#include "hotplug.h" ++#include "config-backends.h" ++#include "os.h" ++ ++#define DEVD_SOCK_PATH "/var/run/devd.pipe" ++ ++#define DEVD_EVENT_ADD '+' ++#define DEVD_EVENT_REMOVE '-' ++ ++static int sock_devd = -1; ++ ++struct hw_type { ++ const char *driver; ++ int flag; ++ const char *xdriver; ++}; ++ ++static struct hw_type hw_types[] = { ++ {"ukbd", ATTR_KEYBOARD, "kbd"}, ++ {"atkbd", ATTR_KEYBOARD, "kbd"}, ++ {"ums", ATTR_POINTER, "mouse"}, ++ {"psm", ATTR_POINTER, "mouse"}, ++ {"uhid", ATTR_POINTER, "mouse"}, ++ {"joy", ATTR_JOYSTICK, NULL}, ++ {"atp", ATTR_TOUCHPAD, NULL}, ++ {"uep", ATTR_TOUCHSCREEN, NULL}, ++ {NULL, -1, NULL}, ++}; ++ ++static bool ++sysctl_exists(const char *format, ...) ++{ ++ va_list args; ++ char *name = NULL; ++ size_t len; ++ int ret; ++ ++ if (format == NULL) ++ return false; ++ ++ va_start(args, format); ++ vasprintf(&name, format, args); ++ va_end(args); ++ ++ ret = sysctlbyname(name, NULL, &len, NULL, 0); ++ ++ if (ret == -1) ++ len = 0; ++ ++ free(name); ++ return (len > 0); ++} ++ ++static char * ++sysctl_get_str(const char *format, ...) ++{ ++ va_list args; ++ char *name = NULL; ++ char *dest = NULL; ++ size_t len; ++ ++ if (format == NULL) ++ return NULL; ++ ++ va_start(args, format); ++ vasprintf(&name, format, args); ++ va_end(args); ++ ++ if (sysctlbyname(name, NULL, &len, NULL, 0) == 0) { ++ dest = malloc(len + 1); ++ if (!dest) ++ goto unwind; ++ if (sysctlbyname(name, dest, &len, NULL, 0) == 0) ++ dest[len] = '\0'; ++ else { ++ free(dest); ++ dest = NULL; ++ } ++ } ++ ++ unwind: ++ free(name); ++ return dest; ++} ++ ++static void ++device_added(char *devname) ++{ ++ char path[PATH_MAX]; ++ char *vendor; ++ char *product = NULL; ++ char *config_info = NULL; ++ char *walk; ++ InputOption *options = NULL; ++ InputAttributes attrs = { }; ++ DeviceIntPtr dev = NULL; ++ int i, rc; ++ int fd; ++ ++ for (i = 0; hw_types[i].driver != NULL; i++) { ++ if (strncmp(devname, hw_types[i].driver, ++ strlen(hw_types[i].driver)) == 0 && ++ isdigit(*(devname + strlen(hw_types[i].driver)))) { ++ attrs.flags |= hw_types[i].flag; ++ break; ++ } ++ } ++ if (hw_types[i].driver == NULL) { ++ LogMessageVerb(X_INFO, 10, "config/devd: ignoring device %s\n", ++ devname); ++ return; ++ } ++ if (hw_types[i].xdriver == NULL) { ++ LogMessageVerb(X_INFO, 10, "config/devd: ignoring device %s\n", ++ devname); ++ return; ++ } ++ snprintf(path, sizeof(path), "/dev/%s", devname); ++ ++ options = input_option_new(NULL, "_source", "server/devd"); ++ if (!options) ++ return; ++ ++ vendor = ++ sysctl_get_str("dev.%s.%s.%%desc", hw_types[i].driver, ++ devname + strlen(hw_types[i].driver)); ++ if (vendor == NULL) { ++ attrs.vendor = strdup("(unnamed)"); ++ attrs.product = strdup("(unnamed)"); ++ } ++ else { ++ if ((walk = strchr(vendor, ' ')) != NULL) { ++ walk[0] = '\0'; ++ walk++; ++ product = walk; ++ if ((walk = strchr(product, ',')) != NULL) ++ walk[0] = '\0'; ++ } ++ ++ attrs.vendor = strdup(vendor); ++ if (product) ++ attrs.product = strdup(product); ++ else ++ attrs.product = strdup("(unnamed)"); ++ ++ options = input_option_new(options, "name", xstrdup(attrs.product)); ++ ++ free(vendor); ++ } ++ attrs.usb_id = NULL; ++ attrs.device = strdup(path); ++ options = input_option_new(options, "driver", hw_types[i].xdriver); ++ if (attrs.flags & ATTR_KEYBOARD) { ++ /* ++ * Don't pass device option if keyboard is attached to console (open fails), ++ * thus activating special logic in xf86-input-keyboard. ++ */ ++ fd = open(path, O_RDONLY | O_NONBLOCK | O_EXCL); ++ if (fd > 0) { ++ close(fd); ++ options = input_option_new(options, "device", xstrdup(path)); ++ } ++ } ++ else { ++ options = input_option_new(options, "device", xstrdup(path)); ++ } ++ ++ if (asprintf(&config_info, "devd:%s", devname) == -1) { ++ config_info = NULL; ++ goto unwind; ++ } ++ ++ if (device_is_duplicate(config_info)) { ++ LogMessage(X_WARNING, "config/devd: device %s already added. " ++ "Ignoring.\n", attrs.product); ++ goto unwind; ++ } ++ ++ options = input_option_new(options, "config_info", config_info); ++ LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n", ++ attrs.product, path); ++ ++ rc = NewInputDeviceRequest(options, &attrs, &dev); ++ ++ if (rc != Success) ++ goto unwind; ++ ++ unwind: ++ free(config_info); ++ input_option_free_list(&options); ++ ++ free(attrs.usb_id); ++ free(attrs.product); ++ free(attrs.device); ++ free(attrs.vendor); ++} ++ ++static void ++device_removed(char *devname) ++{ ++ char *value; ++ ++ if (asprintf(&value, "devd:%s", devname) == -1) ++ return; ++ ++ remove_devices("devd", value); ++ ++ free(value); ++} ++ ++static ssize_t ++socket_getline(int fd, char **out) ++{ ++ char *buf, *newbuf; ++ ssize_t ret, cap, sz = 0; ++ char c; ++ ++ cap = 1024; ++ buf = malloc(cap * sizeof(char)); ++ if (!buf) ++ return -1; ++ ++ for (;;) { ++ ret = read(sock_devd, &c, 1); ++ if (ret < 1) { ++ if (errno == EINTR) ++ continue; ++ free(buf); ++ return -1; ++ } ++ ++ if (c == '\n') ++ break; ++ ++ if (sz + 1 >= cap) { ++ cap *= 2; ++ newbuf = realloc(buf, cap * sizeof(char)); ++ if (!newbuf) { ++ free(buf); ++ return -1; ++ } ++ buf = newbuf; ++ } ++ buf[sz] = c; ++ sz++; ++ } ++ ++ buf[sz] = '\0'; ++ if (sz >= 0) ++ *out = buf; ++ else ++ free(buf); ++ ++ return sz; /* number of bytes in the line, not counting the line break */ ++} ++ ++static void ++wakeup_handler(void *data, int err, void *read_mask) ++{ ++ char *line = NULL; ++ char *walk; ++ ++ if (err < 0) ++ return; ++ ++ if (FD_ISSET(sock_devd, (fd_set *) read_mask)) { ++ if (socket_getline(sock_devd, &line) < 0) ++ return; ++ ++ walk = strchr(line + 1, ' '); ++ if (walk != NULL) ++ walk[0] = '\0'; ++ ++ switch (*line) { ++ case DEVD_EVENT_ADD: ++ device_added(line + 1); ++ break; ++ case DEVD_EVENT_REMOVE: ++ device_removed(line + 1); ++ break; ++ default: ++ break; ++ } ++ free(line); ++ } ++} ++ ++static void ++block_handler(void *data, struct timeval **tv, void *read_mask) ++{ ++} ++ ++int ++config_devd_init(void) ++{ ++ struct sockaddr_un devd; ++ char devicename[1024]; ++ int i, j; ++ ++ /* first scan the sysctl to determine the hardware if needed */ ++ ++ for (i = 0; hw_types[i].driver != NULL; i++) { ++ for (j = 0; sysctl_exists("dev.%s.%i.%%desc", hw_types[i].driver, j); ++ j++) { ++ snprintf(devicename, sizeof(devicename), "%s%i", hw_types[i].driver, ++ j); ++ device_added(devicename); ++ } ++ ++ } ++ sock_devd = socket(AF_UNIX, SOCK_STREAM, 0); ++ if (sock_devd < 0) { ++ ErrorF("config/devd: Fail opening stream socket"); ++ return 0; ++ } ++ ++ devd.sun_family = AF_UNIX; ++ strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path)); ++ ++ if (connect(sock_devd, (struct sockaddr *) &devd, sizeof(devd)) < 0) { ++ close(sock_devd); ++ ErrorF("config/devd: Fail to connect to devd"); ++ return 0; ++ } ++ ++ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); ++ AddGeneralSocket(sock_devd); ++ ++ return 1; ++} ++ ++void ++config_devd_fini(void) ++{ ++ if (sock_devd < 0) ++ return; ++ ++ RemoveGeneralSocket(sock_devd); ++ RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); ++ close(sock_devd); ++} +Index: xorg-server/configure.ac -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/e1wxsfl-0004by...@moszumanska.debian.org