[patch 2/2] evdev fix for VMware's USB mouse

Vinay Reddy vinayvinay at gmail.com
Mon Jan 28 05:18:09 PST 2008


VMware's absolute pointing device does not have a pressure/touch
button. Although evdev correctly recognizes this, it sets "use_touch"
for X and Y axes regardless of the touch button. This patch clears the
USE_TOUCH flag for all enabled axes if the device does not have a
touch button.

I'd appreciate any comments/reviews for this patch.

Thanks,
Vinay

diff --git a/src/evdev_axes.c b/src/evdev_axes.c
index e967c61..e78d6fd 100644
--- a/src/evdev_axes.c
+++ b/src/evdev_axes.c
@@ -709,6 +709,7 @@ EvdevAxisAbsNew1(InputInfoPtr pInfo)

     {
        int btn;
+        int i;

        s = xf86SetStrOption(pInfo->options, "AbsoluteTouch", "DIGI_Touch");
        btn = EvdevBtnFind (pInfo, s);
@@ -719,6 +720,16 @@ EvdevAxisAbsNew1(InputInfoPtr pInfo)
                xf86Msg(X_ERROR, "%s: state->btn: %p.\n", pInfo->name,
state->btn);
                state->btn->callback[btn] = &EvdevAxesTouchCallback;
            } else {
+
+                /*
+                 * If the device does not have a touch button, then clear
+                 * EV_ABS_V_USE_TOUCH which we may have set in EvdevAxisAbsNew.
+                 */
+                for (i = 0; i < ABS_MAX; i++) {
+                    if (state->abs->v_flags[i] & EV_ABS_V_PRESENT) {
+                        state->abs->v_flags[i] &= ~EV_ABS_V_USE_TOUCH;
+                    }
+                }
                xf86Msg(X_ERROR, "%s: AbsoluteTouch: '%s' does not
exist.\n", pInfo->name, s);
            }
        } else {



More information about the xorg mailing list