[PATCH evdev] Only force REL_X/Y if no ABS_X/Y exists

Peter Hutterer peter.hutterer at who-t.net
Tue Jan 24 22:26:26 PST 2012


5c5b2c8db851df7921cedd888222a6630a007fd8 added forced x/y axes if a device
has any axes of the same mode. This was too broad a brush, some devices have
a relative wheel but absolute x/y axes and would now get misdetected as
purely relative device.

Only force relative axes if a device no rel x/y _and_ no abs x/y.

Reproducible: virtual machine with QEMU USB Tablet will stop working

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 32fe38b..a6f9a59 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2125,6 +2125,13 @@ EvdevProbe(InputInfoPtr pInfo)
         }
     }
 
+    for (i = 0; i < ABS_MAX; i++) {
+        if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
+            has_abs_axes = TRUE;
+            break;
+        }
+    }
+
     if (has_rel_axes) {
         if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL) ||
             EvdevBitIsSet(pEvdev->rel_bitmask, REL_HWHEEL) ||
@@ -2146,7 +2153,9 @@ EvdevProbe(InputInfoPtr pInfo)
             if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) &&
                 EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y)) {
                 xf86IDrvMsg(pInfo, X_PROBED, "Found x and y relative axes\n");
-            } else
+            } else if (!has_abs_axes ||
+                       !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) ||
+                       !EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y))
                 EvdevForceXY(pInfo, Relative);
         } else {
             xf86IDrvMsg(pInfo, X_INFO, "Relative axes present but ignored.\n");
@@ -2154,13 +2163,6 @@ EvdevProbe(InputInfoPtr pInfo)
         }
     }
 
-    for (i = 0; i < ABS_MAX; i++) {
-        if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
-            has_abs_axes = TRUE;
-            break;
-        }
-    }
-
 #ifdef MULTITOUCH
     for (i = ABS_MT_SLOT; i < ABS_MAX; i++) {
         if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
-- 
1.7.7.5



More information about the xorg-devel mailing list