diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-12-01 12:08:21 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-12-01 12:08:21 -0300 |
commit | a537a1998dd27a9ab92f4eaae47fc09f36a83545 (patch) | |
tree | bf84096d629eff2c354aee7d6d7f96d7e05c70e4 /src | |
parent | 2071a8a2f8e6d238ff0d0f44cb075c902b8ec0e4 (diff) |
Fix DefaultAdapter not indicanting adapter properly after repluging.
Diffstat (limited to 'src')
-rw-r--r-- | src/manager.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/manager.c b/src/manager.c index b290852e..ad14e566 100644 --- a/src/manager.c +++ b/src/manager.c @@ -380,8 +380,7 @@ static void manager_add_adapter(struct btd_adapter *adapter) if (default_adapter_id < 0) { int new_default = hci_get_route(NULL); - if (new_default >= 0) - manager_set_default_adapter(new_default); + manager_set_default_adapter(new_default); } } @@ -398,8 +397,7 @@ static void manager_remove_adapter(struct btd_adapter *adapter) if (default_adapter_id == dev_id || default_adapter_id < 0) { int new_default = hci_get_route(NULL); - if (new_default >= 0) - manager_set_default_adapter(new_default); + manager_set_default_adapter(new_default); } adapters = g_slist_remove(adapters, adapter); @@ -478,11 +476,17 @@ int manager_get_default_adapter() void manager_set_default_adapter(int id) { - struct btd_adapter *adapter = manager_find_adapter_by_id(id); - const gchar *path = adapter_get_path(adapter); + struct btd_adapter *adapter; + const gchar *path; default_adapter_id = id; + adapter = manager_find_adapter_by_id(id); + if (!adapter) + return; + + path = adapter_get_path(adapter); + g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "DefaultAdapterChanged", |