touchpad: add touch state debugging to the palm and tap state debug logs
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 28 May 2020 00:33:21 +0000 (10:33 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 3 Jun 2020 21:50:44 +0000 (21:50 +0000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad-tap.c
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h

index 7b5de8b..d5d4a79 100644 (file)
@@ -803,8 +803,9 @@ tp_tap_handle_event(struct tp_dispatch *tp,
 
        if (current != tp->tap.state)
                evdev_log_debug(tp->device,
-                         "tap: touch %d state %s → %s → %s\n",
+                         "tap: touch %d (%s), tap state %s → %s → %s\n",
                          t ? (int)t->index : -1,
+                         t ? touch_state_to_str(t->state) : "",
                          tap_state_to_str(current),
                          tap_event_to_str(event),
                          tap_state_to_str(tp->tap.state));
index 0030682..df74505 100644 (file)
@@ -1201,8 +1201,9 @@ out:
                break;
        }
        evdev_log_debug(tp->device,
-                 "palm: touch %d, palm detected (%s)\n",
+                 "palm: touch %d (%s), palm detected (%s)\n",
                  t->index,
+                 touch_state_to_str(t->state),
                  palm_state);
 }
 
index 75a87d4..3a33a6a 100644 (file)
@@ -53,6 +53,20 @@ enum touch_state {
        TOUCH_END = 5,
 };
 
+static inline const char *
+touch_state_to_str(enum touch_state state)
+{
+       switch(state) {
+       CASE_RETURN_STRING(TOUCH_NONE);
+       CASE_RETURN_STRING(TOUCH_HOVERING);
+       CASE_RETURN_STRING(TOUCH_BEGIN);
+       CASE_RETURN_STRING(TOUCH_UPDATE);
+       CASE_RETURN_STRING(TOUCH_MAYBE_END);
+       CASE_RETURN_STRING(TOUCH_END);
+       }
+       return NULL;
+}
+
 enum touch_palm_state {
        PALM_NONE = 0,
        PALM_EDGE,