Antoine Martin
7d9253d8c9
All checks were successful
/ lint (pull_request) Successful in 26s
/ deploy-v3.20 (pull_request) Successful in 29s
/ build-v3.20 (pull_request) Successful in 1m14s
/ deploy-edge (pull_request) Successful in 29s
/ build-edge (pull_request) Successful in 1m20s
/ deploy-v3.21 (pull_request) Successful in 27s
/ build-v3.21 (pull_request) Successful in 1m8s
93 lines
3.2 KiB
Diff
93 lines
3.2 KiB
Diff
diff --git a/qubes-rpc/qubes-input-trigger.orig b/qubes-rpc/qubes-input-trigger
|
|
index 264788e..edd40ec 100755
|
|
--- a/qubes-rpc/qubes-input-trigger.orig
|
|
+++ b/qubes-rpc/qubes-input-trigger
|
|
@@ -51,49 +51,69 @@ def get_service_name(udevreturn, input_dev):
|
|
('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'
|
|
# 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'
|
|
+ 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'
|
|
+ service = 'qubes-input-sender.mouse'
|
|
|
|
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'
|