diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2020-06-05 10:45:21 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2020-06-05 11:16:24 -0700 |
commit | 9bc0b090e202dfc4bd31c0212778941875e7a5ef (patch) | |
tree | 74dd65a0a2770a215b118422c3dccfc25d9f35ec /src/advertising.c | |
parent | 14a395501fe29976d14521bf5e9d2e8dcc4685f4 (diff) | |
download | bluez-9bc0b090e202dfc4bd31c0212778941875e7a5ef.tar.gz |
advertising: Fix resetting NO_BREDR flag
When setting BT_AD_FLAG_LIMITED it was actually overwriting
BT_AD_FLAG_NO_BREDR as well so this moves the logic of detecting if the
instance needs to set BT_AD_FLAG_NO_BREDR to set_flags so it is always
updated when attempting to set any flags.
Diffstat (limited to 'src/advertising.c')
-rw-r--r-- | src/advertising.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/advertising.c b/src/advertising.c index 4c91586c2..076d591b6 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -675,6 +675,13 @@ static bool set_flags(struct btd_adv_client *client, uint8_t flags) if (!btd_adapter_get_bredr(client->manager->adapter)) flags |= BT_AD_FLAG_NO_BREDR; + /* Set BR/EDR Not Supported if adapter is not discoverable but the + * instance is. + */ + if ((flags & (BT_AD_FLAG_GENERAL | BT_AD_FLAG_LIMITED)) && + !btd_adapter_get_discoverable(client->manager->adapter)) + flags |= BT_AD_FLAG_NO_BREDR; + if (!bt_ad_add_flags(client->data, &flags, 1)) return false; @@ -697,12 +704,9 @@ static bool parse_discoverable(DBusMessageIter *iter, dbus_message_iter_get_basic(iter, &discoverable); - if (discoverable) { - /* Set BR/EDR Not Supported if adapter is no discoverable */ - if (!btd_adapter_get_discoverable(client->manager->adapter)) - flags = BT_AD_FLAG_NO_BREDR; - flags |= BT_AD_FLAG_GENERAL; - } else + if (discoverable) + flags = BT_AD_FLAG_GENERAL; + else flags = 0x00; if (!set_flags(client , flags)) |