[RFC vmmouse] Install support files to try and have the driver loaded automatically via udev.
Michel Dänzer
michel at daenzer.net
Tue Apr 6 11:10:30 PDT 2010
On Thu, 2010-04-01 at 14:47 -0700, Dan Nicholson wrote:
> >
> > diff --git a/configure.ac b/configure.ac
> > index e39fcbb..b3d006f 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=$libdir/X11/xorg.conf.d]]]),
> > + [xorgconfdir="$withval"],
> > + [xorgconfdir="$libdir/X11/xorg.conf.d"])
> > +XORG_CONF_DIR=${xorgconfdir}
> > +AC_SUBST(XORG_CONF_DIR)
>
> I think you want this to default to $sysconfdir/X11/xorg.conf.d rather
> than $libdir/X11/xorg.conf.d. We might think about exporting this from
> xorg-server.pc.
Yeah, I'm leaning towards relying on that instead of making any other
guesses.
Unfortunately, the new patch below breaks distcheck:
Making install in udev
make[2]: Entering directory `/home/daenzer/src/xorg-git/driver/xf86-input-vmmouse/build-amd64/xf86-input-vmmouse-12.6.7/_build/udev'
make[3]: Entering directory `/home/daenzer/src/xorg-git/driver/xf86-input-vmmouse/build-amd64/xf86-input-vmmouse-12.6.7/_build/udev'
make[3]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/X11/xorg.conf.d" || /bin/mkdir -p "/usr/local/share/X11/xorg.conf.d"
/bin/mkdir: cannot create directory `/usr/local/share/X11/xorg.conf.d': Permission denied
make[3]: *** [install-dist_confDATA] Error 1
make[3]: Leaving directory `/home/daenzer/src/xorg-git/driver/xf86-input-vmmouse/build-amd64/xf86-input-vmmouse-12.6.7/_build/udev'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/daenzer/src/xorg-git/driver/xf86-input-vmmouse/build-amd64/xf86-input-vmmouse-12.6.7/_build/udev'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/daenzer/src/xorg-git/driver/xf86-input-vmmouse/build-amd64/xf86-input-vmmouse-12.6.7/_build'
make: *** [distcheck] Error 1
Any idea what's going on?
make -C build-amd64 install DESTDIR=$PWD/build-amd64/install
works fine.
> > @@ -85,6 +93,28 @@ AC_ARG_WITH(hal-fdi-dir,
> > HAL_FDI_DIR=${halfdidir}
> > AC_SUBST(HAL_FDI_DIR)
> >
> > +case $host_os in
> > + linux*)
> > + IS_LINUX="yes"
> > +esac
>
> You need a ;; to end a shell case. Did this actually run?
Yeah, maybe my shell is too forgiving… Fixed now, thanks.
> > +AM_CONDITIONAL(LINUX, [test "x$IS_LINUX" = xyes])
> > +
> > +if test "x$prefix" = "xNONE" -o "x$prefix" = "x/usr" -o "x$prefix" = "x/usr/local" ; then
> > + slashlibdir=/lib
> > +else
> > + slashlibdir=$prefix/lib
> > +fi
> > +AC_SUBST(slashlibdir)
>
> You don't have to AC_SUBST this variable since it's not used outside
> the configure script.
Right, it was used originally but not anymore.
> > +
> > +if LINUX
> > +
> > +udevdir=$(UDEV_RULES_DIR)
> > +udev_DATA = 69-xorg-vmmouse.rules
> > +
> > +$(udev_DATA):
> > + sed -e 's|__BIN_PREFIX__|$(bindir)|g' \
> > + < $(srcdir)/$@.in > $@
>
> I think you want to just make $(udev_DATA).in a prereq and then
> make/automake will take care of the rest if you use $<. That would
> also ensure proper rebuilds if the .in file got updated for some
> reason.
>
> $(udev_DATA): $(udev_DATA).in
> sed -e 's|__BIN_PREFIX__|$(bindir)|g' < $< > $@
Nice suggestion.
> > +
> > +EXTRA_DIST += $(conf_DATA) $(udev_DATA).in
>
> You already have the $(conf_DATA) above.
Yeah, copy & paste considered harmful. :}
Something else I'm wondering: Does it make sense to install the
xorg.conf.d snippet unconditionally, or will it hurt with the server
using HAL?
From 141d8a20fe90b2b33446e58fafcbac073fb93a98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <daenzer at vmware.com>
Date: Thu, 1 Apr 2010 18:35:38 +0200
Subject: [PATCH] Install support files to try and have the driver loaded automatically via udev.
Thanks to Timo Aaltonen for the udev rules file and Dan Nicholson for review
and suggestions for improvement.
---
Makefile.am | 2 +-
configure.ac | 36 +++++++++++++++++++++++++++++++++++-
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..7af5803 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@
# 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
+SUBDIRS = shared src tools fdi man udev
MAINTAINERCLEANFILES = ChangeLog INSTALL
.PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index e39fcbb..01d30ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,18 @@ AC_ARG_WITH(xorg-module-dir,
inputdir=${moduledir}/input
AC_SUBST(inputdir)
+sysconfigdir=$(pkg-config --variable=sysconfigdir xorg-server)
+
+AC_ARG_WITH(xorg-conf-dir,
+ AC_HELP_STRING([--with-xorg-conf-dir=DIR],
+ [Default xorg.conf.d directory [[default=$sysconfigdir]]]),
+ [xorgconfdir="$withval"],
+ [xorgconfdir="$sysconfigdir"])
+XORG_CONF_DIR=${xorgconfdir}
+AC_SUBST(XORG_CONF_DIR)
+
+AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$XORG_CONF_DIR" != x])
+
AC_ARG_WITH(hal-bin-dir,
AC_HELP_STRING([--with-hal-bin-dir=DIR],
[Directory where HAL binaries where installed [[default=$bindir]]]),
@@ -85,6 +97,28 @@ AC_ARG_WITH(hal-fdi-dir,
HAL_FDI_DIR=${halfdidir}
AC_SUBST(HAL_FDI_DIR)
+case $host_os in
+ linux*)
+ HAS_UDEV="yes"
+ ;;
+esac
+AM_CONDITIONAL(HAS_UDEV, [test "x$HAS_UDEV" = xyes])
+
+if test "x$prefix" = "xNONE" -o "x$prefix" = "x/usr" -o "x$prefix" = "x/usr/local" ; then
+ slashlibdir=/lib
+else
+ slashlibdir=$prefix/lib
+fi
+
+AC_ARG_WITH(udev-rules-dir,
+ AC_HELP_STRING([--with-udev-rules-dir=DIR],
+ [Default udev rules.d directory
+ [[default=$slashlibdir/udev/rules.d]]]),
+ [udevrulesdir="$withval"],
+ [udevrulesdir="$slashlibdir/udev/rules.d"])
+UDEV_RULES_DIR=${udevrulesdir}
+AC_SUBST(UDEV_RULES_DIR)
+
# Checks for extensions
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
@@ -115,4 +149,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..3e2639c
--- /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
+
+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
--
1.7.0.3
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
More information about the xorg-devel
mailing list