From 441164c575ad7b1f066902e18727ad50aea3d2af Mon Sep 17 00:00:00 2001 From: Isaac Hermida Date: Wed, 20 Sep 2023 10:43:34 +0200 Subject: [PATCH] dey-examples: connectcore-demo: restart service on suspend If the system is send to suspend mode, the bluetooth core is reconfigured. Therefore, restart the service if it is running, to configure the ble service. https://onedigi.atlassian.net/browse/DEL-8694 Signed-off-by: Isaac Hermida --- .../dey-examples/connectcore-demo-example.inc | 8 +++++++- .../suspendtarget-connectcore-demo-server.service | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/suspendtarget-connectcore-demo-server.service diff --git a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example.inc b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example.inc index 9fbf094b6..707d26ae8 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example.inc +++ b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example.inc @@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171d SRC_URI += " \ file://connectcore-demo-server-init \ file://connectcore-demo-server.service \ + file://suspendtarget-connectcore-demo-server.service \ " RDEPENDS:${PN}-server = " \ @@ -41,6 +42,7 @@ do_install() { # Install systemd unit files install -d ${D}${systemd_unitdir}/system install -m 0644 ${WORKDIR}/connectcore-demo-server.service ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/suspendtarget-connectcore-demo-server.service ${D}${systemd_unitdir}/system/ fi # Install connectcore-demo-server-init @@ -72,6 +74,7 @@ FILES:${PN}-multimedia += " \ FILES:${PN}-server = " \ /srv/www/demoserver.py \ ${systemd_unitdir}/system/connectcore-demo-server.service \ + ${systemd_unitdir}/system/suspendtarget-connectcore-demo-server.service \ ${sysconfdir}/connectcore-demo-server \ ${sysconfdir}/init.d/connectcore-demo-server \ " @@ -88,6 +91,9 @@ INITSCRIPT_NAME:${PN}-server = "connectcore-demo-server" INITSCRIPT_PARAMS:${PN}-server = "start 20 2 3 4 5 . stop 21 0 1 6 ." SYSTEMD_PACKAGES = "${PN}-server" -SYSTEMD_SERVICE:${PN}-server = "connectcore-demo-server.service" +SYSTEMD_SERVICE:${PN}-server = " \ + connectcore-demo-server.service \ + suspendtarget-connectcore-demo-server.service \ +" PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/suspendtarget-connectcore-demo-server.service b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/suspendtarget-connectcore-demo-server.service new file mode 100644 index 000000000..390537974 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/suspendtarget-connectcore-demo-server.service @@ -0,0 +1,11 @@ +[Unit] +Description=Restart ConnectCore demo server after suspend if running +After=suspend.target + +[Service] +Type=simple +# try-restart: only restart if it is running +ExecStart=/bin/systemctl --no-block try-restart connectcore-demo-server + +[Install] +WantedBy=suspend.target