[PATCH] Add "input.mouse" capability to VMware's absolute USB mouse

Vinay Reddy vinayvinay at gmail.com
Wed Jan 30 02:01:44 PST 2008


Currently, VMware's absolute USB mouse is not correctly tagged by hald
(it only gets the "input" capability). Here's a patch that adds the
"input.mouse" capability to VMware's absolute USB mouse.

I do not have commit access to the hal repository, so I'd appreciate
it if someone could review this patch (and if everything's fine, apply
it).

Thanks,
Vinay

diff --git a/hald/linux/device.c b/hald/linux/device.c
index b55da25..99dc026 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -258,9 +258,18 @@ input_test_abs (HalDevice *d, const char *sysfs_path)
               goto out;
       num_bits = input_str_to_bitmask (s, bitmask, sizeof (bitmask));

-       if (test_bit (ABS_X, bitmask) && test_bit (ABS_Y, bitmask) &&
test_bit (ABS_PRESSURE, bitmask)) {
-               hal_device_add_capability (d, "input.touchpad");
-                goto out;
+       if (test_bit (ABS_X, bitmask) && test_bit (ABS_Y, bitmask)) {
+                if (test_bit (ABS_PRESSURE, bitmask)) {
+                        hal_device_add_capability (d, "input.touchpad");
+                        goto out;
+                } else {
+                        /*
+                         * This path is taken by VMware's USB mouse, which has
+                         * absolute axes, but no touch/pressure button.
+                         */
+                        hal_device_add_capability (d, "input.mouse");
+                        goto out;
+                }
        }

        /* TODO: Hmm; this code looks sketchy... why do we do
!test_bit on the Y axis ?? */


More information about the hal mailing list