summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2010-04-01 18:35:38 +0200
committerMichel Dänzer <daenzer@vmware.com>2010-04-08 16:10:33 +0200
commit80f671233e583ae085986bce12057fc45da444aa (patch)
tree28cddb2b57583d8b59be126afd44a91ae54baede
parentb9c3bc94ee86a72216e9738aaecede80cc1c043c (diff)
Add InputClass support.
The InputClass can match the tag "vmmouse". A sample xorg.conf.d snippet is provided to try and make sure the driver will be loaded automatically in a compatible VM also if the X server uses udev instead of HAL. The configure script tries to determine if and where it makes sense to install the udev rule and xorg.conf.d snippet but allows overriding both. Thanks to Timo Aaltonen for the udev rules file and Dan Nicholson and Simon Thum for review and suggestions for improvement.
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac31
-rw-r--r--tools/50-vmmouse.conf7
-rw-r--r--tools/69-xorg-vmmouse.rules.in1
-rw-r--r--tools/Makefile.am20
-rwxr-xr-xtools/hal-probe-vmmouse.in1
6 files changed, 63 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index daf09d4..f1ad5af 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,6 +18,9 @@
# 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.
+# 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
MAINTAINERCLEANFILES = ChangeLog INSTALL
.PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index e39fcbb..7623b98 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)
diff --git a/tools/50-vmmouse.conf b/tools/50-vmmouse.conf
new file mode 100644
index 0000000..35c438e
--- /dev/null
+++ b/tools/50-vmmouse.conf
@@ -0,0 +1,7 @@
+Section "InputClass"
+ Identifier "vmmouse"
+ MatchIsPointer "on"
+ MatchTag "vmmouse"
+ Driver "vmmouse"
+EndSection
+
diff --git a/tools/69-xorg-vmmouse.rules.in b/tools/69-xorg-vmmouse.rules.in
new file mode 100644
index 0000000..0d7f028
--- /dev/null
+++ b/tools/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/tools/Makefile.am b/tools/Makefile.am
index f5b8902..8c40369 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -36,3 +36,23 @@ hal-probe-vmmouse: hal-probe-vmmouse.in
EXTRA_DIST = hal-probe-vmmouse.in
CLEANFILES = hal-probe-vmmouse
+
+if HAS_XORG_CONF_DIR
+
+confdir=$(XORG_CONF_DIR)
+dist_conf_DATA = 50-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
diff --git a/tools/hal-probe-vmmouse.in b/tools/hal-probe-vmmouse.in
index 1f75e25..42c9da3 100755
--- a/tools/hal-probe-vmmouse.in
+++ b/tools/hal-probe-vmmouse.in
@@ -26,5 +26,6 @@
__BIN_PREFIX__/vmmouse_detect
if [ $? -eq 0 ]; then
__HAL_BIN_PREFIX__/hal-set-property --direct --udi "$UDI" --key input.x11_driver --string "vmmouse"
+ __HAL_BIN_PREFIX__/hal-set-property --direct --udi "$UDI" --key input.tags --string "vmmouse"
fi