2024-07-27 18:59:43 +00:00
|
|
|
diff --git a/qubes-rpc/qubes-input-trigger.orig b/qubes-rpc/qubes-input-trigger
|
2024-11-10 14:31:02 +00:00
|
|
|
index 264788e..edd40ec 100755
|
2024-07-27 18:59:43 +00:00
|
|
|
--- a/qubes-rpc/qubes-input-trigger.orig
|
|
|
|
+++ b/qubes-rpc/qubes-input-trigger
|
2024-11-10 14:31:02 +00:00
|
|
|
@@ -51,49 +51,69 @@ def get_service_name(udevreturn, input_dev):
|
2024-07-27 18:59:43 +00:00
|
|
|
('ID_INPUT_TOUCHPAD' in udevreturn) or
|
|
|
|
('QEMU_USB_Tablet' in udevreturn)
|
|
|
|
) and 'ID_INPUT_KEY' not in udevreturn:
|
|
|
|
- service = 'qubes-input-sender-tablet'
|
|
|
|
+ service = 'qubes-input-sender.tablet'
|
2024-11-10 14:31:02 +00:00
|
|
|
# if mouse report absolute events, prefer tablet service
|
|
|
|
# (0x3 is ABS_X | ABS_Y)
|
|
|
|
elif 'ID_INPUT_MOUSE' in udevreturn and abs_caps & 0x3:
|
2024-07-27 18:59:43 +00:00
|
|
|
- service = 'qubes-input-sender-tablet'
|
|
|
|
+ service = 'qubes-input-sender.tablet'
|
|
|
|
elif 'ID_INPUT_MOUSE' in udevreturn and 'ID_INPUT_KEY' not in udevreturn:
|
|
|
|
- service = 'qubes-input-sender-mouse'
|
|
|
|
+ service = 'qubes-input-sender.mouse'
|
|
|
|
elif 'ID_INPUT_KEY' in udevreturn and 'ID_INPUT_MOUSE' not in udevreturn:
|
|
|
|
- service = 'qubes-input-sender-keyboard'
|
|
|
|
+ service = 'qubes-input-sender.keyboard'
|
|
|
|
elif 'ID_INPUT_MOUSE' in udevreturn and 'ID_INPUT_KEY' in udevreturn:
|
|
|
|
- service = 'qubes-input-sender-keyboard-mouse'
|
2024-11-10 14:31:02 +00:00
|
|
|
+ service = 'qubes-input-sender.keyboardmouse'
|
2024-07-27 18:59:43 +00:00
|
|
|
|
|
|
|
if service:
|
|
|
|
- service = '{}@{}.service'.format(service, input_dev)
|
|
|
|
+ service = '{}.{}'.format(service, input_dev)
|
|
|
|
|
|
|
|
return service
|
|
|
|
|
|
|
|
|
|
|
|
def handle_service(service, action):
|
|
|
|
- retcode = subprocess.call(
|
|
|
|
- ["/bin/systemctl", "is-active", "--quiet", "service", service])
|
|
|
|
+ serviceFile = os.path.join("/etc/init.d", service)
|
|
|
|
+
|
|
|
|
+ sudo = []
|
|
|
|
+ if os.getuid() != 0:
|
|
|
|
+ sudo = ["sudo"]
|
|
|
|
+
|
|
|
|
if action == "add":
|
|
|
|
- systemctl_action = "start"
|
|
|
|
+ # create service link is not created
|
|
|
|
+ serviceFile = os.path.join("/etc/init.d", service)
|
|
|
|
+ if not os.path.exists(serviceFile):
|
|
|
|
+ subprocess.call(
|
|
|
|
+ ["/bin/ln", "-s", "/etc/init.d/qubes-input-sender", serviceFile])
|
|
|
|
+
|
|
|
|
# Ignore if service is already started
|
|
|
|
+ retcode = subprocess.call(
|
|
|
|
+ ["/sbin/rc-service","--quiet", service, "status"])
|
|
|
|
if retcode == 0:
|
|
|
|
return
|
|
|
|
+
|
|
|
|
+ subprocess.call(
|
|
|
|
+ sudo + ["/sbin/service", service, "start"])
|
|
|
|
+
|
|
|
|
elif action == "remove":
|
|
|
|
- systemctl_action = "stop"
|
|
|
|
+ # Ignore if service does not exist
|
|
|
|
+ if not os.path.exists(serviceFile):
|
|
|
|
+ return
|
|
|
|
+
|
|
|
|
# Ignore if service is not active
|
|
|
|
- if retcode != 0:
|
|
|
|
+ retcode = subprocess.call(
|
|
|
|
+ ["/sbin/rc-service", "--quiet", service, "status"])
|
|
|
|
+ if retcode == 3:
|
|
|
|
return
|
|
|
|
+
|
|
|
|
+ subprocess.call(
|
|
|
|
+ sudo + ["/sbin/service", service, "stop"])
|
|
|
|
+
|
|
|
|
+ # remove ln once stopped
|
|
|
|
+ if os.path.exists(serviceFile):
|
|
|
|
+ subprocess.call(
|
|
|
|
+ sudo + ["/bin/rm", serviceFile])
|
|
|
|
else:
|
|
|
|
print("Unknown action: %s" % action)
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
- sudo = []
|
|
|
|
- if os.getuid() != 0:
|
|
|
|
- sudo = ["sudo"]
|
|
|
|
-
|
|
|
|
- subprocess.call(
|
|
|
|
- sudo + ["/bin/systemctl", "--no-block", systemctl_action, service])
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def handle_event(input_dev, action, dom0):
|
|
|
|
udevreturn = None
|
|
|
|
if 'event' in input_dev: # if filename contains 'event'
|