CreatDevice signal should be emitted at function create_stored_device_from_profiles() in src/adapter.c

Xu, Martin
2009-04-16T08:49:10Z

Hi:
I found that at bluez CreatDevice signal is not emitted at function create_stored_device_from_profile() in src/adapter.c.
That leads to system can not got the CreatDevice singal when the deivce is created though storage. The usage case is that, when I unplug the bluethooth usb dongle and then plug in again. System can not get the CreatDevice signal. So ConnMan can not handle the CreatDevice signal.
I have created patch to bluez to fix the issue. Please review, any comments are welcome.
diff --git a/src/adapter.c b/src/adapter.c
index 44a93b1..c096375 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1867,6 +1867,7 @@ static void create_stored_device_from_profiles(char *key, char *value,
struct btd_device *device;
bdaddr_t dst;
char srcaddr[18], dstaddr[18];
+ const char *path;

ba2str(&adapter->bdaddr, srcaddr);

@@ -1877,6 +1878,12 @@ static void create_stored_device_from_profiles(char *key, char *value,
device = device_create(connection, adapter, key);
if (!device)
return;
+
+ path = device_get_path(device);
+ g_dbus_emit_signal(connection, adapter->path,
+ ADAPTER_INTERFACE, "DeviceCreated",
+ DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID);

device_set_temporary(device, FALSE);
adapter->devices = g_slist_append(adapter->devices, device);