summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-04-09 22:20:29 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-04-09 22:20:29 +0000
commit8d8f45c98ddabe1ffb5b2b4f93fa3983027ba740 (patch)
tree07f72a8765dec41415ffd4f68f13cf9c3cf899b6 /hcid
parent60202f31c998cc68c14f57c91e4b40d2c39f95f2 (diff)
Fix DeviceCreated/DeviceRemoved signal being emitted for temporary devices.
Diffstat (limited to 'hcid')
-rw-r--r--hcid/adapter.c20
-rw-r--r--hcid/device.c5
2 files changed, 16 insertions, 9 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 269476ec..94aceadb 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -2298,10 +2298,6 @@ struct device *adapter_get_device(DBusConnection *conn,
snprintf(path, MAX_PATH_LENGTH, "/hci%d", adapter->dev_id);
adapter->devices = g_slist_append(adapter->devices, device);
- dbus_connection_emit_signal(conn, path,
- ADAPTER_INTERFACE, "DeviceCreated",
- DBUS_TYPE_OBJECT_PATH, &device->path,
- DBUS_TYPE_INVALID);
return device;
}
@@ -2318,11 +2314,13 @@ void adapter_remove_device(DBusConnection *conn, struct adapter *adapter,
snprintf(path, MAX_PATH_LENGTH, "/hci%d", adapter->dev_id);
- dbus_connection_emit_signal(conn, path,
- ADAPTER_INTERFACE,
- "DeviceRemoved",
- DBUS_TYPE_OBJECT_PATH, &device->path,
- DBUS_TYPE_INVALID);
+ if (!device->temporary) {
+ dbus_connection_emit_signal(conn, path,
+ ADAPTER_INTERFACE,
+ "DeviceRemoved",
+ DBUS_TYPE_OBJECT_PATH, &device->path,
+ DBUS_TYPE_INVALID);
+ }
device_remove(device, conn);
adapter->devices = g_slist_remove(adapter->devices, device);
@@ -3687,6 +3685,10 @@ static DBusHandlerResult list_devices(DBusConnection *conn,
for (l = adapter->devices; l; l = l->next) {
struct device *device = l->data;
+
+ if (device->temporary)
+ continue;
+
dbus_message_iter_append_basic(&array_iter,
DBUS_TYPE_OBJECT_PATH, &device->path);
}
diff --git a/hcid/device.c b/hcid/device.c
index 32567851..1a0840e5 100644
--- a/hcid/device.c
+++ b/hcid/device.c
@@ -1114,6 +1114,11 @@ static void browse_cb(gpointer user_data, sdp_list_t *recs, int err)
DBUS_TYPE_ARRAY, &uuids);
g_free(uuids);
+ dbus_connection_emit_signal(req->conn, dbus_message_get_path(req->msg),
+ ADAPTER_INTERFACE, "DeviceCreated",
+ DBUS_TYPE_OBJECT_PATH, &device->path,
+ DBUS_TYPE_INVALID);
+
/* Reply create device request */
reply = dbus_message_new_method_return(req->msg);
if (!reply)