[RFC vmmouse] Install support files to try and have the driver loaded automatically via udev.
Dan Nicholson
dbn.lists at gmail.com
Thu Apr 1 14:47:37 PDT 2010
2010/4/1 Michel Dänzer <michel at daenzer.net>:
> From: Michel Dänzer <daenzer at vmware.com>
>
> ---
> Makefile.am | 2 +-
> configure.ac | 32 +++++++++++++++++++++++++++++++-
> udev/10-vmmouse.conf | 7 +++++++
> udev/69-xorg-vmmouse.rules.in | 1 +
> udev/Makefile.am | 39 +++++++++++++++++++++++++++++++++++++++
> 5 files changed, 79 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..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. It gets a little tricky with the fact that the server
will actually look in a bunch of different directories and use the
first one it finds files in.
> 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,28 @@ AC_ARG_WITH(hal-fdi-dir,
> HAL_FDI_DIR=${halfdidir}
> AC_SUBST(HAL_FDI_DIR)
>
> +case $host_os in
> + linux*)
> + IS_LINUX="yes"
You need a ;; to end a shell case. Did this actually run?
> +esac
> +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.
> +
> +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 +145,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"
What does vmmouse_detect do? Oh, I guess it only detects the mouse if
you're actually in the VM? Nice, clean usage of PROGRAM and tags.
> diff --git a/udev/Makefile.am b/udev/Makefile.am
> new file mode 100644
> index 0000000..39f1653
> --- /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.
> +
> +confdir=$(XORG_CONF_DIR)
> +conf_DATA = 10-vmmouse.conf
> +
> +EXTRA_DIST = $(conf_DATA)
Change conf_DATA to dist_conf_DATA and you can drop the EXTRA_DIST.
> +
> +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' < $< > $@
> +
> +EXTRA_DIST += $(conf_DATA) $(udev_DATA).in
You already have the $(conf_DATA) above.
> +
> +CLEANFILES = $(udev_DATA)
> +
> +endif # LINUX
> --
> 1.7.0.3
Looks pretty good. With the few changes above,
Acked-by: Dan Nicholson <dbn.lists at gmail.com>
More information about the xorg-devel
mailing list