Skip to content

Commit 9e2b9c7

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Host: Fix Periodic Advertising Sync using Advertiser List
Fix Periodic Advertising Sync Establishment to accept synchronization establishment to device listed in the Periodic Advertisers List when filter policy was used. Fixes #38520. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent b261d2b commit 9e2b9c7

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

subsys/bluetooth/host/hci_core.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,22 @@ enum {
156156
/** Periodic Advertising Sync has been created in the host. */
157157
BT_PER_ADV_SYNC_CREATED,
158158

159-
/** Periodic advertising is in sync and can be terminated */
159+
/** Periodic Advertising Sync is established and can be terminated */
160160
BT_PER_ADV_SYNC_SYNCED,
161161

162-
/** Periodic advertising is attempting sync sync */
162+
/** Periodic Advertising Sync is attempting to create sync */
163163
BT_PER_ADV_SYNC_SYNCING,
164164

165-
/** Periodic advertising is attempting sync sync */
165+
/** Periodic Advertising Sync is attempting to create sync using
166+
* Advertiser List
167+
*/
168+
BT_PER_ADV_SYNC_SYNCING_USE_LIST,
169+
170+
/** Periodic Advertising Sync established with reporting disabled */
166171
BT_PER_ADV_SYNC_RECV_DISABLED,
167172

168173
/** Constant Tone Extension for Periodic Advertising has been enabled
169-
* in the controller.
174+
* in the Controller.
170175
*/
171176
BT_PER_ADV_SYNC_CTE_ENABLED,
172177

subsys/bluetooth/host/scan.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,10 @@ void bt_hci_le_per_adv_sync_established(struct net_buf *buf)
694694
}
695695

696696
if (!pending_per_adv_sync ||
697-
pending_per_adv_sync->sid != evt->sid ||
698-
bt_addr_le_cmp(&pending_per_adv_sync->addr, &evt->adv_addr)) {
697+
(!atomic_test_bit(pending_per_adv_sync->flags,
698+
BT_PER_ADV_SYNC_SYNCING_USE_LIST) &&
699+
((pending_per_adv_sync->sid != evt->sid) ||
700+
bt_addr_le_cmp(&pending_per_adv_sync->addr, &evt->adv_addr)))) {
699701
struct bt_le_per_adv_sync_term_info term_info;
700702

701703
BT_ERR("Unexpected per adv sync established event");
@@ -1161,6 +1163,9 @@ int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param,
11611163
bt_addr_le_copy(&cp->addr, &param->addr);
11621164

11631165
if (param->options & BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST) {
1166+
atomic_set_bit(per_adv_sync->flags,
1167+
BT_PER_ADV_SYNC_SYNCING_USE_LIST);
1168+
11641169
cp->options |= BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST;
11651170
}
11661171

0 commit comments

Comments
 (0)