Refactor dbus_handle_init into two parts 67/174867/3 accepted/tizen/unified/20180406.061945 submit/tizen/20180405.024125 submit/tizen/20180405.044417 submit/tizen/20180405.051333 submit/tizen/20180405.111955
authorlokilee73 <changjoo.lee@samsung.com>
Wed, 4 Apr 2018 12:48:34 +0000 (21:48 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Thu, 5 Apr 2018 02:26:20 +0000 (11:26 +0900)
It's to apply a fix in deviced which timing issue happend by telephony.
When telephony requests AddPoweroffWait, it fails because dbus in deviced is not ready.

Change-Id: I0e0faa9dfe2b56186765903b327ece1018d6b6b0
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/core/main.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 213fa10..d9adf24
@@ -48,12 +48,13 @@ static void sig_usr1(int signo)
 int main(int argc, char **argv)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
        mainloop = g_main_loop_new(NULL, FALSE);
 
-       if (!dbus_handle_init(G_BUS_TYPE_SYSTEM, VIBRATOR_BUS_NAME, NULL, NULL)) {
-               _E("failed to init dbus connection");
-       }
+       handle = dbus_handle_get_connection(G_BUS_TYPE_SYSTEM, FALSE);
+       if (!handle)
+               _E("Fail to get dbus connection");;
 
        ret = haptic_probe();
        if (ret != 0) {
@@ -62,6 +63,12 @@ int main(int argc, char **argv)
        }
        haptic_init();
 
+       ret = dbus_handle_request_bus_name(handle, VIBRATOR_BUS_NAME, NULL, NULL);
+       if (ret <= 0) {
+               _E("Fail to request bus name");
+               dbus_handle_check_owner_name(NULL, VIBRATOR_BUS_NAME);
+       }
+
        signal(SIGTERM, sig_quit);
        signal(SIGUSR1, sig_usr1);