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

Replace PiKVM special handling with more generic one #34

Merged
merged 1 commit into from
Nov 8, 2024
Merged
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
14 changes: 12 additions & 2 deletions qubes-rpc/qubes-input-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,25 @@ def get_args():

def get_service_name(udevreturn, input_dev):
service = None
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):
abs_caps = 0
if (
('ID_INPUT_TABLET' in udevreturn) or
('ID_INPUT_TOUCHSCREEN' in udevreturn) or
('ID_INPUT_TOUCHPAD' in udevreturn) or
('QEMU_USB_Tablet' in udevreturn)
) and 'ID_INPUT_KEY' not in udevreturn:
service = 'qubes-input-sender-tablet'
# PiKVM "mouse" is special, as it sends absolute events
elif 'ID_INPUT_MOUSE' in udevreturn and 'ID_USB_VENDOR=PiKVM' in udevreturn:
# if mouse report absolute events, prefer tablet service
# (0x3 is ABS_X | ABS_Y)
elif 'ID_INPUT_MOUSE' in udevreturn and abs_caps & 0x3:
service = 'qubes-input-sender-tablet'
elif 'ID_INPUT_MOUSE' in udevreturn and 'ID_INPUT_KEY' not in udevreturn:
service = 'qubes-input-sender-mouse'
Expand Down