Skip to content

Commit

Permalink
Bluetooth: Host: Fix Periodic Advertising Sync using Advertiser List
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cvinayak authored and carlescufi committed Sep 16, 2021
1 parent b261d2b commit 9e2b9c7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions subsys/bluetooth/host/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,22 @@ enum {
/** Periodic Advertising Sync has been created in the host. */
BT_PER_ADV_SYNC_CREATED,

/** Periodic advertising is in sync and can be terminated */
/** Periodic Advertising Sync is established and can be terminated */
BT_PER_ADV_SYNC_SYNCED,

/** Periodic advertising is attempting sync sync */
/** Periodic Advertising Sync is attempting to create sync */
BT_PER_ADV_SYNC_SYNCING,

/** Periodic advertising is attempting sync sync */
/** Periodic Advertising Sync is attempting to create sync using
* Advertiser List
*/
BT_PER_ADV_SYNC_SYNCING_USE_LIST,

/** Periodic Advertising Sync established with reporting disabled */
BT_PER_ADV_SYNC_RECV_DISABLED,

/** Constant Tone Extension for Periodic Advertising has been enabled
* in the controller.
* in the Controller.
*/
BT_PER_ADV_SYNC_CTE_ENABLED,

Expand Down
9 changes: 7 additions & 2 deletions subsys/bluetooth/host/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,10 @@ void bt_hci_le_per_adv_sync_established(struct net_buf *buf)
}

if (!pending_per_adv_sync ||
pending_per_adv_sync->sid != evt->sid ||
bt_addr_le_cmp(&pending_per_adv_sync->addr, &evt->adv_addr)) {
(!atomic_test_bit(pending_per_adv_sync->flags,
BT_PER_ADV_SYNC_SYNCING_USE_LIST) &&
((pending_per_adv_sync->sid != evt->sid) ||
bt_addr_le_cmp(&pending_per_adv_sync->addr, &evt->adv_addr)))) {
struct bt_le_per_adv_sync_term_info term_info;

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

if (param->options & BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST) {
atomic_set_bit(per_adv_sync->flags,
BT_PER_ADV_SYNC_SYNCING_USE_LIST);

cp->options |= BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST;
}

Expand Down

0 comments on commit 9e2b9c7

Please sign in to comment.