diff options
-rw-r--r-- | plugins/hciops.c | 2 | ||||
-rw-r--r-- | plugins/mgmtops.c | 3 | ||||
-rw-r--r-- | src/adapter.c | 6 | ||||
-rw-r--r-- | src/adapter.h | 2 | ||||
-rw-r--r-- | src/manager.c | 4 | ||||
-rw-r--r-- | src/manager.h | 2 |
6 files changed, 9 insertions, 10 deletions
diff --git a/plugins/hciops.c b/plugins/hciops.c index 04802f486..00b90061c 100644 --- a/plugins/hciops.c +++ b/plugins/hciops.c @@ -656,7 +656,7 @@ static gboolean init_adapter(int index) gboolean pairable, discoverable; if (!dev->registered) { - adapter = btd_manager_register_adapter(index); + adapter = btd_manager_register_adapter(index, TRUE); if (adapter) dev->registered = TRUE; } else { diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index 147cf7c9f..fd42a6467 100644 --- a/plugins/mgmtops.c +++ b/plugins/mgmtops.c @@ -959,7 +959,8 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len) DBG("hci%u name %s", index, (char *) rp->name); DBG("hci%u short name %s", index, (char *) rp->short_name); - adapter = btd_manager_register_adapter(index); + adapter = btd_manager_register_adapter(index, + mgmt_powered(info->current_settings)); if (adapter == NULL) { error("mgmtops: unable to register adapter"); return; diff --git a/src/adapter.c b/src/adapter.c index 5742fd2db..685e1ca51 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2454,11 +2454,9 @@ void btd_adapter_unref(struct btd_adapter *adapter) g_free(path); } -gboolean adapter_init(struct btd_adapter *adapter) +gboolean adapter_init(struct btd_adapter *adapter, gboolean up) { - /* adapter_ops makes sure that newly registered adapters always - * start off as powered */ - adapter->up = TRUE; + adapter->up = up; adapter->allow_name_changes = TRUE; diff --git a/src/adapter.h b/src/adapter.h index c285172e5..22bb0bba9 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -99,7 +99,7 @@ void adapter_remove_device(DBusConnection *conn, struct btd_adapter *adapter, gboolean remove_storage); struct btd_adapter *adapter_create(DBusConnection *conn, int id); -gboolean adapter_init(struct btd_adapter *adapter); +gboolean adapter_init(struct btd_adapter *adapter, gboolean up); void adapter_remove(struct btd_adapter *adapter); void adapter_set_allow_name_changes(struct btd_adapter *adapter, gboolean allow_name_changes); diff --git a/src/manager.c b/src/manager.c index 1d44c6681..8c4945755 100644 --- a/src/manager.c +++ b/src/manager.c @@ -377,7 +377,7 @@ void manager_add_adapter(const char *path) btd_stop_exit_timer(); } -struct btd_adapter *btd_manager_register_adapter(int id) +struct btd_adapter *btd_manager_register_adapter(int id, gboolean up) { struct btd_adapter *adapter; const char *path; @@ -394,7 +394,7 @@ struct btd_adapter *btd_manager_register_adapter(int id) adapters = g_slist_append(adapters, adapter); - if (!adapter_init(adapter)) { + if (!adapter_init(adapter, up)) { adapters = g_slist_remove(adapters, adapter); btd_adapter_unref(adapter); return NULL; diff --git a/src/manager.h b/src/manager.h index 4f92d2f76..005690955 100644 --- a/src/manager.h +++ b/src/manager.h @@ -38,7 +38,7 @@ struct btd_adapter *manager_find_adapter_by_id(int id); struct btd_adapter *manager_get_default_adapter(void); void manager_foreach_adapter(adapter_cb func, gpointer user_data); GSList *manager_get_adapters(void); -struct btd_adapter *btd_manager_register_adapter(int id); +struct btd_adapter *btd_manager_register_adapter(int id, gboolean up); int btd_manager_unregister_adapter(int id); void manager_add_adapter(const char *path); void btd_manager_set_did(uint16_t vendor, uint16_t product, uint16_t version); |