Fix systemd-assisted dbus activation sequence 93/177493/2
authorHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 30 Apr 2018 11:34:27 +0000 (20:34 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 30 Apr 2018 11:35:04 +0000 (20:35 +0900)
Change-Id: Ic570da29e8193b56d5c4ab31687743e505d43fe3
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
CMakeLists.txt
packaging/feedbackd.spec
src/core/main.c
systemd/feedbackd.service

index b2c4c8c..8a15676 100644 (file)
@@ -41,6 +41,7 @@ SET(PKG_MODULES
        gio-unix-2.0
        capi-system-info
        libgdbus
+       libsystemd
 )
 
 IF(DRIVER STREQUAL gpio)
index c87d08a..39ff443 100644 (file)
@@ -24,6 +24,7 @@ BuildRequires:  pkgconfig(gio-unix-2.0)
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-system-peripheral-io)
 BuildRequires:  pkgconfig(libgdbus)
+BuildRequires:  pkgconfig(libsystemd)
 
 Requires(post): /usr/bin/vconftool
 
index d9adf24..92fddc8 100755 (executable)
@@ -22,6 +22,7 @@
 #include <sys/reboot.h>
 #include <glib.h>
 #include <libgdbus/dbus-system.h>
+#include <systemd/sd-daemon.h>
 
 #include "core/log.h"
 #include "core/common.h"
@@ -45,6 +46,12 @@ static void sig_usr1(int signo)
        }
 }
 
+static void dbus_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+       _I("sd_notify(READY=1)");
+       sd_notify(0, "READY=1");
+}
+
 int main(int argc, char **argv)
 {
        int ret;
@@ -63,7 +70,7 @@ int main(int argc, char **argv)
        }
        haptic_init();
 
-       ret = dbus_handle_request_bus_name(handle, VIBRATOR_BUS_NAME, NULL, NULL);
+       ret = dbus_handle_request_bus_name(handle, VIBRATOR_BUS_NAME, dbus_name_acquired, NULL);
        if (ret <= 0) {
                _E("Fail to request bus name");
                dbus_handle_check_owner_name(NULL, VIBRATOR_BUS_NAME);
index 8bd1dc9..e8071f7 100644 (file)
@@ -3,7 +3,7 @@ Description=System Vibrator Daemon
 After=deviced.service
 
 [Service]
-BusName=org.tizen.system.vibrator
+Type=Notify
 SmackProcessLabel=System
 ExecStart=/usr/bin/feedbackd
 Restart=always