[PATCH:evdev] Add touchscreen ABS_RX/ABS_Z quirk.
Peter Hutterer
peter.hutterer at who-t.net
Tue Dec 1 16:01:14 PST 2009
Many touchscreens (e.g. HP TouchSmart) send touch events through ABS_Z and
ABS_RX instead of X/Y. ABS_X and ABS_Y are in fact dead.
For these devices, we simply map those two axes to x/y.
This patch assumes that any device with ABS_RX but not ABS_RY needs this
quirk. I haven't seen evidence to the contrary yet.
Tested on a HP TouchSmart.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c
index 17c0f01..77fc770 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -92,6 +92,7 @@
#define EVDEV_TABLET (1 << 8) /* device looks like a tablet? */
#define EVDEV_UNIGNORE_ABSOLUTE (1 << 9) /* explicitly unignore abs axes */
#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
+#define EVDEV_TOUCHSCREEN_QUIRK (1 << 11) /* ABS_Z/ABS_RX touchpad quirk */
#define MIN_KEYCODE 8
#define GLYPHS_PER_KEY 2
@@ -1149,6 +1150,14 @@ EvdevAddAbsClass(DeviceIntPtr device)
i++;
}
+ if (pEvdev->flags & EVDEV_TOUCHSCREEN_QUIRK)
+ {
+ pEvdev->axis_map[ABS_X] = -1;
+ pEvdev->axis_map[ABS_Y] = -1;
+ pEvdev->axis_map[ABS_Z] = 0;
+ pEvdev->axis_map[ABS_RX] = 1;
+ }
+
EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
if (!InitValuatorClassDeviceStruct(device, num_axes,
@@ -1864,6 +1873,14 @@ EvdevProbe(InputInfoPtr pInfo)
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
}
}
+
+ /* Touchscreens that send events through ABS_Z and ABS_RX. We
+ * assume that any device with RX but not RY falls into that
+ * category until a real-world device proves otherwise. */
+ if (TestBit(ABS_Z, pEvdev->abs_bitmask) &&
+ TestBit(ABS_RX, pEvdev->abs_bitmask) &&
+ !TestBit(ABS_RY, pEvdev->abs_bitmask))
+ pEvdev->flags |= EVDEV_TOUCHSCREEN_QUIRK;
}
}
--
1.6.5.2
More information about the xorg-devel
mailing list