Skip to content

Commit

Permalink
Fix parsing device capabilities
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marmarek committed Nov 8, 2024
1 parent 9763d72 commit df59251
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qubes-rpc/qubes-input-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def get_service_name(udevreturn, input_dev):
try:
devpath = [line.split("=", 1)[1] for line in udevreturn.splitlines()
if line.startswith("DEVPATH=")][0]
with open(f"/sys/{devpath}/device/capabilities/abs", "rb") as f:
abs_bytes = f.read()
# we care about only the first byte - that's where X,Y axies are
abs_caps = abs_bytes[0]
except (IndexError, FileNotFoundError):
with open(f"/sys/{devpath}/device/capabilities/abs", "r") as f:
abs_string = f.read().strip()
# we care about only the last byte - that's where X,Y axies are
abs_caps = int(abs_string[-1])
except (IndexError, FileNotFoundError, ValueError):
abs_caps = 0
if (
('ID_INPUT_TABLET' in udevreturn) or
Expand Down

0 comments on commit df59251

Please sign in to comment.