diff options
author | Philip Langdale <philipl@fido2.homeip.net> | 2008-10-23 21:54:44 -0700 |
---|---|---|
committer | Philip Langdale <philipl@fido2.homeip.net> | 2008-10-23 21:54:44 -0700 |
commit | eb03e96c1974a3fbe1c48c56974ff32bc886c8f7 (patch) | |
tree | a0a671aa85dc18d54dcda82ab738ac3e332888a0 /tools | |
parent | 223afd09500672a7fe8a1ab5fc221001863a8bec (diff) |
Add HAL integration to support input hot plug.
* vmmouse_detect: A simple program that detects whether a vmmouse
device is present.
* hal-probe-vmmouse: A HAL callout script that uses vmmouse_detect
and overrides input.x11_driver.
* 11-x11-vmmouse.fdi: fdi descriptor that adds the callout for PS/2
mice.
Additional 'configure' variables have been added to allow for overriding
HAL paths, although this shouldn't usually be necessary.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 39 | ||||
-rwxr-xr-x | tools/hal-probe-vmmouse.in | 10 | ||||
-rw-r--r-- | tools/vmmouse_detect.c | 67 |
3 files changed, 116 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..9236c5f --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,39 @@ +# Copyright 2008 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. + +bin_PROGRAMS = @DRIVER_NAME@_detect + +SHARED_PATH = $(top_srcdir)/shared +INCLUDES = -I$(SHARED_PATH) + +@DRIVER_NAME@_detect_SOURCES = vmmouse_detect.c +@DRIVER_NAME@_detect_LDADD = $(SHARED_PATH)/lib@DRIVER_NAME@.la + +calloutsdir=$(HAL_CALLOUTS_DIR) +callouts_SCRIPTS = hal-probe-vmmouse + +hal-probe-vmmouse: + sed -e 's|__BIN_PREFIX__|$(bindir)|g' \ + -e 's|__HAL_BIN_PREFIX__|$(HAL_BIN_DIR)|g' \ + < $@.in > $@ + +EXTRA_DIST = hal-probe-vmmouse.in + +CLEANFILES = hal-probe-vmmouse diff --git a/tools/hal-probe-vmmouse.in b/tools/hal-probe-vmmouse.in new file mode 100755 index 0000000..67e6149 --- /dev/null +++ b/tools/hal-probe-vmmouse.in @@ -0,0 +1,10 @@ +#!/bin/bash + +[ -x __HAL_BIN_PREFIX__/hal-set-property ] || exit 0 +[ -x __BIN_PREFIX__/vmmouse_detect ] || exit 0 + +__BIN_PREFIX__/vmmouse_detect +if [ $? -eq 0 ]; then + __HAL_BIN_PREFIX__/hal-set-property --direct --udi "$UDI" --key input.x11_driver --string "vmmouse" +fi + diff --git a/tools/vmmouse_detect.c b/tools/vmmouse_detect.c new file mode 100644 index 0000000..e5f14a3 --- /dev/null +++ b/tools/vmmouse_detect.c @@ -0,0 +1,67 @@ +/* + * Copyright 2007 by 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 + * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + + +#include <stdlib.h> +#include <signal.h> +#include "vmmouse_client.h" + +void +segvCB(int sig) +{ + exit(1); +} + + +int +main(void) +{ + /* + * If the vmmouse test is not run in a VMware virtual machine, it + * will segfault instead of successfully accessing the port. + */ + signal(SIGSEGV, segvCB); + +#if defined __i386__ || defined __x86_64__ + /* + * To access i/o ports above 0x3ff, we need to be in iopl(3). + */ + + iopl(3); + if (VMMouseClient_Enable()) { + VMMouseClient_Disable(); + return 0; + } else { + /* + * We get here if we are running in a VM and the vmmouse + * device is disabled. + */ + return 1; + } +#endif + return 1; +} |