summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-05-05 10:41:03 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2022-05-10 09:52:04 +1000
commit5d4ef8ac9088427dabbe5b6d5e367bb44c1d59bc (patch)
tree16da1fb0280ccd67b2d1d3594ea4ad107481e922
parent1b7d64565cda276dbd20e0b67a9bb88ef538a7f3 (diff)
downloadxf86-input-wacom-5d4ef8ac9088427dabbe5b6d5e367bb44c1d59bc.tar.gz
test: fix the ID assignment when parsing a device file
Because InputId didn't have the same field order as the recording (to allow for default bustype, vid and version), we ended up with an erroneous vendor ID, causing some code paths in the driver to go the non-wacom path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com>
-rw-r--r--test/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/__init__.py b/test/__init__.py
index e6d93fa..f216239 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -49,6 +49,11 @@ class InputId:
vendor: int = attr.ib(default=0x56A)
version: int = attr.ib(default=0)
+ @classmethod
+ def from_list(cls, ids: List[int]) -> "InputId":
+ bus, vid, pid, version = ids
+ return cls(bustype=bus, vendor=vid, product=pid, version=vid)
+
@attr.s
class Device:
@@ -117,7 +122,7 @@ class Device:
continue
name = d["name"]
- id = InputId(*[int(i, 16) for i in d["id"]])
+ id = InputId.from_list([int(i, 16) for i in d["id"]])
bits = [libevdev.evbit(b) for b in d["bits"]]
abs = {
libevdev.evbit(n): libevdev.InputAbsInfo(*v)