From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> 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(+) diff --git a/src/advertising.c b/src/advertising.c index b9d923d5d2c0..5d373e0884b1 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -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; } -- 2.45.0