deviced: Change dbus connection as private 27/324827/4
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 27 May 2025 09:45:04 +0000 (18:45 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Wed, 28 May 2025 05:26:10 +0000 (14:26 +0900)
From the libsyscommon, dbus connection was continuously used in an initialized state.
However, it is correct for the user side to use the dbus connection handle
after obtaining the connection.
Thus deviced will get connection handle as private to use in deviced module.

Change-Id: If02139e54e4dc05e968d1ea2b8eedeff33cb26e0
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
33 files changed:
src/battery-monitor/battery-monitor.c
src/battery/battery-time.c
src/battery/lowbat-handler.c
src/battery/power-supply.c
src/board/board-info.c
src/control/control.c
src/core/devices.c
src/core/event-handler.c
src/core/main.c
src/cpu/pmqos.c
src/display/display-dbus.c
src/display/display.c
src/extcon/cradle.c
src/extcon/extcon.c
src/extcon/hdmi.c
src/input/input-dbus.c
src/input/input.c
src/ir/ir.c
src/led/rgb.c
src/led/torch.c
src/power/power-dbus.c
src/power/power-off.c
src/power/power.c
src/proc/cpu-info.c
src/thermal/thermal.c
src/time/time-handler.c
src/touchscreen/sensitivity.c
src/touchscreen/touchscreen.c
src/tzip/tzip.c
src/usb-gadget/usb-dbus.c
src/usb-gadget/usb-gadget.c
src/usb-host/usb-host.c
tests/usb-host-test/usb-host-test.c

index a25ae325d68d94589af2f40eccfab7e1df984dbd..fcab1a5570fdede0f3a7328d67f21e96ef92feca 100644 (file)
@@ -525,12 +525,16 @@ static void _ht_val_destroy(gpointer data)
 static void bm_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        ht_apptime = g_hash_table_new_full(g_str_hash, g_str_equal, _ht_key_destroy, _ht_val_destroy);
        if (!ht_apptime)
                _E("Failed to init hash table");
 
-       ret = gdbus_add_object(NULL, DBUS_DEVICED_BM_PATH, &bm_dbus_interface);
+       ret = gdbus_add_object(handle, DBUS_DEVICED_BM_PATH, &bm_dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 3be5dc63bd1f18324d00f415d009d4e0c4679330..82d0bcfc47e4eb17e98478c12faf96377a7f74ed 100644 (file)
@@ -417,8 +417,12 @@ static int battery_probe(void *data)
 static void battery_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_BATTERY, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_BATTERY, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 9e9fd7a48dc86b48ea228e9921fdf2977e4ea6ab..5c52c1c2d4db28e457cd95ca1b1011e065459314 100644 (file)
@@ -678,11 +678,15 @@ static const dbus_interface_u dbus_interface = {
 static void lowbat_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_done);
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_POWER_SUPPLY, lowbat_monitor_init);
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_BATTERY, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_BATTERY, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 }
index 59483f00b3c8fa6f652d82b3d9f29d7a21f53a48..20b977dfed30678b12f947d03bf799d29483e608 100644 (file)
@@ -1538,6 +1538,10 @@ static int event_handler_state_changed(void *data)
 static void power_supply_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        memset(&battery, 0, sizeof(struct battery_status));
        memset(&old_battery, 0, sizeof(struct battery_status));
@@ -1554,7 +1558,7 @@ static void power_supply_init(void *data)
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_EVENT_HANDLER, event_handler_state_changed);
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_LCD, handle_display_state_changed);
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_BATTERY, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_BATTERY, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 6577496cbdab6dbf0b06e98893849851cf0ade38..fdb05fc73463a9057d05d2f972bf1afab1c5e9a1 100644 (file)
@@ -156,8 +156,12 @@ static int board_probe(void *data)
 static void board_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_BOARD, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_BOARD, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 }
index 2128a87d241d5516852bf869724118a2db826065..38f345ac003d5cd8d59c0d6c04a1f62f4e5a13dd 100644 (file)
@@ -191,8 +191,12 @@ static const dbus_interface_u dbus_interface = {
 static void control_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_SYSNOTI, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 1ed1caab56c924e4ac5c5082f0eabcf1b1054105..18ff57239f487757c77b46185de70186e217abbc 100644 (file)
@@ -59,6 +59,10 @@ void devices_init(void *data)
        GList *elem, *elem_n;
        const struct device_ops *dev;
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        dev_head = g_list_sort(dev_head, compare_priority);
 
@@ -83,12 +87,12 @@ void devices_init(void *data)
                }
        }
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_CORE, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_CORE, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
        /* register every objects */
-       if (gdbus_register_object_all(NULL) < 0)
+       if (gdbus_register_object_all(handle) < 0)
                _E("Failed to register dbus method: %d", ret);
 }
 
index 21095ea32ae53834fad2ccdb9e880f07ca9df371..7ac1c1d8a54e4a6888d594afb8fa8d25b594e74e 100644 (file)
@@ -90,8 +90,12 @@ static const dbus_interface_u eh_interface = {
 static void event_handler_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_SYSNOTI, &eh_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_SYSNOTI, &eh_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index d5986307c33f5991feb8b312134f620fed26ebe9..b235dd33fb5786c9cbd396d5ef02402f6b5b9609 100644 (file)
@@ -46,6 +46,7 @@
 #define WATCHDOG_TIMEOUT       90
 
 static GMainLoop *mainloop;
+static dbus_handle_h g_handle = NULL;
 
 static void writepid(char *pidpath)
 {
@@ -112,7 +113,6 @@ static int deviced_early_init(void *data)
 static int deviced_init(void *data)
 {
        int ret;
-       dbus_handle_h handle = NULL;
        guint timer;
        char bootmode[32] = "normal";
        int retval;
@@ -128,8 +128,8 @@ static int deviced_init(void *data)
                return 0;
        }
 
-       handle = gdbus_get_connection(G_BUS_TYPE_SYSTEM, FALSE);
-       if (!handle)
+       g_handle = gdbus_get_connection(G_BUS_TYPE_SYSTEM, TRUE);
+       if (!g_handle)
                _E("Failed to get dbus connection.");
 
        load_plugins();
@@ -147,9 +147,9 @@ static int deviced_init(void *data)
        CRITICAL_LOG("bootmode=%s", bootmode);
 
        resource_init();
-       devices_init(NULL);
+       devices_init((void*)&g_handle);
 
-       ret = gdbus_request_name(handle, DEVICED_BUS_NAME, deviced_dbus_name_acquired, NULL);
+       ret = gdbus_request_name(g_handle, DEVICED_BUS_NAME, deviced_dbus_name_acquired, NULL);
        if (ret <= 0) {
                _E("Failed to request bus name.");
                gdbus_check_name_owner(NULL, DEVICED_BUS_NAME);
@@ -172,10 +172,25 @@ static int deviced_init(void *data)
 
 static int deviced_exit(void *data)
 {
+       int ret = 0;
+
        devices_exit(NULL);
        resource_exit();
 
        unload_plugins();
+
+       if (!g_handle)
+               return 0;
+
+       ret = gdbus_free_connection(g_handle);
+       if (ret < 0) {
+               _E("Failed to free dbus connection %d", ret);
+               g_handle = NULL;
+               return ret;
+       }
+
+       g_handle = NULL;
+
        return 0;
 }
 
index 7182b045635e2fc250006537cb66de449eee38a0..5cf05b809f2fa180581a4d7c8d0fc710bd2418b8 100644 (file)
@@ -232,9 +232,13 @@ static int pmqos_probe(void *data)
 static void pmqos_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        /* register dbus methods */
-       ret = gdbus_add_object(NULL, DEVICED_PATH_PMQOS, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_PMQOS, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 563d727f5d2b82bd74786df6b6821d8614adc741..42da417f5d06e43bffffa31efc48578e5c08b527 100644 (file)
@@ -1564,11 +1564,15 @@ static struct syscommon_deviced_display_actor_ops display_gesture_actor = {
 int init_pm_dbus(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        display_add_actor(&display_api_actor);
        display_add_actor(&display_gesture_actor);
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_DISPLAY, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_DISPLAY, &dbus_interface);
        if (ret < 0)
                _E("fail to init dbus method(%d)", ret);
 
index d04bb3c4b9ba9c38da751e7cfaf77235806fef17..93b2c0386209cbcce1c0d9cdf4135d04f8910719 100644 (file)
@@ -656,7 +656,7 @@ static void display_init(void *data)
                _W("Failed to init: input devices poll init error");
 
        _I("Dbus init.");
-       ret = init_pm_dbus(NULL);
+       ret = init_pm_dbus(data);
        if (ret != 0)
                _W("Failed to init: dbus initialization error");
 
index aeebaae6334dd77828130a6fd90e0e9f14dfa35b..5ab39982981e845c434dd0fd009d8319e560fd4f 100644 (file)
@@ -122,10 +122,14 @@ static const dbus_interface_u dbus_interface = {
 static void cradle_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_LCD, display_changed);
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_SYSNOTI, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 }
index bc4c1b07d893f71dfe8eb664054ed5cb8eb3fa4a..361e8f2b44915eddc2b174af88310a9a14bb2314 100644 (file)
@@ -532,8 +532,12 @@ static int delayed_init_done(void *data)
 static void extcon_init(void *data)
 {
        int retval;
+       dbus_handle_h handle = NULL;
 
-       retval = gdbus_add_object(NULL, DEVICED_PATH_EXTCON, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       retval = gdbus_add_object(handle, DEVICED_PATH_EXTCON, &dbus_interface);
        if (retval < 0)
                _E("Failed to init dbus method: %d", retval);
 
index 116e1e5674b482813f589ce9673e9084cd024b81..b8f5d2aa9eae9644ff6552dcf2c9ab60b7360be2 100644 (file)
@@ -154,8 +154,12 @@ static const dbus_interface_u dbus_interface = {
 static void hdmi_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_SYSNOTI, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index ec67dc8f55165eda9bb12c72d91a4b19ab278795..9c76bdc109a0d6a2e5c5a54fb12f5af78fe5e240 100644 (file)
@@ -178,8 +178,12 @@ static const dbus_interface_u dbus_interface = {
 int input_dbus_init(void *data)
 {
        int ret = 0;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_INPUT, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_INPUT, &dbus_interface);
        if (ret < 0) {
                _E("Failed to init input device dbus interface(%d)", ret);
                return ret;
index b17cced9b5ced72315590c98c99d2c0f5ea00502..befb9979565df10264d7e4d7c4074d7908caf4e9 100644 (file)
@@ -299,7 +299,7 @@ static void input_init(void *data)
                input_devman_exit();
        }
 
-       ret = input_dbus_init(NULL);
+       ret = input_dbus_init(data);
        if (ret < 0)
                _E("Failed to init input device dbus interface(%d)", ret);
 
index 7e49f15890699bb1c60b11ec132c3d6a2c85cbc5..f6d76e64f47a9268745ecb5377818f6ebd04d7e8 100644 (file)
@@ -146,12 +146,16 @@ static int ir_probe(void *data)
 static void ir_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_IR, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_IR, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_LED, &dbus_interface_legacy);
+       ret = gdbus_add_object(handle, DEVICED_PATH_LED, &dbus_interface_legacy);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index a4c8759681358ed2c5ea85626b8f1f97f8144ba7..3550a0a6bd75dc0cf27c7c5dbfa85967f924c3ed 100644 (file)
@@ -387,8 +387,12 @@ static const dbus_interface_u dbus_interface = {
 static void rgb_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_LED, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_LED, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index f16563c5adda387e66eec7cdde980968518f11cd..9401407f608da3734440fb2104c34ec109aab123 100644 (file)
@@ -174,9 +174,13 @@ static int torch_probe(void *data)
 static void torch_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        /* init dbus interface */
-       ret = gdbus_add_object(NULL, DEVICED_PATH_LED, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_LED, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 }
index 501bef4e00c5b0cbc92bd7a97301a7bc56cd1e47..ad6f0c1f710af4ee95fd91600fd89332d11bbf59 100644 (file)
@@ -395,8 +395,12 @@ static const dbus_interface_u dbus_interface = {
 void power_dbus_init(void *data)
 {
        int retval;
+       dbus_handle_h handle = NULL;
 
-       retval = gdbus_add_object(NULL, DEVICED_PATH_POWER, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       retval = gdbus_add_object(handle, DEVICED_PATH_POWER, &dbus_interface);
        if (retval < 0)
                _E("Failed to init dbus method.");
 }
index e2dde9cd093aae90967f9921817910a5d4be7e29..17f172cc2b8af1ce7cf2d487c07b636349426c22 100644 (file)
@@ -481,9 +481,13 @@ out:
 void power_off_init(void *data)
 {
        int ret_val;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        /* init dbus interface */
-       ret_val = gdbus_add_object(NULL, DEVICED_PATH_POWEROFF, &dbus_interface);
+       ret_val = gdbus_add_object(handle, DEVICED_PATH_POWEROFF, &dbus_interface);
        if (ret_val < 0)
                _E("Failed to init dbus method: %d", ret_val);
 
index 3735ce5a8767de831f2d29658c40c9dcd683f1aa..6e4ff2f27858cc69f5d287fe0ca7c0086b8354ce 100644 (file)
@@ -877,8 +877,8 @@ void power_state_init(void *data)
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_callback);
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_REQUEST_TRANSITION_STATE, transition_request_callback);
 
-       power_dbus_init(NULL);
-       power_off_init(NULL);
+       power_dbus_init(data);
+       power_off_init(data);
        power_suspend_init();
        power_event_lock_init();
 
index f516f244232d8223841d9ad68ce5bca6b6b7058a..22c13b8bd0e708ab8b85691f9279f26f6ed2cc61 100644 (file)
@@ -147,8 +147,12 @@ static const dbus_interface_u dbus_interface = {
 static void cpu_info_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_SYSNOTI, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 }
index ba3164f20ccafec92c3f031a5313dedebc0d2311..d8e86378e04f826dcee3ff82708f6e42c9d0eafc 100644 (file)
@@ -84,12 +84,16 @@ static const dbus_interface_u dbus_interface = {
 static void thermal_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        ret = syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_done);
        if (ret < 0)
                _E("Failed to register booting done notifier.");
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_TEMPERATURE, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_TEMPERATURE, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 }
index c53c98ef4b2cda28d74db613cb6aa4705ba7fbff..4c209847061f266cd124d0f23a02bade6ba33647 100644 (file)
@@ -383,8 +383,12 @@ out:
 static void time_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_SYSNOTI, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_SYSNOTI, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index a37761f8a285a39d5c91f947c30e2d6f4c1dae29..3215b6c519399ff5fb46eb87f0e9214c6586d78c 100644 (file)
@@ -159,6 +159,10 @@ out:
 static void sensitivity_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        if (sensitivity_dev_available)
                return;
@@ -175,7 +179,7 @@ static void sensitivity_init(void *data)
        _I("Touch sensitivity device structure load success.");
 
        /* init dbus interface */
-       ret = gdbus_add_object(NULL, DEVICED_PATH_TOUCH, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_TOUCH, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 1afc56cfb9a31f2c03bbb94146c180b2f317ea25..6840896656e03477ff5fa196e55372692db569b8 100644 (file)
@@ -305,6 +305,10 @@ static int delayed_init_done(void *data)
 static void touchscreen_init(void *data)
 {
        int ret, val;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        if (battery_plgn->handle) {
                fp_get_var_battery_status = dlsym(battery_plgn->handle, "get_var_battery_status");
@@ -333,7 +337,7 @@ static void touchscreen_init(void *data)
                g_display_config->touch_wakeup = val;
 
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_TOUCH, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_TOUCH, &dbus_interface);
 
        if (ret < 0)
                _E("Failed to init dbus method. (%d)", ret);
index 818fa8bcd81df8ddabd6686d4cc48dd354bb48a4..20fcda65b5f879eaf5e425fe63a0959e68f25891 100644 (file)
@@ -1164,13 +1164,17 @@ static void tzip_init(void *data)
 {
        int ret;
        _D("tzip_init");
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        tzip_lock_init();
 
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_done);
        syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_POWEROFF, tzip_poweroff);
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_TZIP, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_TZIP, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method: %d", ret);
 
index 1bb8021e5aa8f4a725ac09b0083460b94dd2b136..5a3735a420ce24ce1958ecc128759e86fce1ab7e 100644 (file)
@@ -166,8 +166,12 @@ static const dbus_interface_u dbus_interface = {
 int usb_dbus_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_USB, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_USB, &dbus_interface);
        if (ret < 0)
                _E("Failed to init dbus method for USB: %d", ret);
 
index 1f8c76dbb54ed287f9acf6e15d09a5bae1bfc11e..849440dac5394a77b12ccb62edb965d798050b49 100644 (file)
@@ -310,7 +310,7 @@ static void usb_init(void *data)
        if (ret < 0)
                _E("Failed to register udev event(%d) for USB", ret);
 
-       ret = usb_dbus_init(NULL);
+       ret = usb_dbus_init(data);
        if (ret < 0)
                _E("Failed to init dbus(%d) for USB", ret);
 
index 29ea83a6940aacd017699197aaf5993e68bab8eb..e5a4b9d4644e5ca327ac4370ccbb08077b5354c3 100644 (file)
@@ -1140,6 +1140,10 @@ static int delayed_init_done(void *data)
 static void usbhost_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
+
+       if (data)
+               handle = *(dbus_handle_h *)data;
 
        if (g_display_config)
                display_on_usb_conn_changed = g_display_config->display_on_usb_conn_changed;
@@ -1150,7 +1154,7 @@ static void usbhost_init(void *data)
                _E("Failed to register usb uevent: %d", ret);
 
        /* register usbhost interface and method */
-       ret = gdbus_add_object(NULL, DEVICED_PATH_USBHOST, &dbus_interface);
+       ret = gdbus_add_object(handle, DEVICED_PATH_USBHOST, &dbus_interface);
        if (ret < 0)
                _E("Failed to register dbus interface and method: %d", ret);
 
index 787c475552b532d759197081277bc9e197bc62f0..5dea998ebbb0b0e5ff8e11e371303e534d77ee3e 100644 (file)
@@ -606,8 +606,12 @@ static const dbus_interface_u dbus_interface = {
 static void usb_host_test_init(void *data)
 {
        int ret;
+       dbus_handle_h handle = NULL;
 
-       ret = gdbus_add_object(NULL, DEVICED_PATH_USB_HOST_TEST, &dbus_interface);
+       if (data)
+               handle = *(dbus_handle_h *)data;
+
+       ret = gdbus_add_object(handle, DEVICED_PATH_USB_HOST_TEST, &dbus_interface);
        if (ret < 0) {
                _E("Failed to register dbus method! %d", ret);
                return;