From 7a22eb8d089bb8895dfc3228440745a64b637616 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 21 Jul 2025 09:45:09 +1000 Subject: [PATCH] plugin/evdev: drop the duplicate event frame printing The plugin system prints all events before they're passed to the plugin anyway and the special evdev plugin does not do anything but pass it on. We can thus assume that the events passed to libinput are the same as the ones passed to this plugin. Let's do that and adjust the print format to be closer to what evdev_log_debug() would print. Part-of: --- src/evdev-plugin.c | 59 ------------------------------------------- src/libinput-plugin.c | 8 +++--- 2 files changed, 4 insertions(+), 63 deletions(-) diff --git a/src/evdev-plugin.c b/src/evdev-plugin.c index 045d2771..ff880569 100644 --- a/src/evdev-plugin.c +++ b/src/evdev-plugin.c @@ -29,61 +29,6 @@ #include "evdev-plugin.h" #include "evdev.h" -_unused_ static inline void -evdev_print_frame(struct evdev_device *device, - struct evdev_frame *frame, - uint64_t time_in_us) -{ - static uint32_t offset = 0; - static uint32_t last_time = 0; - uint32_t time = us2ms(time_in_us); - - if (offset == 0) { - offset = time; - last_time = time - offset; - } - - time -= offset; - - size_t nevents; - struct evdev_event *events = evdev_frame_get_events(frame, &nevents); - - for (size_t i = 0; i < nevents; i++) { - struct evdev_event *e = &events[i]; - - switch (evdev_usage_enum(e->usage)) { - case EVDEV_SYN_REPORT: - evdev_log_debug( - device, - "%u.%03u ----------------- EV_SYN ----------------- +%ums\n", - time / 1000, - time % 1000, - time - last_time); - - last_time = time; - break; - case EVDEV_MSC_SERIAL: - evdev_log_debug(device, - "%u.%03u %-16s %-16s %#010x\n", - time / 1000, - time % 1000, - evdev_event_get_type_name(e), - evdev_event_get_code_name(e), - e->value); - break; - default: - evdev_log_debug(device, - "%u.%03u %-16s %-20s %4d\n", - time / 1000, - time % 1000, - evdev_event_get_type_name(e), - evdev_event_get_code_name(e), - e->value); - break; - } - } -} - static inline void evdev_process_frame(struct evdev_device *device, struct evdev_frame *frame, @@ -91,10 +36,6 @@ evdev_process_frame(struct evdev_device *device, { struct evdev_dispatch *dispatch = device->dispatch; -#if EVENT_DEBUGGING - evdev_print_frame(device, frame, time); -#endif - libinput_timer_flush(evdev_libinput_context(device), time); dispatch->interface->process(dispatch, device, frame, time); diff --git a/src/libinput-plugin.c b/src/libinput-plugin.c index 87ba8e7e..fd6f9a89 100644 --- a/src/libinput-plugin.c +++ b/src/libinput-plugin.c @@ -603,10 +603,10 @@ plugin_system_notify_evdev_frame(struct libinput_plugin_system *system, continue; } #ifdef EVENT_DEBUGGING - _autofree_ char *prefix = - strdup_printf("plugin %-25s - %s:", - plugin->name, - libinput_device_get_name(event->device)); + _autofree_ char *prefix = strdup_printf( + "%7s: plugin %-15s - ", + libinput_device_get_sysname(event->device), + plugin->name); print_frame(libinput_device_get_context(device), event->frame, prefix);