Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing device capabilities #35

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include:
- file: /r4.1/gitlab-base.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.1/gitlab-dom0.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.1/gitlab-vm.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.2/gitlab-base.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.2/gitlab-host.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.2/gitlab-vm.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.3/gitlab-base.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.3/gitlab-host.yml
project: QubesOS/qubes-continuous-integration
- file: /r4.3/gitlab-vm.yml
project: QubesOS/qubes-continuous-integration
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.split()[-1], 16)
except (IndexError, FileNotFoundError, ValueError):
abs_caps = 0
if (
('ID_INPUT_TABLET' in udevreturn) or
Expand Down