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] [Unit]
Description=Initialization of the bluetooth chip Description=Initialization of the bluetooth chip
ConditionPathIsDirectory=/proc/device-tree/bluetooth
Before=bluetooth.service
[Service] [Service]
Type=forking Type=forking
@ -7,4 +9,4 @@ ExecStart=/etc/bluetooth-init start
ExecStop=/etc/bluetooth-init stop ExecStop=/etc/bluetooth-init stop
[Install] [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 Subject: [PATCH] bluetooth.service: add Digi customizations
These changes include: These changes include:
* Adding the bluetooth-init service as a dependency
* Changing the path condition so the service only starts on bluetooth-capable * Adding the bluetooth-init service as a soft dependency.
boards * Having the bluetooth stack start automatically on boot.
* Changing the service's target so it starts on boot
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com> Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
--- ---
src/bluetooth.service.in | 6 ++++-- src/bluetooth.service.in | 3 ++-
1 file changed, 4 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in 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 --- a/src/bluetooth.service.in
+++ b/src/bluetooth.service.in +++ b/src/bluetooth.service.in
@@ -1,7 +1,9 @@ @@ -2,6 +2,7 @@
[Unit]
Description=Bluetooth service Description=Bluetooth service
Documentation=man:bluetoothd(8) Documentation=man:bluetoothd(8)
-ConditionPathIsDirectory=/sys/class/bluetooth ConditionPathIsDirectory=/sys/class/bluetooth
+ConditionPathIsDirectory=/proc/device-tree/bluetooth +Wants=bluetooth-init.service
+Requires=bluetooth-init.service
+After=bluetooth-init.service
[Service] [Service]
Type=dbus Type=dbus
@@ -16,5 +18,5 @@ ProtectHome=true @@ -16,5 +17,5 @@ ProtectHome=true
ProtectSystem=full ProtectSystem=full
[Install] [Install]

View File

@ -1,5 +1,7 @@
[Unit] [Unit]
Description=Initialization of the bluetooth chip Description=Initialization of the bluetooth chip
ConditionPathIsDirectory=/proc/device-tree/bluetooth
Before=bluetooth.service
[Service] [Service]
Type=forking Type=forking
@ -7,4 +9,4 @@ ExecStart=/etc/bluetooth-init start
ExecStop=/etc/bluetooth-init stop ExecStop=/etc/bluetooth-init stop
[Install] [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 Subject: [PATCH] bluetooth.service: add Digi customizations
These changes include: These changes include:
* Adding the bluetooth-init service as a dependency
* Changing the path condition so the service only starts on bluetooth-capable * Adding the bluetooth-init service as a soft dependency.
boards * Having the bluetooth stack start automatically on boot.
* Changing the service's target so it starts on boot
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com> Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
--- ---
src/bluetooth.service.in | 6 ++++-- src/bluetooth.service.in | 3 ++-
1 file changed, 4 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in 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 --- a/src/bluetooth.service.in
+++ b/src/bluetooth.service.in +++ b/src/bluetooth.service.in
@@ -1,7 +1,9 @@ @@ -2,6 +2,7 @@
[Unit]
Description=Bluetooth service Description=Bluetooth service
Documentation=man:bluetoothd(8) Documentation=man:bluetoothd(8)
-ConditionPathIsDirectory=/sys/class/bluetooth ConditionPathIsDirectory=/sys/class/bluetooth
+ConditionPathIsDirectory=/proc/device-tree/bluetooth +Wants=bluetooth-init.service
+Requires=bluetooth-init.service
+After=bluetooth-init.service
[Service] [Service]
Type=dbus Type=dbus
@@ -16,5 +18,5 @@ ProtectHome=true @@ -16,5 +17,5 @@ ProtectHome=true
ProtectSystem=full ProtectSystem=full
[Install] [Install]

View File

@ -56,6 +56,7 @@ elif [ "${1}" == "post" ]; then
# Resume bluetooth interface # Resume bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then if [ -d "/proc/device-tree/bluetooth" ]; then
if [ -e "/tmp/up_bt_on_resume" ]; then if [ -e "/tmp/up_bt_on_resume" ]; then
systemctl start bluetooth-init
systemctl start bluetooth systemctl start bluetooth
rm -f /tmp/up_bt_on_resume rm -f /tmp/up_bt_on_resume
fi fi

View File

@ -56,6 +56,7 @@ elif [ "${1}" == "post" ]; then
# Resume bluetooth interface # Resume bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then if [ -d "/proc/device-tree/bluetooth" ]; then
if [ -e "/tmp/up_bt_on_resume" ]; then if [ -e "/tmp/up_bt_on_resume" ]; then
systemctl start bluetooth-init
systemctl start bluetooth systemctl start bluetooth
rm -f /tmp/up_bt_on_resume rm -f /tmp/up_bt_on_resume
fi fi