Skip to contentSkip to conversation

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

PATCH Superseded [email protected] 4 participants 5 messages Jul 3, 2024 – Jul 5, 2024 Bluetooth drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Added 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 added BR/EDR not supported bit in the AD Type Flag when discoverable is off.

---
 src/advertising.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
src/advertising.c +12 -2
index 5d373e088..cfb239585 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))
@@ -1499,6 +1498,17 @@ static DBusMessage *parse_advertisement(struct btd_adv_client *client)
 		goto fail;
 	}
 
+	/* GAP.TS.p44 Test Spec GAP/DISC/NONM/BV-02-C
+	 * page 158:
+	 * IUT does not contain
+	 * ‘LE General Discoverable Mode’ flag or the
+	 * ‘LE Limited Discoverable Mode’ flag in the Flags AD Type
+	 * But AD Flag Type should be there for the test case to
+	 * PASS. Thus BR/EDR Not Supported BIT shall be included
+	 * in the AD Type flag.
+	 */
+	set_flags(client, bt_ad_get_flags(client->data));
+
 	err = refresh_advertisement(client, add_adv_callback);
 
 	if (!err)
Signature · 1 line
2.17.1
#1 lore raw

Dear Prathibha,

Thank you for your patch.

Am 03.07.24 um 09:02 schrieb [email protected]:

Quoted 1 line

From: Prathibha Madugonde <[email protected]>

I’d use imperative mood in the commit message summary/title:

s/Added/Add/

Quoted 5 lines

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 added BR/EDR not supported bit in the AD Type Flag when

s/added/add/

Quoted 1 line

discoverable is off.

Please document your test setup.

Quoted 1 line

Please following the rules in HACKING [1].

Quoted 20 lines
---
  src/advertising.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
src/advertising.c +1 -2
index 5d373e088..cfb239585 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))
@@ -1499,6 +1498,17 @@ static DBusMessage *parse_advertisement(struct btd_adv_client *client)
  		goto fail;

src/advertising.c static DBusMessage *parse_advertisement(struct btd_adv_client *client) · line 1508

Quoted 10 lines
src/advertising.c +8 -0
  	}
 
+	/* GAP.TS.p44 Test Spec GAP/DISC/NONM/BV-02-C
+	 * page 158:
+	 * IUT does not contain
+	 * ‘LE General Discoverable Mode’ flag or the
+	 * ‘LE Limited Discoverable Mode’ flag in the Flags AD Type
+	 * But AD Flag Type should be there for the test case to
+	 * PASS. Thus BR/EDR Not Supported BIT shall be included
+	 * in the AD Type flag.

You could re-flow for longer lines.

src/advertising.c static DBusMessage *parse_advertisement(struct btd_adv_client *client) · line 1514

Quoted 6 lines
src/advertising.c +3 -0
+	 */
+	set_flags(client, bt_ad_get_flags(client->data));
+
  	err = refresh_advertisement(client, add_adv_callback);
 
  	if (!err)

Kind regards,

Paul

[1]: https://github.com/bluez/bluez/blob/be0b08770e9214592e89589b2dc069426c0d9b91/HACKING#L98

#2 lore raw
In reply to [email protected]

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=867858

---Test result---

Test Summary:

CheckPatch                    PASS      0.38 seconds
GitLint                       PASS      0.27 seconds
BuildEll                      PASS      25.00 seconds
BluezMake                     PASS      1764.21 seconds
MakeCheck                     PASS      13.46 seconds
MakeDistcheck                 PASS      181.73 seconds
CheckValgrind                 PASS      258.05 seconds
CheckSmatch                   PASS      361.46 seconds
bluezmakeextell               PASS      121.69 seconds
IncrementalBuild              PASS      1504.55 seconds
ScanBuild                     PASS      1052.02 seconds

---
Regards,
Linux Bluetooth

#3 lore raw
In reply to [email protected]

Hi,

Quoted 33 lines · On Wed, Jul 3, 2024 at 3:02 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 added BR/EDR not supported bit in the AD Type Flag when discoverable is off.

---
 src/advertising.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
src/advertising.c +1 -2
index 5d373e088..cfb239585 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))
@@ -1499,6 +1498,17 @@ static DBusMessage *parse_advertisement(struct btd_adv_client *client)
                goto fail;
        }
 

src/advertising.c static DBusMessage *parse_advertisement(struct btd_adv_client *client) · line 1510

Quoted 10 lines
src/advertising.c +10 -0
+       /* GAP.TS.p44 Test Spec GAP/DISC/NONM/BV-02-C
+        * page 158:
+        * IUT does not contain
+        * ‘LE General Discoverable Mode’ flag or the
+        * ‘LE Limited Discoverable Mode’ flag in the Flags AD Type
+        * But AD Flag Type should be there for the test case to
+        * PASS. Thus BR/EDR Not Supported BIT shall be included
+        * in the AD Type flag.
+        */
+       set_flags(client, bt_ad_get_flags(client->data));

Was there a bug or something that you are having to add this code here?

Quoted 6 lines
src/advertising.c +0 -1
        err = refresh_advertisement(client, add_adv_callback);
 
        if (!err)
--

2.17.1

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw
Quoted 36 lines · Luiz Augusto von Dentz

Hi,

Quoted 33 lines · On Wed, Jul 3, 2024 at 3:02 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 added BR/EDR not supported bit in the AD Type Flag when discoverable is off.

---
  src/advertising.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
src/advertising.c +1 -2
index 5d373e088..cfb239585 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))
@@ -1499,6 +1498,17 @@ static DBusMessage *parse_advertisement(struct btd_adv_client *client)
                 goto fail;
         }
 
Quoted 12 lines

src/advertising.c static DBusMessage *parse_advertisement(struct btd_adv_client *client) · line 1510

Quoted 10 lines
src/advertising.c +10 -0
+       /* GAP.TS.p44 Test Spec GAP/DISC/NONM/BV-02-C
+        * page 158:
+        * IUT does not contain
+        * ‘LE General Discoverable Mode’ flag or the
+        * ‘LE Limited Discoverable Mode’ flag in the Flags AD Type
+        * But AD Flag Type should be there for the test case to
+        * PASS. Thus BR/EDR Not Supported BIT shall be included
+        * in the AD Type flag.
+        */
+       set_flags(client, bt_ad_get_flags(client->data));

Was there a bug or something that you are having to add this code here?

Hi Luiz,

Yes there is an issue when discoverable is off the parse_discoverable() is not triggering when we do advertise on. Fixed this issue and sending in next patch- [PATCH BlueZ] Set BREDR not supported bit in AD Flag when discoverable is off. Please review.

Thanks
Prathibha Madugonde

Quoted 9 lines
Quoted 7 lines
src/advertising.c +0 -1
         err = refresh_advertisement(client, add_adv_callback);
 
         if (!err)
--

2.17.1