diff --git a/src/mgmt.c b/src/mgmt.c
index f34c555..ce1ff2f 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
static void update_settings(struct btd_adapter *adapter, uint32_t settings)
{
- struct controller_info *info;
- uint16_t index;
-
DBG("new settings %x", settings);
- index = adapter_get_dev_id(adapter);
-
- info = &controllers[index];
-
adapter_update_connectable(adapter, mgmt_connectable(settings));
adapter_update_discoverable(adapter, mgmt_discoverable(settings));
adapter_update_pairable(adapter, mgmt_pairable(settings));
-
- if (mgmt_ssp(info->supported_settings) && !mgmt_ssp(settings))
- mgmt_set_ssp(index, TRUE);
-
- if (mgmt_low_energy(info->supported_settings) &&
- !mgmt_low_energy(settings))
- mgmt_set_low_energy(index, TRUE);
}
static void mgmt_update_powered(struct btd_adapter *adapter,
if (!mgmt_pairable(info->current_settings))
mgmt_set_pairable(index, TRUE);
+ if (mgmt_ssp(info->supported_settings) &&
+ !mgmt_ssp(info->current_settings))
+ mgmt_set_ssp(index, TRUE);
+
+ if (mgmt_low_energy(info->supported_settings) &&
+ !mgmt_low_energy(info->current_settings))
+ mgmt_set_low_energy(index, TRUE);
+
if (mgmt_powered(info->current_settings)) {
get_connections(sk, index);
btd_adapter_start(adapter);