mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 18:10:06 +01:00
evdev: print the timestamps for events when debugging events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6c8068601a
commit
96dd43cd30
1 changed files with 36 additions and 9 deletions
45
src/evdev.c
45
src/evdev.c
|
|
@ -808,6 +808,40 @@ evdev_read_switch_reliability_prop(struct evdev_device *device)
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline void
|
||||
evdev_print_event(struct evdev_device *device,
|
||||
const struct input_event *e)
|
||||
{
|
||||
static uint32_t offset = 0;
|
||||
static uint32_t last_time = 0;
|
||||
uint32_t time = us2ms(tv2us(&e->time));
|
||||
|
||||
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,
|
||||
"%u.%03u -------------- EV_SYN ------------ +%ums\n",
|
||||
time / 1000,
|
||||
time % 1000,
|
||||
time - last_time);
|
||||
|
||||
last_time = time;
|
||||
} else {
|
||||
evdev_log_debug(device,
|
||||
"%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)
|
||||
{
|
||||
|
|
@ -815,16 +849,9 @@ evdev_process_event(struct evdev_device *device, struct input_event *e)
|
|||
uint64_t time = tv2us(&e->time);
|
||||
|
||||
#if 0
|
||||
if (libevdev_event_is_code(e, EV_SYN, SYN_REPORT))
|
||||
evdev_log_debug(device,
|
||||
"-------------- EV_SYN ------------\n");
|
||||
else
|
||||
evdev_log_debug(device,
|
||||
"%-16s %-20s %4d\n",
|
||||
libevdev_event_type_get_name(e->type),
|
||||
libevdev_event_code_get_name(e->type, e->code),
|
||||
e->value);
|
||||
evdev_print_event(device, e);
|
||||
#endif
|
||||
|
||||
libinput_timer_flush(evdev_libinput_context(device), time);
|
||||
|
||||
dispatch->interface->process(dispatch, device, e, time);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue