Skip to content

Commit df59251

Browse files
committed
Fix parsing device capabilities
It's ascii, not binary. Fortunately, for mouse reporting relative or absolute X,Y events only the result is the same. QubesOS/qubes-issues#9563
1 parent 9763d72 commit df59251

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

qubes-rpc/qubes-input-trigger

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ def get_service_name(udevreturn, input_dev):
3939
try:
4040
devpath = [line.split("=", 1)[1] for line in udevreturn.splitlines()
4141
if line.startswith("DEVPATH=")][0]
42-
with open(f"/sys/{devpath}/device/capabilities/abs", "rb") as f:
43-
abs_bytes = f.read()
44-
# we care about only the first byte - that's where X,Y axies are
45-
abs_caps = abs_bytes[0]
46-
except (IndexError, FileNotFoundError):
42+
with open(f"/sys/{devpath}/device/capabilities/abs", "r") as f:
43+
abs_string = f.read().strip()
44+
# we care about only the last byte - that's where X,Y axies are
45+
abs_caps = int(abs_string[-1])
46+
except (IndexError, FileNotFoundError, ValueError):
4747
abs_caps = 0
4848
if (
4949
('ID_INPUT_TABLET' in udevreturn) or

0 commit comments

Comments
 (0)