From: Hyotaek Shim Date: Tue, 16 Mar 2021 11:06:59 +0000 (+0900) Subject: Apply dbus activation X-Git-Tag: submit/tizen/20210317.004535^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e11de751eea9d879f65cf8fc743e11c3ccd3204;p=platform%2Fcore%2Fsystem%2Fperipheral-bus.git Apply dbus activation Change-Id: If396b40e3eebc485a182b185123b792fa7d79a4e Signed-off-by: Hyotaek Shim --- diff --git a/packaging/org.tizen.peripheral_io.service b/packaging/org.tizen.peripheral_io.service new file mode 100644 index 0000000..fa08737 --- /dev/null +++ b/packaging/org.tizen.peripheral_io.service @@ -0,0 +1,4 @@ +[D-BUS Service] +Name=org.tizen.peripheral_io +Exec=/bin/false +SystemdService=peripheral-bus.service diff --git a/packaging/peripheral-bus.spec b/packaging/peripheral-bus.spec index f2afc26..37dfc30 100644 --- a/packaging/peripheral-bus.spec +++ b/packaging/peripheral-bus.spec @@ -10,6 +10,7 @@ Source2: %{name}.service Source3: %{name}.tmpfiles.conf Source4: 90-peripheral-io.rules Source5: org.tizen.peripheral_io.conf +Source6: org.tizen.peripheral_io.service BuildRequires: cmake BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) @@ -50,6 +51,8 @@ install -m 0644 %SOURCE4 %{buildroot}%{_udevrulesdir} %install_service multi-user.target.wants peripheral-bus.service mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/dbus-1/system.d/ +mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services +install -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/dbus-1/system-services/ mkdir -p %{buildroot}/etc/peripheral-bus cp %{_builddir}/%{name}-%{version}/data/*.ini %{buildroot}/etc/%{name} @@ -57,6 +60,7 @@ cp %{_builddir}/%{name}-%{version}/data/*.ini %{buildroot}/etc/%{name} %files %manifest %{name}.manifest %config %{_sysconfdir}/dbus-1/system.d/* +%config %{_datadir}/dbus-1/system-services/* %defattr(-,root,root,-) %license LICENSE.APLv2 %{_bindir}/%{name} diff --git a/src/peripheral_bus.c b/src/peripheral_bus.c index 0099527..53a6379 100644 --- a/src/peripheral_bus.c +++ b/src/peripheral_bus.c @@ -282,6 +282,8 @@ static void on_bus_acquired(GDBusConnection *connection, static void on_name_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) { + _D("sd_notify(READY=1)"); + sd_notify(0, "READY=1"); } static void on_name_lost(GDBusConnection *conn, @@ -290,14 +292,6 @@ static void on_name_lost(GDBusConnection *conn, _E("Dbus name is lost!"); } -static gboolean peripheral_bus_notify(gpointer data) -{ - _D("sd_notify(READY=1)"); - sd_notify(0, "READY=1"); - - return G_SOURCE_REMOVE; -} - int main(int argc, char *argv[]) { GMainLoop *loop; @@ -333,8 +327,6 @@ int main(int argc, char *argv[]) loop = g_main_loop_new(NULL, FALSE); - g_idle_add(peripheral_bus_notify, NULL); - peripheral_privilege_init(); _D("Enter main loop!");