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 <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2019-03-08 13:44:28 +01:00
parent 1ddd7e57ee
commit 6e282ec51b
6 changed files with 28 additions and 30 deletions

View File

@ -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

View File

@ -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 <gabriel.valcazar@digi.com>
---
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]

View File

@ -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

View File

@ -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 <gabriel.valcazar@digi.com>
---
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]

View File

@ -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

View File

@ -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