[PATCH] Install support files to try and have the driver loaded automatically via udev.

Michel Dänzer michel at daenzer.net
Wed Apr 7 08:06:59 PDT 2010


From: Michel Dänzer <daenzer at vmware.com>

Thanks to Timo Aaltonen for the udev rules file and Dan Nicholson for review
and suggestions for improvement.
---
 Makefile.am                   |    5 ++++-
 configure.ac                  |   33 ++++++++++++++++++++++++++++++++-
 udev/10-vmmouse.conf          |    7 +++++++
 udev/69-xorg-vmmouse.rules.in |    1 +
 udev/Makefile.am              |   39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 udev/10-vmmouse.conf
 create mode 100644 udev/69-xorg-vmmouse.rules.in
 create mode 100644 udev/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index daf09d4..423dd56 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,10 @@
 #  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.
 
-SUBDIRS = shared src tools fdi man
+# Ensure xorg.conf.d snippets are installed below $(prefix) for distcheck
+DISTCHECK_CONFIGURE_FLAGS = --with-xorg-conf-dir='$${datadir}/X11/xorg.conf.d'
+
+SUBDIRS = shared src tools fdi man udev
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 .PHONY: ChangeLog INSTALL
 
diff --git a/configure.ac b/configure.ac
index e39fcbb..0644c88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,14 @@ AC_ARG_WITH(xorg-module-dir,
 inputdir=${moduledir}/input
 AC_SUBST(inputdir)
 
+AC_ARG_WITH(xorg-conf-dir,
+            AC_HELP_STRING([--with-xorg-conf-dir=DIR],
+                           [Default xorg.conf.d directory [[default=from $PKG_CONFIG xorg-server]]]),
+            [XORG_CONF_DIR="$withval"],
+            [XORG_CONF_DIR="`$PKG_CONFIG --variable=sysconfigdir xorg-server`"])
+AC_SUBST(XORG_CONF_DIR)
+AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$XORG_CONF_DIR" != "x" && test "x$XORG_CONF_DIR" != "xno"])
+
 AC_ARG_WITH(hal-bin-dir,
 	    AC_HELP_STRING([--with-hal-bin-dir=DIR],
 			   [Directory where HAL binaries where installed [[default=$bindir]]]),
@@ -85,6 +93,29 @@ AC_ARG_WITH(hal-fdi-dir,
 HAL_FDI_DIR=${halfdidir}
 AC_SUBST(HAL_FDI_DIR)
 
+case $host_os in
+  linux*)
+    if test "x$prefix" = "xNONE" -o "x$prefix" = "x/usr" -o "x$prefix" = "x/usr/local" ; then
+      slashlibdir=/lib
+    else
+      slashlibdir=$prefix/lib
+    fi
+    UDEV_RULES_DIR=$slashlibdir/udev/rules.d
+    ;;
+  *)
+    UDEV_RULES_DIR=no
+    ;;
+esac
+
+AC_ARG_WITH(udev-rules-dir,
+	    AC_HELP_STRING([--with-udev-rules-dir=DIR],
+			   [Default udev rules.d directory
+			    [[default=($prefix)/lib/udev/rules.d on Linux, none otherwise]]]),
+	    [UDEV_RULES_DIR="$withval"],
+	    [])
+AC_SUBST(UDEV_RULES_DIR)
+AM_CONDITIONAL(HAS_UDEV_RULES_DIR, [test "x$UDEV_RULES_DIR" != "xno"])
+
 # Checks for extensions
 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
@@ -115,4 +146,4 @@ AC_SUBST([CFLAGS])
 # Checks for header files.
 AC_HEADER_STDC
 
-AC_OUTPUT([Makefile shared/Makefile src/Makefile tools/Makefile fdi/Makefile man/Makefile])
+AC_OUTPUT([Makefile shared/Makefile src/Makefile tools/Makefile fdi/Makefile man/Makefile udev/Makefile])
diff --git a/udev/10-vmmouse.conf b/udev/10-vmmouse.conf
new file mode 100644
index 0000000..35c438e
--- /dev/null
+++ b/udev/10-vmmouse.conf
@@ -0,0 +1,7 @@
+Section "InputClass"
+	Identifier	"vmmouse"
+	MatchIsPointer	"on"
+	MatchTag	"vmmouse"
+	Driver		"vmmouse"
+EndSection
+
diff --git a/udev/69-xorg-vmmouse.rules.in b/udev/69-xorg-vmmouse.rules.in
new file mode 100644
index 0000000..0d7f028
--- /dev/null
+++ b/udev/69-xorg-vmmouse.rules.in
@@ -0,0 +1 @@
+ACTION=="add|change", ENV{ID_INPUT_MOUSE}=="?*", ATTRS{description}=="i8042 AUX port", PROGRAM="__BIN_PREFIX__/vmmouse_detect", ENV{ID_INPUT.tags}="vmmouse"
diff --git a/udev/Makefile.am b/udev/Makefile.am
new file mode 100644
index 0000000..51c7dc7
--- /dev/null
+++ b/udev/Makefile.am
@@ -0,0 +1,39 @@
+#  Copyright 2010 VMware, Inc.
+#
+#  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
+#  on the rights to use, copy, modify, merge, publish, distribute, sub
+#  license, 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
+#  VMWARE, INC. 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.
+
+if HAS_XORG_CONF_DIR
+
+confdir=$(XORG_CONF_DIR)
+dist_conf_DATA = 10-vmmouse.conf
+
+endif
+
+if HAS_UDEV_RULES_DIR
+
+udevdir=$(UDEV_RULES_DIR)
+udev_DATA = 69-xorg-vmmouse.rules
+
+$(udev_DATA): $(udev_DATA).in
+	sed -e 's|__BIN_PREFIX__|$(bindir)|g' < $< > $@
+
+EXTRA_DIST = $(udev_DATA).in
+CLEANFILES = $(udev_DATA)
+
+endif # HAS_UDEV_RULES_DIR
-- 
1.7.0.3



More information about the xorg-devel mailing list