Skip to contentSkip to conversation

Set BREDR not supported bit in AD Flag when discoverable is off

PATCH In review [email protected] 3 participants 3 messages Jul 5, 2024 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set BREDR not supported bit in AD Flag when discoverable is off

From: Prathibha Madugonde <[email protected]>

Fix for GAP/DISC/NONM/BV-02-C
As per GAP.TS.p44 test spec
IUT does not contain General Discoverable mode and Limited Discoverable mode in the AD Type Flag. IUT shall send AD Type Flag to PASS the test case, thus set BR/EDR not supported bit in the AD Type Flag when discoverable is off.

client/advertising.c:
Allowing discoverable property to list in the parsing function when discoverable is off.

Test steps:
From DUT, bluetoothctl go to menu advertise set discoverable to off and then advertise on. In AD Flags BR/EDR not supported BIT shall be set.

---
 client/advertising.c | 8 +-------
 src/advertising.c    | 3 +--
 2 files changed, 2 insertions(+), 9 deletions(-)
client/advertising.c +1 -7
index a9b865a65..4a98121a4 100644
@@ -416,12 +416,6 @@ static gboolean get_data(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
-static gboolean discoverable_exists(const GDBusPropertyTable *property,
-							void *data)
-{
-	return ad.discoverable;
-}
-
 static gboolean get_discoverable(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *user_data)
 {
@@ -498,7 +492,7 @@ static const GDBusPropertyTable ad_props[] = {
 	{ "ManufacturerData", "a{qv}", get_manufacturer_data, NULL,
 						manufacturer_data_exists },
 	{ "Data", "a{yv}", get_data, NULL, data_exists },
-	{ "Discoverable", "b", get_discoverable, NULL, discoverable_exists },
+	{ "Discoverable", "b", get_discoverable, NULL, NULL },
 	{ "DiscoverableTimeout", "q", get_discoverable_timeout, NULL,
 						discoverable_timeout_exists },
 	{ "Includes", "as", get_includes, NULL, includes_exists },
src/advertising.c +1 -2
index 5d373e088..af3ed2b93 100644
@@ -734,8 +734,7 @@ static bool set_flags(struct btd_adv_client *client, uint8_t flags)
 	/* 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))
+	if (!btd_adapter_get_discoverable(client->manager->adapter))
 		flags |= BT_AD_FLAG_NO_BREDR;
 
 	if (!bt_ad_add_flags(client->data, &flags, 1))
Signature · 1 line
2.17.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=868660

---Test result---

Test Summary:

CheckPatch                    PASS      0.32 seconds
GitLint                       PASS      0.22 seconds
BuildEll                      PASS      24.57 seconds
BluezMake                     PASS      1659.26 seconds
MakeCheck                     PASS      13.14 seconds
MakeDistcheck                 PASS      176.97 seconds
CheckValgrind                 PASS      251.17 seconds
CheckSmatch                   PASS      353.55 seconds
bluezmakeextell               PASS      119.49 seconds
IncrementalBuild              PASS      1447.26 seconds
ScanBuild                     PASS      1008.32 seconds

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to [email protected]

Hi,

Quoted 42 lines · On Fri, Jul 5, 2024 at 3:37 AM <[email protected]> wrote:

From: Prathibha Madugonde <[email protected]>

Fix for GAP/DISC/NONM/BV-02-C
As per GAP.TS.p44 test spec
IUT does not contain General Discoverable mode and Limited Discoverable mode in the AD Type Flag. IUT shall send AD Type Flag to PASS the test case, thus set BR/EDR not supported bit in the AD Type Flag when discoverable is off.

client/advertising.c:
Allowing discoverable property to list in the parsing function when discoverable is off.

Test steps:
From DUT, bluetoothctl go to menu advertise set discoverable to off and then advertise on. In AD Flags BR/EDR not supported BIT shall be set.

---
 client/advertising.c | 8 +-------
 src/advertising.c    | 3 +--
 2 files changed, 2 insertions(+), 9 deletions(-)
client/advertising.c +0 -6
index a9b865a65..4a98121a4 100644
@@ -416,12 +416,6 @@ static gboolean get_data(const GDBusPropertyTable *property,
        return TRUE;
 }
 
-static gboolean discoverable_exists(const GDBusPropertyTable *property,
-                                                       void *data)
-{
-       return ad.discoverable;
-}
-
 static gboolean get_discoverable(const GDBusPropertyTable *property,
                                        DBusMessageIter *iter, void *user_data)
 {

client/advertising.c static const GDBusPropertyTable ad_props[] = { · line 495

Quoted 5 lines
client/advertising.c +1 -1
@@ -498,7 +492,7 @@ static const GDBusPropertyTable ad_props[] = {
        { "ManufacturerData", "a{qv}", get_manufacturer_data, NULL,
                                                manufacturer_data_exists },
        { "Data", "a{yv}", get_data, NULL, data_exists },
-       { "Discoverable", "b", get_discoverable, NULL, discoverable_exists },
+       { "Discoverable", "b", get_discoverable, NULL, NULL },

Doesn't seems the above change have anything to do with the commit description, perhaps you want to force it as non-discoverable in case it is not set? I guess it makes sense but it should probably be made into its own commit with proper description.

Quoted 20 lines
client/advertising.c +0 -0
        { "DiscoverableTimeout", "q", get_discoverable_timeout, NULL,
                                                discoverable_timeout_exists },
        { "Includes", "as", get_includes, NULL, includes_exists },
src/advertising.c +1 -3
index 5d373e088..af3ed2b93 100644
@@ -734,8 +734,7 @@ static bool set_flags(struct btd_adv_client *client, uint8_t flags)
        /* 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))
+       if (!btd_adapter_get_discoverable(client->manager->adapter))
                flags |= BT_AD_FLAG_NO_BREDR;
 
        if (!bt_ad_add_flags(client->data, &flags, 1))
--

2.17.1

Signature · 1 line
Luiz Augusto von Dentz