From 438ab01b43075b715345df0d85447aaf338fd4fc Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 10 Nov 2008 15:04:41 -0300 Subject: Fix bug which makes DeviceCreated to not being emitted. DeviceCreated was not being emitted when the remote device initiate the connection. --- src/device.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/device.c') diff --git a/src/device.c b/src/device.c index cc1ede20..b7c17bb8 100644 --- a/src/device.c +++ b/src/device.c @@ -1071,18 +1071,10 @@ proceed: /* Store the device's profiles in the filesystem */ store_profiles(device); - if (req->msg) { - if (dbus_message_is_method_call(req->msg, DEVICE_INTERFACE, - "DiscoverServices")) { - discover_device_reply(req, req->records); - goto cleanup; - } - - g_dbus_emit_signal(req->conn, dbus_message_get_path(req->msg), + g_dbus_emit_signal(req->conn, adapter_get_path(device->adapter), ADAPTER_INTERFACE, "DeviceCreated", DBUS_TYPE_OBJECT_PATH, &device->path, DBUS_TYPE_INVALID); - } /* Update device list */ adapter_update_devices(device->adapter); @@ -1090,6 +1082,12 @@ proceed: if (!req->msg) goto cleanup; + if (dbus_message_is_method_call(req->msg, DEVICE_INTERFACE, + "DiscoverServices")) { + discover_device_reply(req, req->records); + goto cleanup; + } + /* Reply create device request */ reply = dbus_message_new_method_return(req->msg); if (!reply) @@ -1165,10 +1163,12 @@ int device_browse(struct btd_device *device, DBusConnection *conn, adapter_get_address(adapter, &src); req = g_new0(struct browse_req, 1); - if (conn && msg) { - req->conn = dbus_connection_ref(conn); + + req->conn = conn ? dbus_connection_ref(conn) : get_dbus_connection(); + + if (msg) req->msg = dbus_message_ref(msg); - } + req->device = device; if (search) { -- cgit