summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-01-07 15:49:02 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-01-20 15:38:13 +1000
commit7d5c35ccd06713d59082b464c7cc579dd2e7c269 (patch)
tree8379f5542bfe7d78936a14326f40e4e181c75479 /src
parentff2ee2c681b3e8d4b176c30ad3fafbf1c5c69d6d (diff)
touchpad: check fake finger count for validity
Setting TRIPLETAP unsets DOUBLETAP, etc. This doesn't usually happen with kernel devices, but every once in a while I get this wrong in a test and spend hours debugging the code... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index b2461fd0..e4821c08 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -140,6 +140,14 @@ tp_get_touch(struct tp_dispatch *tp, unsigned int slot)
static inline unsigned int
tp_fake_finger_count(struct tp_dispatch *tp)
{
+ /* Only one of BTN_TOOL_DOUBLETAP/TRIPLETAP/... may be set at any
+ * time */
+ if (__builtin_popcount(
+ tp->fake_touches & ~(FAKE_FINGER_OVERFLOW|0x1)) > 1)
+ log_bug_kernel(tp->device->base.seat->libinput,
+ "Invalid fake finger state %#x\n",
+ tp->fake_touches);
+
if (tp->fake_touches & FAKE_FINGER_OVERFLOW)
return FAKE_FINGER_OVERFLOW;
else /* don't count BTN_TOUCH */