xorg-server: Changes to 'debian-experimental'
ChangeLog | 127 +
Xext/geext.c | 9
Xi/xiproperty.c | 5
configure.ac | 10
debian/changelog | 10
debian/control | 6
debian/local/64-xorg-xkb.rules | 8
debian/patches/11-Move-config_init-after-CreateWellKnownSockets-and-In.diff | 37
debian/patches/12-Add-libudev-input-hotplug-backend.diff | 714 ++++++++++
debian/patches/13-configure-config-udev-defaults-to-off-for-now.diff | 26
debian/patches/14-config-add-example-udev-rules.diff | 27
debian/patches/15-config-udev-look-for-xkb-rules-model-layout-variant-.diff | 40
debian/patches/series | 5
debian/rules | 22
fb/fb.h | 3
fb/fbpict.c | 118 -
fb/fbtrap.c | 4
hw/xfree86/modes/xf86EdidModes.c | 15
hw/xquartz/mach-startup/bundle-main.c | 36
hw/xquartz/mach-startup/stub.c | 1
test/input.c | 54
21 files changed, 1133 insertions(+), 144 deletions(-)
New commits:
commit df4e9195f8bf93eeb45c4085647e7e85634ed39e
Author: Julien Cristau <jcristau@debian.org>
Date: Sat Nov 28 16:48:46 2009 +0100
Prepare changelog for upload
diff --git a/debian/changelog b/debian/changelog
index 8cb6c4c..b6a1feb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xorg-server (2:1.7.2-1) UNRELEASED; urgency=low
+xorg-server (2:1.7.2-1) experimental; urgency=low
* New upstream release
+ Xorg sets umask to 022 (closes: #555308)
@@ -18,7 +18,7 @@ xorg-server (2:1.7.2-1) UNRELEASED; urgency=low
* Use libudev instead of libhal for input hotplug on linux.
* Add udev rule to get keymap from /etc/default/keyboard.
- -- Julien Cristau <jcristau@debian.org> Sat, 28 Nov 2009 16:17:58 +0100
+ -- Julien Cristau <jcristau@debian.org> Sat, 28 Nov 2009 16:48:43 +0100
xorg-server (2:1.7.0-1) experimental; urgency=low
commit cb7d5380f5e5fc8f26cdce4467fa46d3fb4b1a77
Author: Julien Cristau <jcristau@debian.org>
Date: Sat Nov 28 16:48:21 2009 +0100
Fix mode of udev rule
diff --git a/debian/rules b/debian/rules
index cfa078f..ef76435 100755
--- a/debian/rules
+++ b/debian/rules
@@ -225,7 +225,7 @@ binary-arch: build install
$(INSTALL) -m 755 debian/xserver-xorg-core.bug.script debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core/script
ifeq ($(DEB_HOST_ARCH_OS), linux)
install -d debian/xserver-xorg-core/lib/udev/rules.d
- install debian/local/64-xorg-xkb.rules debian/xserver-xorg-core/lib/udev/rules.d
+ install -m 644 debian/local/64-xorg-xkb.rules debian/xserver-xorg-core/lib/udev/rules.d
endif
dh_installdebconf -s
dh_installman -s
commit 33a67155da920d922c57426b1075d6da8ec11f74
Author: Julien Cristau <jcristau@debian.org>
Date: Sat Nov 28 16:19:05 2009 +0100
Bump changelogs
diff --git a/ChangeLog b/ChangeLog
index 0864cdc..1792894 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,130 @@
+commit 1fff1b37a91c989c046d96d961862d592a307496
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Fri Nov 27 14:58:57 2009 +1000
+
+ xserver 1.7.2
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 196aff9b18381d700fb28027186cce6e68ad587c
+Author: Aaron Plattner <aplattner@nvidia.com>
+Date: Tue Nov 24 10:21:28 2009 -0800
+
+ Bug #25136: Revert "Fix clipping when windows are used as sources"
+
+ That change causes lib(w)fb to make accelerated driver calls after the driver
+ has entered a software fallback. Most drivers don't expect this, which leads to
+ corruption or crashes. A change to make this code do the copy in software is
+ unacceptably slow.
+
+ This reverts commit e9aa61e9f0d663d5b34a397b943b4d1df44e873d.
+
+ Conflicts:
+
+ configure.ac
+ fb/fbpict.c
+
+ Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8eca8eaef56526b9649b48aa5f83c3d7914cfdc4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Tue Nov 24 15:31:48 2009 +1000
+
+ Xi: when deleting all properties, reset property handler to NULL.
+
+ Trying to unregister property handlers during the device closure process
+ leads to invalid memory accesses.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+ (cherry picked from commit 1b127ab8429616adf9ec31ba4d8bdd9af6e104a9)
+
+commit 9998105a387e0294054502331a56e1e020cd93e4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Tue Nov 17 09:25:47 2009 +1000
+
+ Move xdmxconfig modules into DMX conditionals (#25102)
+
+ xdmxconfig requires additional modules not checked for if Xdmx build is set
+ to auto (the default). This may lead to build errors if the Xdmx modules are
+ installed, but not the extra ones required for xdmxconfig.
+
+ X.Org Bug 25102 <http://bugs.freedesktop.org/show_bug.cgi?id=25102>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Remi Cardona <remi@gentoo.org>
+ Acked-by: Julien Cristau <jcristau@debian.org>
+ (cherry picked from commit 8806375ed72a3cd465fe0a49ead079a334accd6b)
+
+commit 18dcc102ac12a4b18c60b5dbabbc4d5debfe5556
+Author: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+Date: Tue Nov 17 17:13:43 2009 +0200
+
+ Xext: Fix a memory leak on GE client disconnect.
+
+ Add a call to dixRequestPrivate to inform dixFreePrivates that memory
+ allocated in GEClientCallback should be released when client
+ disconnects. Otherwise there is a leak of sizeof(GEClientInfoRec) for
+ every client connect/disconnect.
+
+ Also remove the explicit allocation and let GEGetClient /
+ dixLookupPrivate do it. This makes GEClientCallback similar to the
+ other extension callbacks.
+
+ Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ (cherry picked from commit eb967ca36cfe0409972ac987a74d498cd6f6bafb)
+
+commit b8904935bbd26e9d34587f03810318d94cb771f6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon Nov 23 13:07:56 2009 +1000
+
+ Xi: don't crash when deleting invalid device properties.
+
+ Deleting a property that was not set on a device leads to a null-pointer
+ reference. The protocol allows deleting those properties - it has to be a
+ noop.
+
+ Reproducible:
+ xinput --set-prop "My device" --type=int --format=8 "my property" 1
+ xinput --delete-prop "My other device" "my property"
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+ (cherry picked from commit a30e739a144912a68adcaa9f426d600c6ecbd529)
+
+commit a5308ceb127bf390cbe6fef3ba1e33e78f222ba1
+Author: Zhao Yakui <yakui.zhao@intel.com>
+Date: Fri Nov 20 14:43:35 2009 +0800
+
+ xfree86: Edid quirk for Philips LCD LP154W01
+
+ v1->v2: Make one condition case for one quirk instead of merging them
+ together. This is based on the Keithp's suggestion.
+
+ Move the EDID quirk for Philips LCD LP154W01 as the panel reports the vertical
+ size in cm.
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=24482
+
+ Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+ (cherry picked from commit 19f7c15e2008dab3c46ba3e14dfa353d01c74f72)
+
+commit b466329c111c4b6696508b3c2c8a60c9fbc90157
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date: Mon Nov 23 16:33:00 2009 -0800
+
+ XQuartz: Allow better compatability with older versions of xinit
+
+ If we are id="org.x" and the launchd socket is ":0", we will claim
+ the socket to match the old behavior before we prefixed the
+ socket name with our id.
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+ (cherry picked from commit 4677b5a80025b50ba2a3e953fd487a549586ae9f)
+
commit 19b24f014f4dad1cc73e2454d15c64ae05ac8ef2
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Nov 20 15:29:05 2009 +1000
diff --git a/debian/changelog b/debian/changelog
index 5da0266..8cb6c4c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,7 @@
-xorg-server (2:1.7.1.902-1) UNRELEASED; urgency=low
+xorg-server (2:1.7.2-1) UNRELEASED; urgency=low
+ * New upstream release
+ + Xorg sets umask to 022 (closes: #555308)
* Delete 09_debian_xserver_rtff.diff. Was disabled since 1.3.99, and is not
necessary since the fall back to builtin fonts was added.
* Change the server's dependency on xserver-common to >= ${source:Version},
@@ -13,12 +15,10 @@ xorg-server (2:1.7.1.902-1) UNRELEASED; urgency=low
* xvfb-run: retry a few times if Xvfb can't be started when using
--auto-servernum, to make concurrent invocations work (closes: #521075).
Thanks, Kees Cook!
- * New upstream release
- + Xorg sets umask to 022 (closes: #555308)
* Use libudev instead of libhal for input hotplug on linux.
* Add udev rule to get keymap from /etc/default/keyboard.
- -- Julien Cristau <jcristau@debian.org> Thu, 26 Nov 2009 16:23:40 +0100
+ -- Julien Cristau <jcristau@debian.org> Sat, 28 Nov 2009 16:17:58 +0100
xorg-server (2:1.7.0-1) experimental; urgency=low
commit 1fff1b37a91c989c046d96d961862d592a307496
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Nov 27 14:58:57 2009 +1000
xserver 1.7.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 5579795..8500db4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.7.1.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2009-11-20"
+AC_INIT([xorg-server], 1.7.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2009-11-27"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
commit dec68ef3470d39edabb5f6990d1f40c2c51f2601
Author: Julien Cristau <jcristau@debian.org>
Date: Thu Nov 26 17:12:48 2009 +0100
Add udev rule to get keymap from /etc/default/keyboard.
diff --git a/debian/changelog b/debian/changelog
index 29893d7..5da0266 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ xorg-server (2:1.7.1.902-1) UNRELEASED; urgency=low
* New upstream release
+ Xorg sets umask to 022 (closes: #555308)
* Use libudev instead of libhal for input hotplug on linux.
+ * Add udev rule to get keymap from /etc/default/keyboard.
-- Julien Cristau <jcristau@debian.org> Thu, 26 Nov 2009 16:23:40 +0100
diff --git a/debian/control b/debian/control
index 81ce25b..e0eb5c5 100644
--- a/debian/control
+++ b/debian/control
@@ -85,6 +85,7 @@ Architecture: any
Depends:
xserver-common (>= ${source:Version}),
xserver-xorg,
+ keyboard-configuration [linux-any kfreebsd-any],
${shlibs:Depends},
${misc:Depends},
Recommends: libgl1-mesa-dri (>= 7.1~rc1)
diff --git a/debian/local/64-xorg-xkb.rules b/debian/local/64-xorg-xkb.rules
new file mode 100644
index 0000000..d5607c6
--- /dev/null
+++ b/debian/local/64-xorg-xkb.rules
@@ -0,0 +1,8 @@
+ACTION!="add", GOTO="xorg_xkb_end"
+SUBSYSTEM!="input", GOTO="xorg_xkb_end"
+KERNEL!="event*", GOTO="xorg_xkb_end"
+
+# import keyboard layout from /etc/default/keyboard
+IMPORT{file}="/etc/default/keyboard"
+
+LABEL="xorg_xkb_end"
diff --git a/debian/rules b/debian/rules
index 37fe35a..cfa078f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -191,7 +191,6 @@ install: build
install -m 755 debian/local/xvfb-run debian/tmp/usr/bin
install debian/local/xvfb-run.1 debian/tmp/usr/share/man/man1
-
# stub to start building deb files, used by binary-indep and binary-arch
binary-initial:
dh_testdir
@@ -224,6 +223,10 @@ binary-arch: build install
$(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg/serverminver
$(INSTALL) -m 755 -d debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core
$(INSTALL) -m 755 debian/xserver-xorg-core.bug.script debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core/script
+ifeq ($(DEB_HOST_ARCH_OS), linux)
+ install -d debian/xserver-xorg-core/lib/udev/rules.d
+ install debian/local/64-xorg-xkb.rules debian/xserver-xorg-core/lib/udev/rules.d
+endif
dh_installdebconf -s
dh_installman -s
dh_link -s
commit cc28c98c358b37bea1007f8e9dc8c4e0a8d2400c
Author: Julien Cristau <jcristau@debian.org>
Date: Thu Nov 26 16:55:42 2009 +0100
Use libudev instead of libhal for input hotplug on linux.
diff --git a/debian/changelog b/debian/changelog
index c344d7e..29893d7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,7 @@ xorg-server (2:1.7.1.902-1) UNRELEASED; urgency=low
Thanks, Kees Cook!
* New upstream release
+ Xorg sets umask to 022 (closes: #555308)
+ * Use libudev instead of libhal for input hotplug on linux.
-- Julien Cristau <jcristau@debian.org> Thu, 26 Nov 2009 16:23:40 +0100
diff --git a/debian/control b/debian/control
index dcb7206..81ce25b 100644
--- a/debian/control
+++ b/debian/control
@@ -46,8 +46,9 @@ Build-Depends:
libpixman-1-dev (>= 0.15.20),
libpciaccess-dev (>= 0.10.7),
libgcrypt-dev,
- libdbus-1-dev [!hurd-i386],
- libhal-dev [!hurd-i386],
+ libdbus-1-dev [kfreebsd-amd64 kfreebsd-i386],
+ libhal-dev [kfreebsd-amd64 kfreebsd-i386],
+ libudev-dev [alpha amd64 arm armeb armel avr32 hppa i386 ia64 lpia m32r m68k mips mipsel powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc],
libselinux1-dev (>= 2.0.80) [alpha amd64 arm armeb armel avr32 hppa i386 ia64 lpia m32r m68k mips mipsel powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc],
libaudit-dev [alpha amd64 arm armeb armel avr32 hppa i386 ia64 lpia m32r m68k mips mipsel powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc],
x11proto-xf86dri-dev (>= 2.1.0),
diff --git a/debian/patches/11-Move-config_init-after-CreateWellKnownSockets-and-In.diff b/debian/patches/11-Move-config_init-after-CreateWellKnownSockets-and-In.diff
new file mode 100644
index 0000000..3536198
--- /dev/null
+++ b/debian/patches/11-Move-config_init-after-CreateWellKnownSockets-and-In.diff
@@ -0,0 +1,37 @@
+From 4ae407a5a308febf63de27a62f8c301c73b37d3e Mon Sep 17 00:00:00 2001
+From: Julien Cristau <jcristau@debian.org>
+Date: Tue, 6 Oct 2009 17:44:33 +0200
+Subject: [PATCH 1/5] Move config_init() after CreateWellKnownSockets() and InitCoreDevices()
+
+config_init() can now add devices directly instead of scheduling a
+timer.
+
+Signed-off-by: Julien Cristau <jcristau@debian.org>
+Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+ dix/main.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/dix/main.c b/dix/main.c
+index f96245a..2117a1e 100644
+--- a/dix/main.c
++++ b/dix/main.c
+@@ -168,7 +168,6 @@ int main(int argc, char *argv[], char *envp[])
+ InitBlockAndWakeupHandlers();
+ /* Perform any operating system dependent initializations you'd like */
+ OsInit();
+- config_init();
+ if(serverGeneration == 1)
+ {
+ CreateWellKnownSockets();
+@@ -254,6 +253,7 @@ int main(int argc, char *argv[], char *envp[])
+ InitRootWindow(WindowTable[i]);
+
+ InitCoreDevices();
++ config_init();
+ InitInput(argc, argv);
+ InitAndStartDevices();
+
+--
+1.6.5
+
diff --git a/debian/patches/12-Add-libudev-input-hotplug-backend.diff b/debian/patches/12-Add-libudev-input-hotplug-backend.diff
new file mode 100644
index 0000000..e764f6e
--- /dev/null
+++ b/debian/patches/12-Add-libudev-input-hotplug-backend.diff
@@ -0,0 +1,714 @@
+From 7dc78123e56b2d4c6855aa7f8f554f012433eed3 Mon Sep 17 00:00:00 2001
+From: Julien Cristau <jcristau@debian.org>
+Date: Sun, 27 Sep 2009 14:45:47 +0200
+Subject: [PATCH 2/5] Add libudev input-hotplug backend
+
+If libudev is found, we use that for hotplug and disable the hal and
+dbus backends.
+We look for event devices with an "x11_driver" property. XKB
+configuration happens using xkb.{rules,model,layout,variant,options}
+properties. Arbitrary driver options can be set with a "x11_options."
+prefix.
+
+udev rules would look something like:
+SUBSYSTEM=="input", KERNEL=="event*", ENV{x11_driver}="evdev"
+SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_CLASS}=="kbd", ENV{xkb.layout}="fr", ENV{xkb.options}="terminate:ctrl_alt_bksp,compose:lwin"
+
+Signed-off-by: Julien Cristau <jcristau@debian.org>
+Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+ config/Makefile.am | 16 +++-
+ config/config-backends.h | 21 +++-
+ config/config.c | 77 ++++++++++++-
+ config/hal.c | 63 +----------
+ config/udev.c | 247 +++++++++++++++++++++++++++++++++++++++
+ configure.ac | 23 ++++-
+ hw/kdrive/src/kinput.c | 8 ++
+ hw/xfree86/common/xf86Config.c | 15 ++-
+ hw/xfree86/common/xf86Globals.c | 2 +-
+ hw/xfree86/common/xf86Xinput.c | 4 +-
+ include/dix-config.h.in | 3 +
+ 11 files changed, 400 insertions(+), 79 deletions(-)
+ create mode 100644 config/udev.c
+
+diff --git a/config/Makefile.am b/config/Makefile.am
+index 7fa2df8..8c57948 100644
+--- a/config/Makefile.am
++++ b/config/Makefile.am
+@@ -3,10 +3,18 @@ AM_CFLAGS = @DIX_CFLAGS@
+ noinst_LTLIBRARIES = libconfig.la
+ libconfig_la_SOURCES = config.c config-backends.h
+
++if CONFIG_UDEV
++
++AM_CFLAGS += @UDEV_CFLAGS@
++libconfig_la_SOURCES += udev.c
++libconfig_la_LIBADD = @UDEV_LIBS@
++
++else
++
+ if CONFIG_NEED_DBUS
+ AM_CFLAGS += @DBUS_CFLAGS@
+ libconfig_la_SOURCES += dbus-core.c
+-endif
++libconfig_la_LIBADD = @DBUS_LIBS@
+
+ if CONFIG_DBUS_API
+ dbusconfigdir = $(sysconfdir)/dbus-1/system.d
+@@ -16,7 +24,13 @@ libconfig_la_SOURCES += dbus.c
+ endif
+
+ if CONFIG_HAL
++AM_CFLAGS += @HAL_CFLAGS@
+ libconfig_la_SOURCES += hal.c
++libconfig_la_LIBADD += @HAL_LIBS@
+ endif
+
++endif # CONFIG_NEED_DBUS
++
++endif # !CONFIG_UDEV
++
+ EXTRA_DIST = xorg-server.conf x11-input.fdi
+diff --git a/config/config-backends.h b/config/config-backends.h
+index 907e86b..0a2a22a 100644
+--- a/config/config-backends.h
++++ b/config/config-backends.h
+@@ -26,8 +26,18 @@
+ #ifdef HAVE_DIX_CONFIG_H
+ #include <dix-config.h>
+ #endif
++#include "input.h"
+
+-#ifdef CONFIG_NEED_DBUS
++void remove_devices(const char *backend, const char *config_info);
++BOOL device_is_duplicate(const char *config_info);
++void add_option(InputOption **options, const char *key, const char *value);
++
++#ifdef CONFIG_UDEV
++int config_udev_init(void);
++void config_udev_fini(void);
++#else
++
++# ifdef CONFIG_NEED_DBUS
+ #include <dbus/dbus.h>
+
+ typedef void (*config_dbus_core_connect_hook)(DBusConnection *connection,
+@@ -46,14 +56,15 @@ int config_dbus_core_init(void);
+ void config_dbus_core_fini(void);
+ int config_dbus_core_add_hook(struct config_dbus_core_hook *hook);
+ void config_dbus_core_remove_hook(struct config_dbus_core_hook *hook);
+-#endif
++# endif
+
+-#ifdef CONFIG_DBUS_API
++# ifdef CONFIG_DBUS_API
+ int config_dbus_init(void);
+ void config_dbus_fini(void);
+-#endif
++# endif
+
+-#ifdef CONFIG_HAL
++# ifdef CONFIG_HAL
+ int config_hal_init(void);
+ void config_hal_fini(void);
++# endif
+ #endif
+diff --git a/config/config.c b/config/config.c
+index b013293..7bf5e41 100644
+--- a/config/config.c
++++ b/config/config.c
+@@ -28,13 +28,17 @@
+ #endif
+
+ #include "os.h"
++#include "inputstr.h"
+ #include "hotplug.h"
+ #include "config-backends.h"
+
+ void
+ config_init(void)
+ {
+-#if defined(CONFIG_DBUS_API) || defined(CONFIG_HAL)
++#ifdef CONFIG_UDEV
++ if (!config_udev_init())
++ ErrorF("[config] failed to initialise udev\n");
++#elif defined(CONFIG_NEED_DBUS)
+ if (config_dbus_core_init()) {
+ # ifdef CONFIG_DBUS_API
+ if (!config_dbus_init())
+@@ -54,7 +58,9 @@ config_init(void)
+ void
+ config_fini(void)
+ {
+-#if defined(CONFIG_DBUS_API) || defined(CONFIG_HAL)
++#if defined(CONFIG_UDEV)
++ config_udev_fini();
++#elif defined(CONFIG_NEED_DBUS)
+ # ifdef CONFIG_HAL
+ config_hal_fini();
+ # endif
+@@ -64,3 +70,70 @@ config_fini(void)
+ config_dbus_core_fini();
+ #endif
+ }
++
++static void
++remove_device(const char *backend, DeviceIntPtr dev)
++{
++ /* this only gets called for devices that have already been added */
++ LogMessage(X_INFO, "config/%s: removing device %s\n", backend, dev->name);
++
++ /* Call PIE here so we don't try to dereference a device that's
++ * already been removed. */
++ OsBlockSignals();
++ ProcessInputEvents();
++ DeleteInputDeviceRequest(dev);
++ OsReleaseSignals();
++}
++
++void
++remove_devices(const char *backend, const char *config_info)
++{
++ DeviceIntPtr dev, next;
++
++ for (dev = inputInfo.devices; dev; dev = next) {
++ next = dev->next;
++ if (dev->config_info && strcmp(dev->config_info, config_info) == 0)
++ remove_device(backend, dev);
++ }
++ for (dev = inputInfo.off_devices; dev; dev = next) {
++ next = dev->next;
++ if (dev->config_info && strcmp(dev->config_info, config_info) == 0)
++ remove_device(backend, dev);
++ }
++}
++
++BOOL
++device_is_duplicate(const char *config_info)
++{
++ DeviceIntPtr dev;
++
++ for (dev = inputInfo.devices; dev; dev = dev->next)
++ {
++ if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
++ return TRUE;
++ }
++
++ for (dev = inputInfo.off_devices; dev; dev = dev->next)
++ {
++ if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
++ return TRUE;
++ }
++
++ return FALSE;
++}
++
++void
++add_option(InputOption **options, const char *key, const char *value)
++{
++ if (!value || *value == '\0')
++ return;
++
++ for (; *options; options = &(*options)->next)
++ ;
++ *options = xcalloc(sizeof(**options), 1);
++ if (!*options) /* Yeesh. */
++ return;
++ (*options)->key = xstrdup(key);
++ (*options)->value = xstrdup(value);
++ (*options)->next = NULL;
++}
+diff --git a/config/hal.c b/config/hal.c
+index 28f55a0..22af10f 100644
+--- a/config/hal.c
++++ b/config/hal.c
+@@ -58,25 +58,9 @@ struct xkb_options {
+ char* options;
+ };
+
+-
+-static void
+-remove_device(DeviceIntPtr dev)
+-{
+- /* this only gets called for devices that have already been added */
+- LogMessage(X_INFO, "config/hal: removing device %s\n", dev->name);
+-
+- /* Call PIE here so we don't try to dereference a device that's
+- * already been removed. */
+- OsBlockSignals();
+- ProcessInputEvents();
+- DeleteInputDeviceRequest(dev);
+- OsReleaseSignals();
+-}
+-
+ static void
+ device_removed(LibHalContext *ctx, const char *udi)
+ {
+- DeviceIntPtr dev, next;
+ char *value;
+
+ value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */
+@@ -84,36 +68,11 @@ device_removed(LibHalContext *ctx, const char *udi)
+ return;
+ sprintf(value, "hal:%s", udi);
+
+- for (dev = inputInfo.devices; dev; dev = next) {
+- next = dev->next;
+- if (dev->config_info && strcmp(dev->config_info, value) == 0)
+- remove_device(dev);
+- }
+- for (dev = inputInfo.off_devices; dev; dev = next) {
+- next = dev->next;
+- if (dev->config_info && strcmp(dev->config_info, value) == 0)
+- remove_device(dev);
+- }
++ remove_devices("hal", value);
+
+ xfree(value);
+ }
+
+-static void
+-add_option(InputOption **options, const char *key, const char *value)
+-{
+- if (!value || *value == '\0')
+- return;
+-
+- for (; *options; options = &(*options)->next)
+- ;
+- *options = xcalloc(sizeof(**options), 1);
+- if (!*options) /* Yeesh. */
+- return;
+- (*options)->key = xstrdup(key);
+- (*options)->value = xstrdup(value);
+- (*options)->next = NULL;
+-}
+-
+ static char *
+ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
+ {
+@@ -166,26 +125,6 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
+ return ret;
+ }
+
+-static BOOL
+-device_is_duplicate(char *config_info)
+-{
+- DeviceIntPtr dev;
+-
+- for (dev = inputInfo.devices; dev; dev = dev->next)
+- {
+- if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
+- return TRUE;
+- }
+-
+- for (dev = inputInfo.off_devices; dev; dev = dev->next)
+- {
+- if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
+- return TRUE;
+- }
+-
+- return FALSE;
+-}
+-
+ static void
+ device_added(LibHalContext *hal_ctx, const char *udi)
+ {
+diff --git a/config/udev.c b/config/udev.c
+new file mode 100644
+index 0000000..62b9052
+--- /dev/null
++++ b/config/udev.c
+@@ -0,0 +1,247 @@
++/*
++ * Copyright © 2009 Julien Cristau
++ *
++ * 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: Julien Cristau <jcristau@debian.org>
++ */
++
++#ifdef HAVE_DIX_CONFIG_H
++#include <dix-config.h>
++#endif
++
++#include <libudev.h>
++
++#include "input.h"
++#include "inputstr.h"
++#include "hotplug.h"
++#include "config-backends.h"
++#include "os.h"
++
++#define UDEV_XKB_PROP_KEY "xkb."
++#define UDEV_PROP_KEY "x11_options."
++
++static struct udev_monitor *udev_monitor;
++
++static void
++device_added(struct udev_device *udev_device)
++{
++ const char *path = NULL, *driver = NULL, *name = NULL;
++ char *config_info = NULL;
++ const char *syspath;
++ const char *key, *value, *tmp;
++ InputOption *options = NULL, *tmpo;
++ DeviceIntPtr dev = NULL;
++ struct udev_list_entry *set, *entry;
++ struct udev_device *parent;
++ int rc;
++
++ driver = udev_device_get_property_value(udev_device, "x11_driver");
++
++ path = udev_device_get_devnode(udev_device);
++
++ syspath = udev_device_get_syspath(udev_device);
++
++ parent = udev_device_get_parent(udev_device);
++ if (parent)
++ name = udev_device_get_property_value(parent, "NAME");
++ else
++ name = "(unnamed)";
++
++ if (!driver || !path || !syspath)
++ return;
++ options = xcalloc(sizeof(*options), 1);
++ if (!options)
++ return;
++
++ options->key = xstrdup("_source");
++ options->value = xstrdup("server/udev");
++ if (!options->key || !options->value)
++ goto unwind;
++
++ add_option(&options, "path", path);
++ add_option(&options, "device", path);
++ add_option(&options, "driver", driver);
++
++ config_info = Xprintf("udev:%s", syspath);
++ if (!config_info)
++ goto unwind;
++
++ if (device_is_duplicate(config_info)) {
++ LogMessage(X_WARNING, "config/udev: device %s already added. "
++ "Ignoring.\n", name);
++ goto unwind;
++ }
++
++ set = udev_device_get_properties_list_entry(udev_device);
++ udev_list_entry_foreach(entry, set) {
++ key = udev_list_entry_get_name(entry);
++ if (!key)
++ continue;
++ if (!strncasecmp(key, UDEV_PROP_KEY, sizeof(UDEV_PROP_KEY) - 1)) {
++ value = udev_list_entry_get_value(entry);
++ add_option(&options, key + sizeof(UDEV_PROP_KEY) - 1, value);
++ } else if (!strncasecmp(key, UDEV_XKB_PROP_KEY,
++ sizeof(UDEV_XKB_PROP_KEY) - 1)) {
++ tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
++ value = udev_list_entry_get_value(entry);
++ if (!strcasecmp(tmp, "rules"))
++ add_option(&options, "xkb_rules", value);
++ else if (!strcasecmp(tmp, "layout"))
++ add_option(&options, "xkb_layout", value);
++ else if (!strcasecmp(tmp, "variant"))
++ add_option(&options, "xkb_variant", value);
++ else if (!strcasecmp(tmp, "model"))
++ add_option(&options, "xkb_model", value);
++ else if (!strcasecmp(tmp, "options"))
++ add_option(&options, "xkb_options", value);
++ }
++ }
++ add_option(&options, "name", name);
++ LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
++ name, path);
++ rc = NewInputDeviceRequest(options, &dev);
++ if (rc != Success)
++ goto unwind;
++
++ for (; dev; dev = dev->next) {
++ xfree(dev->config_info);
++ dev->config_info = xstrdup(config_info);
++ }
++
++ unwind:
++ xfree(config_info);
++ while (!dev && (tmpo = options)) {
++ options = tmpo->next;
++ xfree(tmpo->key);
++ xfree(tmpo->value);
++ xfree(tmpo);
++ }
++
++ return;
++}
++
++static void
++device_removed(struct udev_device *device)
++{
++ char *value;
++ const char *syspath = udev_device_get_syspath(device);
++
++ value = Xprintf("udev:%s", syspath);
++ if (!value)
++ return;
++
++ remove_devices("udev", value);
++
++ xfree(value);
++}
++
++static void
++wakeup_handler(pointer data, int err, pointer read_mask)
++{
++ int udev_fd = udev_monitor_get_fd(udev_monitor);
++ struct udev_device *udev_device;
++ const char *action;
++
++ if (err < 0)
++ return;
++
++ if (FD_ISSET(udev_fd, (fd_set *)read_mask)) {
++ udev_device = udev_monitor_receive_device(udev_monitor);
++ if (!udev_device)
++ return;
++ action = udev_device_get_action(udev_device);
++ if (!action)
++ ;
++ else if (!strcmp(action, "add"))
++ device_added(udev_device);
++ else if (!strcmp(action, "remove"))
++ device_removed(udev_device);
++ else
++ DebugF("config/udev: unhandled action %s\n", action);
++ udev_device_unref(udev_device);
++ }
++}
++
++static void
++block_handler(pointer data, struct timeval **tv, pointer read_mask)
++{
++}
++
++int
++config_udev_init(void)
++{
++ struct udev *udev;
++ struct udev_enumerate *enumerate;
++ struct udev_list_entry *devices, *device;
++ int rc;
++
++ udev = udev_new();
++ if (!udev)
++ return 0;
++ udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
++ if (!udev_monitor)
++ return 0;
++ rc = udev_monitor_filter_add_match_subsystem_devtype(udev_monitor,
++ "input", NULL);
++ if (rc < 0)
++ return 0;
++
++ if (udev_monitor_enable_receiving(udev_monitor)) {
++ ErrorF("config/udev: failed to bind the udev monitor\n");
++ return 0;
++ }
++
++ enumerate = udev_enumerate_new(udev);
++ if (!enumerate)
++ return 0;
++ udev_enumerate_add_match_subsystem(enumerate, "input");
++ udev_enumerate_scan_devices(enumerate);
++ devices = udev_enumerate_get_list_entry(enumerate);
++ udev_list_entry_foreach(device, devices) {
++ const char *syspath = udev_list_entry_get_name(device);
++ struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
++ device_added(udev_device);
++ udev_device_unref(udev_device);
++ }
++ udev_enumerate_unref(enumerate);
++
++ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
++ AddGeneralSocket(udev_monitor_get_fd(udev_monitor));
++
++ return 1;
++}
++
++void
++config_udev_fini(void)
++{
++ struct udev *udev;
++
++ if (!udev_monitor)
++ return;
++
++ udev = udev_monitor_get_udev(udev_monitor);
++
++ RemoveGeneralSocket(udev_monitor_get_fd(udev_monitor));
++ RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, udev_monitor);
++ udev_monitor_unref(udev_monitor);
++ udev_monitor = NULL;
++ udev_unref(udev);
++}
+diff --git a/configure.ac b/configure.ac
+index ed710f0..c7fb3d0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -597,6 +597,7 @@ AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Mult
+ AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
+ AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
+ AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
++AC_ARG_ENABLE(config-udev, AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
+ AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
+ AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
+ AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
+@@ -755,6 +756,26 @@ LIBXI="xi >= 1.2.99.1"
+ LIBXTST="xtst >= 1.0.99.2"
+ LIBPCIACCESS="pciaccess >= 0.8.0"
+ LIBGLIB="glib-2.0 >= 2.16"
++LIBUDEV="libudev >= 143"
++
Reply to: