diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2006-10-22 19:47:12 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2006-10-22 19:47:12 +0000 |
commit | c9eeea81a3cc3db1ca250c13f26107c7c0d201fa (patch) | |
tree | bf79ae9f1131c162fc892381c0a8880db11bd404 /hcid | |
parent | 68cbd3fc410d1e50fe4e14860eade87ab34dd08b (diff) |
Send DefaultAdapterChanged when necessary
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/hcid/dbus.c b/hcid/dbus.c index 35855b0e..0241f8ee 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -595,8 +595,27 @@ int hcid_dbus_unregister_device(uint16_t id) failed: ret = unregister_dbus_path(path); - if (ret == 0 && default_dev == id) + if (ret == 0 && default_dev == id) { default_dev = hci_get_route(NULL); + if (default_dev >= 0) { + snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, + default_dev); + message = dbus_message_new_signal(BASE_PATH, + MANAGER_INTERFACE, + "DefaultAdapterChanged"); + if (!message) { + error("Can't allocate D-Bus message"); + /* Return success since actual unregistering + * succeeded */ + return ret; + } + + dbus_message_append_args(message, + DBUS_TYPE_STRING, &pptr, + DBUS_TYPE_INVALID); + send_message_and_unref(connection, message); + } + } return ret; } |