summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-11-30 18:01:28 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-11-30 18:01:28 +0100
commit8d88431aa83063b5749f7000b4911287d8b08d12 (patch)
tree691557d46b83381b063963036f998286355bb7ef
parent8ec535d64374d07647f79b13711fa63006d93b62 (diff)
Set default adapter on registration
-rw-r--r--src/manager.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/manager.c b/src/manager.c
index 010635d2..10876161 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -376,6 +376,13 @@ static void manager_add_adapter(struct btd_adapter *adapter)
DBUS_TYPE_INVALID);
adapters = g_slist_append(adapters, adapter);
+
+ if (default_adapter_id < 0) {
+ int new_default = hci_get_route(NULL);
+
+ if (new_default >= 0)
+ manager_set_default_adapter(new_default);
+ }
}
static void manager_remove_adapter(struct btd_adapter *adapter)
@@ -445,7 +452,7 @@ int manager_start_adapter(int id)
if (ret < 0)
return ret;
- if (manager_get_default_adapter() < 0)
+ if (default_adapter_id < 0)
manager_set_default_adapter(id);
return 0;