Modify the bt-stack-up.sh script 57/169857/3 accepted/tizen/unified/20180226.142343 submit/tizen/20180219.022158 submit/tizen/20180221.011521 submit/tizen/20180226.020205
authorHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 12 Feb 2018 01:13:25 +0000 (10:13 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 13 Feb 2018 11:03:24 +0000 (20:03 +0900)
Change-Id: I560a461270c4085f21284a2e74ecf2cb1f57e3db
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
packaging/bluetooth-hci-logger-stop.path [new file with mode: 0644]
packaging/bluetooth-hci-logger-stop.service [new file with mode: 0644]
packaging/bluetooth-hci-logger.path [new file with mode: 0644]
packaging/bluetooth-hci-logger.service
packaging/bluetooth-share-start.path [new file with mode: 0644]
packaging/bluetooth-share-start.service [new file with mode: 0644]
packaging/bluetooth-tools.spec
packaging/bluez-start.path [new file with mode: 0644]
packaging/bluez-start.service [new file with mode: 0644]
scripts/mobile/bt-stack-down.sh
scripts/mobile/bt-stack-up.sh

diff --git a/packaging/bluetooth-hci-logger-stop.path b/packaging/bluetooth-hci-logger-stop.path
new file mode 100644 (file)
index 0000000..a0e221b
--- /dev/null
@@ -0,0 +1,5 @@
+[Unit]
+Description=Path activation for the "bluetooth-hci-logger-stop"
+
+[Path]
+PathExists=/run/.hci_logger_stop
diff --git a/packaging/bluetooth-hci-logger-stop.service b/packaging/bluetooth-hci-logger-stop.service
new file mode 100644 (file)
index 0000000..55d3f18
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Service to stop BT HCI logger normally
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System
+ExecStartPre=/usr/bin/rm -f /run/.hci_logger_stop
+ExecStart=/usr/etc/bluetooth/bt-run-hci-logger.sh normal stop
+RemainAfterExit=no
+StandardOutput=journal+console
+SuccessExitStatus=1
+StartLimitInterval=1
+StartLimitBurst=10
diff --git a/packaging/bluetooth-hci-logger.path b/packaging/bluetooth-hci-logger.path
new file mode 100644 (file)
index 0000000..0136e39
--- /dev/null
@@ -0,0 +1,5 @@
+[Unit]
+Description=Path activation for the "bluetooth-hci-logger"
+
+[Path]
+PathExists=/run/.hci_logger_start
index f677940..3fae3a9 100644 (file)
@@ -3,11 +3,11 @@ Description=Service to run BT HCI logger normally
 
 [Service]
 Type=oneshot
-User=network_fw
-Group=network_fw
 SmackProcessLabel=System
+ExecStartPre=/usr/bin/rm -f /run/.hci_logger_start
 ExecStart=/usr/etc/bluetooth/bt-run-hci-logger.sh normal start btmon
-ExecStop=/usr/etc/bluetooth/bt-run-hci-logger.sh normal stop
-RemainAfterExit=yes
+RemainAfterExit=no
 StandardOutput=journal+console
-StandardError=inherit
+SuccessExitStatus=1
+StartLimitInterval=1
+StartLimitBurst=10
diff --git a/packaging/bluetooth-share-start.path b/packaging/bluetooth-share-start.path
new file mode 100644 (file)
index 0000000..5a3eefb
--- /dev/null
@@ -0,0 +1,5 @@
+[Unit]
+Description=Path activation for the "bluetooth-share-start"
+
+[Path]
+PathExists=/run/.bluetooth_share_start
diff --git a/packaging/bluetooth-share-start.service b/packaging/bluetooth-share-start.service
new file mode 100644 (file)
index 0000000..4a46d01
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=Service to run bluetooth-share normally
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System
+ExecStartPre=/usr/bin/rm -f /run/.bluetooth_share_start
+ExecStart=/usr/bin/systemctl start --no-block bluetooth-share.service
+RemainAfterExit=no
+SuccessExitStatus=1
+StartLimitInterval=1
+StartLimitBurst=10
index 8b0e761..d256a59 100644 (file)
@@ -87,16 +87,39 @@ rm -rf %{buildroot}
 %make_install
 
 mkdir -p %{buildroot}%{_prefix}/etc/bluetooth/
+mkdir -p %{buildroot}/run/bluetooth
 install -m 0755 scripts/bt-dev-start.sh %{buildroot}%{_prefix}/etc/bluetooth/bt-dev-start.sh
 install -m 0755 scripts/bt-dev-end.sh %{buildroot}%{_prefix}/etc/bluetooth/bt-dev-end.sh
 
 install -D -m 0644 packaging/bluetooth-hci-logger.service %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-logger.service
+install -D -m 0644 packaging/bluetooth-hci-logger.path %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-logger.path
+
+install -D -m 0644 packaging/bluetooth-hci-logger-stop.service %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-logger-stop.service
+install -D -m 0644 packaging/bluetooth-hci-logger-stop.path %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-logger-stop.path
+
+install -D -m 0644 packaging/bluez-start.service %{buildroot}%{_libdir}/systemd/system/bluez-start.service
+install -D -m 0644 packaging/bluez-start.path %{buildroot}%{_libdir}/systemd/system/bluez-start.path
+
+install -D -m 0644 packaging/bluetooth-share-start.service %{buildroot}%{_libdir}/systemd/system/bluetooth-share-start.service
+install -D -m 0644 packaging/bluetooth-share-start.path %{buildroot}%{_libdir}/systemd/system/bluetooth-share-start.path
+
 install -D -m 0644 packaging/bluetooth-force-hci-logger.service %{buildroot}%{_libdir}/systemd/system/bluetooth-force-hci-logger.service
 install -D -m 0644 packaging/bluetooth-hci-dump@.service %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-dump@.service
 
 %post
 mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
 ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-hci-logger.path
+
+ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger-stop.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger-stop.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-hci-logger-stop.path
+
+ln -sf %{_libdir}/systemd/system/bluez-start.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -sf %{_libdir}/systemd/system/bluez-start.path %{_libdir}/systemd/system/multi-user.target.wants/bluez-start.path
+
+ln -sf %{_libdir}/systemd/system/bluetooth-share-start.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -sf %{_libdir}/systemd/system/bluetooth-share-start.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-share-start.path
+
 ln -sf %{_libdir}/systemd/system/bluetooth-force-hci-logger.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
 
 
@@ -116,6 +139,13 @@ ln -sf %{_libdir}/systemd/system/bluetooth-force-hci-logger.service %{_sysconfdi
 #%{_unitdir}/multi-user.target.wants/bluetooth-address.service
 #%{_unitdir}/bluetooth-address.service
 %{_libdir}/systemd/system/bluetooth-hci-logger.service
+%{_libdir}/systemd/system/bluetooth-hci-logger.path
+%{_libdir}/systemd/system/bluetooth-hci-logger-stop.service
+%{_libdir}/systemd/system/bluetooth-hci-logger-stop.path
+%{_libdir}/systemd/system/bluez-start.service
+%{_libdir}/systemd/system/bluez-start.path
+%{_libdir}/systemd/system/bluetooth-share-start.service
+%{_libdir}/systemd/system/bluetooth-share-start.path
 %{_libdir}/systemd/system/bluetooth-force-hci-logger.service
 %{_libdir}/systemd/system/bluetooth-hci-dump@.service
 
diff --git a/packaging/bluez-start.path b/packaging/bluez-start.path
new file mode 100644 (file)
index 0000000..2f63af9
--- /dev/null
@@ -0,0 +1,5 @@
+[Unit]
+Description=Path activation for the "bluez"
+
+[Path]
+PathExists=/run/.bluez_start
diff --git a/packaging/bluez-start.service b/packaging/bluez-start.service
new file mode 100644 (file)
index 0000000..804a615
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=Service to run Bluetoothd normally
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System
+ExecStartPre=/usr/bin/rm -f /run/.bluez_start
+ExecStart=/usr/bin/systemctl start --no-block bluetooth.service
+RemainAfterExit=yes
+SuccessExitStatus=1
+StartLimitInterval=1
+StartLimitBurst=10
index 1415d58..0f8926f 100644 (file)
@@ -9,7 +9,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 /usr/etc/bluetooth/bt-dev-end.sh
 
 # Stop HCI logging
-systemctl stop bluetooth-hci-logger.service
+/usr/bin/touch /run/.hci_logger_stop
 
 # Kill BlueZ bluetooth stack
 killall obexd obex-client
index 015d351..ddbf664 100644 (file)
@@ -5,23 +5,13 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 # Script for executing Bluetooth stack
 #
 
-# Start HCI logging
-systemctl start bluetooth-hci-logger.service
-
 # Register BT Device
 /usr/etc/bluetooth/bt-dev-start.sh
 
 if !(/usr/bin/hciconfig | grep hci); then
        echo "Registering BT device is failed."
-       systemctl stop bluetooth-hci-logger.service
+       /usr/bin/touch /run/.hci_logger_stop
        exit 1
 fi
 
-# Execute BlueZ BT stack
-echo "Run bluetoothd"
-/usr/libexec/bluetooth/bluetoothd -d -C &
-
-echo "Run bluetooth-share by systemd"
-systemctl start --no-block bluetooth-share.service
-
 exit 0