]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
container: Extend nfcd stop/start hacks to systemd
authorJami Kettunen <jami.kettunen@protonmail.com>
Mon, 23 Jan 2023 15:54:43 +0000 (17:54 +0200)
committerAlessandro Astone <ales.astone@gmail.com>
Mon, 23 Jan 2023 16:46:24 +0000 (17:46 +0100)
Toggling NFC on Ubuntu Touch 20.04 System Settings while Waydroid is
running breaks NFC for apps currently until another session is started.

tools/actions/container_manager.py

index bb3b65089a93fea93757773ec3e3e938d3312940..1304b6264722128230b3aaf896fa8d6c61483e9e 100644 (file)
@@ -154,6 +154,9 @@ def do_start(args, session):
     if which("stop"):
         command = ["stop", "nfcd"]
         tools.helpers.run.user(args, command, check=False)
     if which("stop"):
         command = ["stop", "nfcd"]
         tools.helpers.run.user(args, command, check=False)
+    elif which("systemctl") and (tools.helpers.run.user(args, ["systemctl", "is-active", "-q", "nfcd"], check=False) == 0):
+        command = ["systemctl", "stop", "nfcd"]
+        tools.helpers.run.user(args, command, check=False)
 
     # Set permissions
     set_permissions(args)
 
     # Set permissions
     set_permissions(args)
@@ -195,6 +198,9 @@ def stop(args, quit_session=True):
         if which("start"):
             command = ["start", "nfcd"]
             tools.helpers.run.user(args, command, check=False)
         if which("start"):
             command = ["start", "nfcd"]
             tools.helpers.run.user(args, command, check=False)
+        elif which("systemctl") and (tools.helpers.run.user(args, ["systemctl", "is-enabled", "-q", "nfcd"], check=False) == 0):
+            command = ["systemctl", "start", "nfcd"]
+            tools.helpers.run.user(args, command, check=False)
 
         # Sensors
         if which("waydroid-sensord"):
 
         # Sensors
         if which("waydroid-sensord"):