advertising: Fix advertising flags
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 26 May 2020 18:07:48 +0000 (11:07 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
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.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/advertising.c

index 5e9fd3e..696418d 100644 (file)
@@ -692,9 +692,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))