summaryrefslogtreecommitdiffstats
path: root/src/device.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-11-10 15:04:41 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-11-10 21:39:44 +0200
commit438ab01b43075b715345df0d85447aaf338fd4fc (patch)
tree652018f7aabbc55118ecd8d8236cb3e22faf0b44 /src/device.c
parentccc66bbab0b3648a986a90d68befd57f4733cdde (diff)
Fix bug which makes DeviceCreated to not being emitted.
DeviceCreated was not being emitted when the remote device initiate the connection.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c24
1 files changed, 12 insertions, 12 deletions
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) {