From fdb693a6ee44e16df8b371d19021b6490f4d5079 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 4 Jun 2024 16:44:04 +1000 Subject: [PATCH] tools/record: record the DRIVER property in the recording So we know which kernel driver is handling the device. Quite useful, sometimes, without having to ask for extra logs. This of course requires that we ignore said property in libinput replay since no uinput device will have that driver property set. Part-of: --- tools/libinput-record.c | 10 ++++++++++ tools/libinput-replay.py | 11 +++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/libinput-record.c b/tools/libinput-record.c index c1b20ef6..0c1dc9cf 100644 --- a/tools/libinput-record.c +++ b/tools/libinput-record.c @@ -1757,6 +1757,16 @@ print_udev_properties(struct record_device *dev) entry = udev_list_entry_get_next(entry); } + for (struct udev_device *parent = udev_device; + parent; + parent = udev_device_get_parent(parent)) { + const char *driver = udev_device_get_property_value(parent, "DRIVER"); + if (driver) { + iprintf(dev->fp, I_UDEV_DATA, "- DRIVER=%s\n", driver); + break; + } + } + out: udev_device_unref(udev_device); udev_unref(udev); diff --git a/tools/libinput-replay.py b/tools/libinput-replay.py index c24cb8ca..85da4006 100755 --- a/tools/libinput-replay.py +++ b/tools/libinput-replay.py @@ -71,14 +71,13 @@ def check_udev_properties(yaml_data, uinput): """ yaml_udev_section = fetch(yaml_data, "udev") yaml_udev_props = fetch(yaml_udev_section, "properties") + + ignore = ["LIBINPUT_DEVICE_GROUP", "DRIVER"] yaml_props = { - k: v for (k, v) in [prop.split("=", maxsplit=1) for prop in yaml_udev_props] + k: v + for (k, v) in [prop.split("=", maxsplit=1) for prop in yaml_udev_props] + if k not in ignore } - try: - # We don't assign this one to virtual devices - del yaml_props["LIBINPUT_DEVICE_GROUP"] - except KeyError: - pass # give udev some time to catch up time.sleep(0.2)