tools: store virtual property in recordings

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1213>
This commit is contained in:
Ryan Hendrickson 2025-06-08 01:29:33 -04:00 committed by Marge Bot
parent 8a95c0e3c8
commit 548279abee
2 changed files with 13 additions and 11 deletions

View file

@ -56,6 +56,7 @@
#include "util-macros.h"
#include "util-mem.h"
#include "util-strings.h"
#include "util-udev.h"
#include "libinput-util.h"
static const int FILE_VERSION_NUMBER = 1;
@ -1756,6 +1757,9 @@ print_udev_properties(struct record_device *dev)
break;
}
}
iprintf(dev->fp, I_UDEV, "virtual: %s\n",
udev_device_is_virtual(udev_device) ? "true" : "false");
}
static void

View file

@ -296,13 +296,7 @@ def loop(args, recording):
print("Note that the device may not be in a neutral state now.")
def create_device_quirk(device):
try:
quirks = fetch(device, "quirks")
if not quirks:
return None
except YamlException:
return None
def create_device_quirk(device, quirks):
# Where the device has a quirk, we match on name, vendor and product.
# That's the best match we can assemble here from the info we have.
evdev = fetch(device, "evdev")
@ -323,10 +317,14 @@ def setup_quirks(recording):
overrides = None
quirks = []
for d in devices:
if "quirks" in d:
quirk = create_device_quirk(d)
if quirk:
quirks.append(quirk)
qs = d.get("quirks", [])
if not any(q.startswith("AttrIsVirtual=") for q in qs):
try:
is_virtual = d["udev"]["virtual"]
except Exception:
is_virtual = False
qs.append(f"AttrIsVirtual={int(is_virtual)}")
quirks.append(create_device_quirk(d, qs))
if not quirks:
return None