From 6e282ec51b916d1ccc0fcda055f67f9ba97aca73 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Fri, 8 Mar 2019 13:44:28 +0100 Subject: [PATCH] bluez: rework bluetooth and bluetooth-init services Soften the dependencies between the services and start the bluetooth stack regardless of the existence of a bluetooth chip. Also, update the standby script to reflect that there is no longer a strong dependency between the services. https://jira.digi.com/browse/DEL-6452 Signed-off-by: Gabriel Valcazar --- .../bluez/bluez5-5.41/bluetooth-init.service | 4 +++- ...bluetooth.service-add-customizations.patch | 24 ++++++++----------- .../bluez/bluez5-5.50/bluetooth-init.service | 4 +++- ...bluetooth.service-add-customizations.patch | 24 ++++++++----------- .../busybox/busybox/ccimx6ul/standby-actions | 1 + .../busybox/busybox/ccimx8x/standby-actions | 1 + 6 files changed, 28 insertions(+), 30 deletions(-) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth-init.service b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth-init.service index 39e448159..208162131 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth-init.service +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth-init.service @@ -1,5 +1,7 @@ [Unit] Description=Initialization of the bluetooth chip +ConditionPathIsDirectory=/proc/device-tree/bluetooth +Before=bluetooth.service [Service] Type=forking @@ -7,4 +9,4 @@ ExecStart=/etc/bluetooth-init start ExecStop=/etc/bluetooth-init stop [Install] -RequiredBy=bluetooth.service +WantedBy=multi-user.target diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth.service-add-customizations.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth.service-add-customizations.patch index ca23ec021..708bd788f 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth.service-add-customizations.patch +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/bluetooth.service-add-customizations.patch @@ -3,32 +3,28 @@ Date: Thu, 7 Feb 2019 13:15:43 +0100 Subject: [PATCH] bluetooth.service: add Digi customizations These changes include: -* Adding the bluetooth-init service as a dependency -* Changing the path condition so the service only starts on bluetooth-capable -boards -* Changing the service's target so it starts on boot + +* Adding the bluetooth-init service as a soft dependency. +* Having the bluetooth stack start automatically on boot. Signed-off-by: Gabriel Valcazar --- - src/bluetooth.service.in | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) + src/bluetooth.service.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in -index f799f65..ced1055 100644 +index f799f65..d8b150c 100644 --- a/src/bluetooth.service.in +++ b/src/bluetooth.service.in -@@ -1,7 +1,9 @@ - [Unit] +@@ -2,6 +2,7 @@ Description=Bluetooth service Documentation=man:bluetoothd(8) --ConditionPathIsDirectory=/sys/class/bluetooth -+ConditionPathIsDirectory=/proc/device-tree/bluetooth -+Requires=bluetooth-init.service -+After=bluetooth-init.service + ConditionPathIsDirectory=/sys/class/bluetooth ++Wants=bluetooth-init.service [Service] Type=dbus -@@ -16,5 +18,5 @@ ProtectHome=true +@@ -16,5 +17,5 @@ ProtectHome=true ProtectSystem=full [Install] diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth-init.service b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth-init.service index 39e448159..208162131 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth-init.service +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth-init.service @@ -1,5 +1,7 @@ [Unit] Description=Initialization of the bluetooth chip +ConditionPathIsDirectory=/proc/device-tree/bluetooth +Before=bluetooth.service [Service] Type=forking @@ -7,4 +9,4 @@ ExecStart=/etc/bluetooth-init start ExecStop=/etc/bluetooth-init stop [Install] -RequiredBy=bluetooth.service +WantedBy=multi-user.target diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth.service-add-customizations.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth.service-add-customizations.patch index ca23ec021..708bd788f 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth.service-add-customizations.patch +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/bluetooth.service-add-customizations.patch @@ -3,32 +3,28 @@ Date: Thu, 7 Feb 2019 13:15:43 +0100 Subject: [PATCH] bluetooth.service: add Digi customizations These changes include: -* Adding the bluetooth-init service as a dependency -* Changing the path condition so the service only starts on bluetooth-capable -boards -* Changing the service's target so it starts on boot + +* Adding the bluetooth-init service as a soft dependency. +* Having the bluetooth stack start automatically on boot. Signed-off-by: Gabriel Valcazar --- - src/bluetooth.service.in | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) + src/bluetooth.service.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in -index f799f65..ced1055 100644 +index f799f65..d8b150c 100644 --- a/src/bluetooth.service.in +++ b/src/bluetooth.service.in -@@ -1,7 +1,9 @@ - [Unit] +@@ -2,6 +2,7 @@ Description=Bluetooth service Documentation=man:bluetoothd(8) --ConditionPathIsDirectory=/sys/class/bluetooth -+ConditionPathIsDirectory=/proc/device-tree/bluetooth -+Requires=bluetooth-init.service -+After=bluetooth-init.service + ConditionPathIsDirectory=/sys/class/bluetooth ++Wants=bluetooth-init.service [Service] Type=dbus -@@ -16,5 +18,5 @@ ProtectHome=true +@@ -16,5 +17,5 @@ ProtectHome=true ProtectSystem=full [Install] diff --git a/meta-digi-dey/recipes-core/busybox/busybox/ccimx6ul/standby-actions b/meta-digi-dey/recipes-core/busybox/busybox/ccimx6ul/standby-actions index 639460c0a..a2baa3db2 100644 --- a/meta-digi-dey/recipes-core/busybox/busybox/ccimx6ul/standby-actions +++ b/meta-digi-dey/recipes-core/busybox/busybox/ccimx6ul/standby-actions @@ -56,6 +56,7 @@ elif [ "${1}" == "post" ]; then # Resume bluetooth interface if [ -d "/proc/device-tree/bluetooth" ]; then if [ -e "/tmp/up_bt_on_resume" ]; then + systemctl start bluetooth-init systemctl start bluetooth rm -f /tmp/up_bt_on_resume fi diff --git a/meta-digi-dey/recipes-core/busybox/busybox/ccimx8x/standby-actions b/meta-digi-dey/recipes-core/busybox/busybox/ccimx8x/standby-actions index a048e2e24..6f5c40247 100644 --- a/meta-digi-dey/recipes-core/busybox/busybox/ccimx8x/standby-actions +++ b/meta-digi-dey/recipes-core/busybox/busybox/ccimx8x/standby-actions @@ -56,6 +56,7 @@ elif [ "${1}" == "post" ]; then # Resume bluetooth interface if [ -d "/proc/device-tree/bluetooth" ]; then if [ -e "/tmp/up_bt_on_resume" ]; then + systemctl start bluetooth-init systemctl start bluetooth rm -f /tmp/up_bt_on_resume fi