[PATCH libinput 2/8] evdev: print the timestamps for events when debugging events
Peter Hutterer
peter.hutterer at who-t.net
Thu Nov 9 05:08:45 UTC 2017
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev.c | 43 +++++++++++++++++++++++++++++++++++--------
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c
index c490cae0..17303096 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -809,22 +809,49 @@ evdev_read_switch_reliability_prop(struct evdev_device *device)
}
static inline void
-evdev_process_event(struct evdev_device *device, struct input_event *e)
+evdev_print_event(struct evdev_device *device,
+ const struct input_event *e)
{
- struct evdev_dispatch *dispatch = device->dispatch;
- uint64_t time = tv2us(&e->time);
+ static uint32_t offset = 0;
+ static uint32_t last_time = 0;
+ uint32_t time = us2ms(tv2us(&e->time));
-#if 0
- if (libevdev_event_is_code(e, EV_SYN, SYN_REPORT))
+ if (offset == 0) {
+ offset = time;
+ last_time = time - offset;
+ }
+
+ time -= offset;
+
+ if (libevdev_event_is_code(e, EV_SYN, SYN_REPORT)) {
evdev_log_debug(device,
- "-------------- EV_SYN ------------\n");
- else
+ "%u.%03u -------------- EV_SYN ------------ +%ums\n",
+ time / 1000,
+ time % 1000,
+ time - last_time);
+
+ last_time = time;
+ } else {
evdev_log_debug(device,
- "%-16s %-20s %4d\n",
+ "%u.%03u %-16s %-20s %4d\n",
+ time / 1000,
+ time % 1000,
libevdev_event_type_get_name(e->type),
libevdev_event_code_get_name(e->type, e->code),
e->value);
+ }
+}
+
+static inline void
+evdev_process_event(struct evdev_device *device, struct input_event *e)
+{
+ struct evdev_dispatch *dispatch = device->dispatch;
+ uint64_t time = tv2us(&e->time);
+
+#if 0
+ evdev_print_event(device, e);
#endif
+
libinput_timer_flush(evdev_libinput_context(device), time);
dispatch->interface->process(dispatch, device, e, time);
--
2.13.6
More information about the wayland-devel
mailing list