Don't detach HCI when BT is off for the common profile 04/210804/1 accepted/tizen/unified/20190729.081010 submit/tizen/20190725.232630
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 25 Jul 2019 03:41:34 +0000 (12:41 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 25 Jul 2019 03:41:34 +0000 (12:41 +0900)
Change-Id: Ie06246a224f404a6a339a856cd72b571587b93b0
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
packaging/bluetooth-stack-down-common.service [new file with mode: 0644]
packaging/bluetooth-stack-up-common.service [new file with mode: 0644]
packaging/bluetooth-tools.spec

diff --git a/packaging/bluetooth-stack-down-common.service b/packaging/bluetooth-stack-down-common.service
new file mode 100644 (file)
index 0000000..03e927a
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Service to run bt-stack-down.sh script to terminate BT functions
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System
+SecureBits=keep-caps
+Capabilities=cap_kill=i
+ExecStart=/usr/etc/bluetooth/bt-stack-down.sh
diff --git a/packaging/bluetooth-stack-up-common.service b/packaging/bluetooth-stack-up-common.service
new file mode 100644 (file)
index 0000000..8d87455
--- /dev/null
@@ -0,0 +1,16 @@
+[Unit]
+Description=Service to run bt-stack-up.sh script to start BT functions
+
+[Service]
+User=network_fw
+Group=network_fw
+Type=oneshot
+SmackProcessLabel=System
+SupplementaryGroups=priv_mediastorage priv_externalstorage dialout
+Capabilities=cap_sys_module=i
+SecureBits=keep-caps
+ExecStart=/usr/etc/bluetooth/bt-stack-up.sh
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target
index 65af919..bfa8b7a 100644 (file)
@@ -117,6 +117,9 @@ install -D -m 0644 packaging/bluetooth-hci-up.path %{buildroot}%{_libdir}/system
 install -D -m 0644 packaging/bluetooth-hci-down.service %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-down.service
 install -D -m 0644 packaging/bluetooth-hci-down.path %{buildroot}%{_libdir}/systemd/system/bluetooth-hci-down.path
 
+install -D -m 0644 packaging/bluetooth-stack-up-common.service %{buildroot}%{_libdir}/systemd/system/bluetooth-stack-up-common.service
+install -D -m 0644 packaging/bluetooth-stack-down-common.service %{buildroot}%{_libdir}/systemd/system/bluetooth-stack-down-common.service
+
 %post
 mkdir -p %{_libdir}/systemd/system/multi-user.target.wants/
 #ln -sf %{_libdir}/systemd/system/bluetooth-hci-logger.path %{_libdir}/systemd/system/multi-user.target.wants/bluetooth-hci-logger.path
@@ -165,18 +168,28 @@ ln -sf common/bt-stack-up.sh bt-stack-up.sh
 ln -sf common/bt-stack-down.sh bt-stack-down.sh
 ln -sf common/bt-reset-env.sh bt-reset-env.sh
 popd
+pushd %{_unitdir}
+mv bluetooth-stack-up-common.service bluetooth-stack-up.service
+mv bluetooth-stack-down-common.service bluetooth-stack-down.service
+popd
 %preun profile_common
 pushd %{_prefix}/etc/bluetooth/
 rm bt-stack-up.sh
 rm bt-stack-down.sh
 rm bt-reset-env.sh
 popd
+pushd %{_unitdir}
+rm bluetooth-stack-up.service
+rm bluetooth-stack-down.service
+popd
 %files profile_common
 %license LICENSE.APLv2
 #%{_sysconfdir}/rc.d/init.d/bluetooth-address
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/common/bt-stack-up.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/common/bt-stack-down.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/common/bt-reset-env.sh
+%{_libdir}/systemd/system/bluetooth-stack-up-common.service
+%{_libdir}/systemd/system/bluetooth-stack-down-common.service
 
 %post profile_mobile
 pushd %{_prefix}/etc/bluetooth/