From 38201b6bc37feaab676369c168ac9c52f4bf62e4 Mon Sep 17 00:00:00 2001 From: Taejin Woo Date: Mon, 2 Nov 2015 09:48:46 +0900 Subject: [PATCH] Activate bt-agent demon through systemd Change-Id: I8d12d556cc1c5afb13f86f94a8e56430a02504f2 Signed-off-by: Taejin Woo --- ag-agent/org.bluez.ag_agent.service | 5 ++--- packaging/bluetooth-ag-agent.service | 14 ++++++++++++++ packaging/bluetooth-agent.spec | 22 +++++++++++++++------- 3 files changed, 31 insertions(+), 10 deletions(-) create mode 100755 packaging/bluetooth-ag-agent.service diff --git a/ag-agent/org.bluez.ag_agent.service b/ag-agent/org.bluez.ag_agent.service index 5cd68b3..0845116 100644 --- a/ag-agent/org.bluez.ag_agent.service +++ b/ag-agent/org.bluez.ag_agent.service @@ -1,5 +1,4 @@ [D-BUS Service] Name=org.bluez.ag_agent -Exec=/usr/bin/bluetooth-ag-agent -User=system -Group=system +Exec=/dev/false +SystemdService=bluetooth-ag-agent.service diff --git a/packaging/bluetooth-ag-agent.service b/packaging/bluetooth-ag-agent.service new file mode 100755 index 0000000..77b4f16 --- /dev/null +++ b/packaging/bluetooth-ag-agent.service @@ -0,0 +1,14 @@ +[Unit] +Description=Service to launch AG agent. +After=dbus.socket dbus.service +Requires=dbus.socket + +[Service] +Type=dbus +BusName=org.bluez.ag_agent +ExecStart=/usr/bin/bluetooth-ag-agent +ExecStop=/usr/bin/killall bluetooth-ag-agent +KillMode=process + +[Install] +WantedBy=multi-user.target diff --git a/packaging/bluetooth-agent.spec b/packaging/bluetooth-agent.spec index 45e6c5c..4d5226d 100644 --- a/packaging/bluetooth-agent.spec +++ b/packaging/bluetooth-agent.spec @@ -1,3 +1,5 @@ +%define _usrlibdir /usr/lib + Name: bluetooth-agent Summary: Bluetooth agent packages that support various external profiles Version: 0.1.0 @@ -41,16 +43,14 @@ export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" export CFLAGS="$CFLAGS -DTIZEN_MEDIA_ENHANCE" -#export CFLAGS="$CFLAGS -DTIZEN_BT_HFP_AG_ENABLE" +export CFLAGS="$CFLAGS -DTIZEN_BT_HFP_AG_ENABLE" %if "%{?profile}" == "wearable" export CFLAGS="$CFLAGS -DTIZEN_WEARABLE" export CFLAGS="$CFLAGS -DTIZEN_SUPPORT_LUNAR_DEVICE" %else -%if "%{?tizen_target_name}" == "Z130H" export CFLAGS="$CFLAGS -DTIZEN_KIRAN" %endif -%endif export CFLAGS+=" -fpie -DPBAP_SIM_ENABLE" @@ -63,7 +63,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr \ %else -DTIZEN_WEARABLE=0 \ %endif -# -DTIZEN_BT_HFP_AG_ENABLE=1 + -DTIZEN_BT_HFP_AG_ENABLE=1 make VERBOSE=1 @@ -72,6 +72,12 @@ rm -rf %{buildroot} %make_install install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-agent +mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants +install -m 0644 packaging/bluetooth-ag-agent.service %{buildroot}%{_unitdir}/ +ln -s ../bluetooth-ag-agent.service %{buildroot}%{_unitdir}/multi-user.target.wants/bluetooth-ag-agent.service +#install -D -m 0644 packaging/bluetooth-ag-agent.service %{buildroot}%{_unitdir}/usr/lib/systemd/system/bluetooth-ag-agent.service +#mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants +#ln -s ../bluetooth-ag-agent.service %{buildroot}%{_unitdir}/multi-user.target.wants/bluetooth-ag-agent.service %files %manifest %{name}.manifest @@ -80,12 +86,14 @@ install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-agent %{_bindir}/bluetooth-hf-agent %{_datadir}/dbus-1/system-services/org.bluez.hf_agent.service %else +%{_bindir}/bluetooth-ag-agent %{_bindir}/bluetooth-map-agent %{_bindir}/bluetooth-pb-agent %{_datadir}/dbus-1/system-services/org.bluez.pb_agent.service %{_datadir}/dbus-1/system-services/org.bluez.map_agent.service -#%{_datadir}/dbus-1/system-services/org.bluez.ag_agent.service -#%{_bindir}/bluetooth-ag-agent -#%attr(0666,-,-) /opt/var/lib/bluetooth/voice-recognition-blacklist +%{_datadir}/dbus-1/system-services/org.bluez.ag_agent.service +%{_usrlibdir}/systemd/system/bluetooth-ag-agent.service +%{_usrlibdir}/systemd/system/multi-user.target.wants/bluetooth-ag-agent.service +%attr(0666,-,-) /opt/var/lib/bluetooth/voice-recognition-blacklist %endif %{_datadir}/license/bluetooth-agent -- 2.7.4