Skip to contentSkip to conversation

advertising: Fix advertising flags

PATCH In review Luiz Augusto von Dentz 1 participant 2 messages May 26, 2020 – May 27, 2020 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 advertising: Fix advertising flags

From: Luiz Augusto von Dentz <[email protected]>

When an instance wants to force being discoverable the code shall actually check if the adapter is in general disverable mode already and if not set BR/EDR as not supported so that devices scanning don't assume BR/EDR PHY is connectable when in fact it isn't.

---
 src/advertising.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
src/advertising.c +6 -3
index 45ff19fa0..829c481f6 100644
@@ -697,9 +697,12 @@ static bool parse_discoverable(DBusMessageIter *iter,
 
 	dbus_message_iter_get_basic(iter, &discoverable);
 
-	if (discoverable)
-		flags = 0x02;
-	else
+	if (discoverable) {
+		/* Set BR/EDR Not Supported if adapter is no discoverable */
+		if (!btd_adapter_get_discoverable(client->manager->adapter))
+			flags = 0x04;
+		flags |= 0x02;
+	} else
 		flags = 0x00;
 
 	if (!set_flags(client , flags))
Signature · 1 line
2.25.3
author maintainer
#1 lore raw

Hi,

Quoted 32 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

When an instance wants to force being discoverable the code shall actually check if the adapter is in general disverable mode already and if not set BR/EDR as not supported so that devices scanning don't assume BR/EDR PHY is connectable when in fact it isn't.

---
 src/advertising.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
src/advertising.c +6 -4
index 45ff19fa0..829c481f6 100644
@@ -697,9 +697,12 @@ static bool parse_discoverable(DBusMessageIter *iter,
 
        dbus_message_iter_get_basic(iter, &discoverable);
 
-       if (discoverable)
-               flags = 0x02;
-       else
+       if (discoverable) {
+               /* Set BR/EDR Not Supported if adapter is no discoverable */
+               if (!btd_adapter_get_discoverable(client->manager->adapter))
+                       flags = 0x04;
+               flags |= 0x02;
+       } else
                flags = 0x00;
 
        if (!set_flags(client , flags))
--
Quoted 1 line

2.25.3

Pushed.

Signature · 1 line
Luiz Augusto von Dentz