diff mbox series

[BlueZ] advertising: Fix advertising flags

Message ID 20200526193314.25036-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ] advertising: Fix advertising flags | expand

Commit Message

Luiz Augusto von Dentz May 26, 2020, 7:33 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

Comments

Luiz Augusto von Dentz May 27, 2020, 5:14 p.m. UTC | #1
Hi,

On Tue, May 26, 2020 at 12:33 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> 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(-)
>
> diff --git a/src/advertising.c b/src/advertising.c
> index 45ff19fa0..829c481f6 100644
> --- a/src/advertising.c
> +++ b/src/advertising.c
> @@ -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))
> --
> 2.25.3

Pushed.
diff mbox series

Patch

diff --git a/src/advertising.c b/src/advertising.c
index 45ff19fa0..829c481f6 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -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))