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: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1007>
This commit is contained in:
Peter Hutterer 2024-06-04 16:44:04 +10:00
parent f1792dec46
commit fdb693a6ee
2 changed files with 15 additions and 6 deletions

View file

@ -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);

View file

@ -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)