shared/ad: Add bt_ad_length
Luiz Augusto von Dentz
maintainerPATCH 1/2 shared/ad: Add bt_ad_length
From: Luiz Augusto von Dentz <[email protected]>
This adds bt_ad_length which can be used to return the current size of the bt_ad data.
--- src/shared/ad.c | 11 ++++++++--- src/shared/ad.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
src/shared/ad.c +8 -3
@@ -520,9 +520,14 @@ static size_t data_length(struct queue *queue)return length; } -static size_t calculate_length (struct bt_ad *ad) +size_t bt_ad_length (struct bt_ad *ad) { -size_t length =0 ; +size_t length; + +if (!ad) +return 0 ; + + length =0 ; length +=uuid_list_length (ad->service_uuids);
@@ -698,7 +703,7 @@ uint8_t *bt_ad_generate(struct bt_ad *ad, size_t *length)if (!ad)return NULL ; - *length =calculate_length (ad); + *length =bt_ad_length (ad);if (*length > ad->max_len)return NULL ;
src/shared/ad.h +2 -0
@@ -108,6 +108,8 @@ struct bt_ad *bt_ad_ref(struct bt_ad *ad);void bt_ad_unref (struct bt_ad *ad); +size_t bt_ad_length (struct bt_ad *ad); +uint8_t *bt_ad_generate (struct bt_ad *ad,size_t *length);bool bt_ad_is_empty (struct bt_ad *ad);
Signature · 1 line
2.45.0
Luiz Augusto von Dentz
maintainerPATCH 2/2 advertising: Detect when EA needs to be used
From: Luiz Augusto von Dentz <[email protected]>
This attempts to detect when an advertising instance needs to set the secondary PHY in order to force EA PDUs to be used because its data is too big for legacy PDUs.
--- src/advertising.c | 7 +++++++ 1 file changed, 7 insertions(+)
src/advertising.c +7 -0
@@ -884,6 +884,13 @@ static int get_adv_flags(struct btd_adv_client *client) flags |= client->flags; +/* Detect if the length is bigger that legacy and secondary is not set +* then force it to be set to ensure the kernel uses EA. +*/ +if (bt_ad_length (client->data) >BT_AD_MAX_DATA_LEN && + !(flags &MGMT_ADV_FLAG_SEC_MASK )) + flags |=MGMT_ADV_FLAG_SEC_1M ; +return flags; }
Signature · 1 line
2.45.0
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Wed, 15 May 2024 12:12:49 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This adds
bt_ad_lengthwhich can be used to return the current size of thebt_addata.--- src/shared/ad.c | 11 ++++++++--- src/shared/ad.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
Here is the summary with links:
- [BlueZ,v1,1/2] shared/ad: Add bt_ad_length
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=263d6f7da564 - [BlueZ,v1,2/2] advertising: Detect when EA needs to be used https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ea242fbf8602
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
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=853469
---Test result---
Test Summary:
CheckPatch PASS 0.76 seconds GitLint PASS 0.53 seconds BuildEll PASS 26.76 seconds BluezMake PASS 1686.82 seconds MakeCheck PASS 12.91 seconds MakeDistcheck PASS 178.64 seconds CheckValgrind PASS 247.58 seconds CheckSmatch PASS 350.63 seconds bluezmakeextell PASS 118.55 seconds IncrementalBuild PASS 2981.30 seconds ScanBuild PASS 982.69 seconds
---
Regards,
Linux Bluetooth