mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 06:50:05 +01:00
tools: store virtual property in recordings
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1213>
This commit is contained in:
parent
8a95c0e3c8
commit
548279abee
2 changed files with 13 additions and 11 deletions
|
|
@ -56,6 +56,7 @@
|
||||||
#include "util-macros.h"
|
#include "util-macros.h"
|
||||||
#include "util-mem.h"
|
#include "util-mem.h"
|
||||||
#include "util-strings.h"
|
#include "util-strings.h"
|
||||||
|
#include "util-udev.h"
|
||||||
#include "libinput-util.h"
|
#include "libinput-util.h"
|
||||||
|
|
||||||
static const int FILE_VERSION_NUMBER = 1;
|
static const int FILE_VERSION_NUMBER = 1;
|
||||||
|
|
@ -1756,6 +1757,9 @@ print_udev_properties(struct record_device *dev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iprintf(dev->fp, I_UDEV, "virtual: %s\n",
|
||||||
|
udev_device_is_virtual(udev_device) ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -296,13 +296,7 @@ def loop(args, recording):
|
||||||
print("Note that the device may not be in a neutral state now.")
|
print("Note that the device may not be in a neutral state now.")
|
||||||
|
|
||||||
|
|
||||||
def create_device_quirk(device):
|
def create_device_quirk(device, quirks):
|
||||||
try:
|
|
||||||
quirks = fetch(device, "quirks")
|
|
||||||
if not quirks:
|
|
||||||
return None
|
|
||||||
except YamlException:
|
|
||||||
return None
|
|
||||||
# Where the device has a quirk, we match on name, vendor and product.
|
# 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.
|
# That's the best match we can assemble here from the info we have.
|
||||||
evdev = fetch(device, "evdev")
|
evdev = fetch(device, "evdev")
|
||||||
|
|
@ -323,10 +317,14 @@ def setup_quirks(recording):
|
||||||
overrides = None
|
overrides = None
|
||||||
quirks = []
|
quirks = []
|
||||||
for d in devices:
|
for d in devices:
|
||||||
if "quirks" in d:
|
qs = d.get("quirks", [])
|
||||||
quirk = create_device_quirk(d)
|
if not any(q.startswith("AttrIsVirtual=") for q in qs):
|
||||||
if quirk:
|
try:
|
||||||
quirks.append(quirk)
|
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:
|
if not quirks:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue