Browse Source

bluetooth: bap: Fix shift of requested_bis_sync

The BIS_Sync bitfiled received over the air in Add Source and Modify
Source operations uses BIT(0) for BIS Index 1. Shift it when storing
it to match bis_sync bitfield where BIS Index 1 is at BIT(1).

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
pull/65607/head
Magdalena Kasenberg 2 years ago committed by Fabio Baltieri
parent
commit
c94cd30cec
  1. 6
      subsys/bluetooth/audio/bap_broadcast_assistant.c
  2. 9
      subsys/bluetooth/audio/bap_scan_delegator.c

6
subsys/bluetooth/audio/bap_broadcast_assistant.c

@ -768,7 +768,8 @@ int bt_bap_broadcast_assistant_add_src(struct bt_conn *conn, @@ -768,7 +768,8 @@ int bt_bap_broadcast_assistant_add_src(struct bt_conn *conn,
subgroup = net_buf_simple_add(&cp_buf, subgroup_size);
subgroup->bis_sync = param->subgroups[i].bis_sync;
/* The BIS Index bitfield to be sent must use BIT(0) for BIS Index 1 */
subgroup->bis_sync = param->subgroups[i].bis_sync >> 1;
CHECKIF(param->pa_sync == 0 && subgroup->bis_sync != 0) {
LOG_DBG("Only syncing to BIS is not allowed");
@ -860,7 +861,8 @@ int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn, @@ -860,7 +861,8 @@ int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn,
}
subgroup = net_buf_simple_add(&cp_buf, subgroup_size);
subgroup->bis_sync = param->subgroups[i].bis_sync;
/* The BIS Index bitfield to be sent must use BIT(0) for BIS Index 1 */
subgroup->bis_sync = param->subgroups[i].bis_sync >> 1;
CHECKIF(param->pa_sync == 0 && subgroup->bis_sync != 0) {
LOG_DBG("Only syncing to BIS is not allowed");

9
subsys/bluetooth/audio/bap_scan_delegator.c

@ -514,6 +514,10 @@ static int scan_delegator_add_source(struct bt_conn *conn, @@ -514,6 +514,10 @@ static int scan_delegator_add_source(struct bt_conn *conn,
}
internal_state->requested_bis_sync[i] = net_buf_simple_pull_le32(buf);
if (internal_state->requested_bis_sync[i] != BT_BAP_BIS_SYNC_NO_PREF) {
/* Received BIS Index bitfield uses BIT(0) for BIS Index 1 */
internal_state->requested_bis_sync[i] <<= 1;
}
if (internal_state->requested_bis_sync[i] &&
pa_sync == BT_BAP_BASS_PA_REQ_NO_SYNC) {
@ -670,6 +674,11 @@ static int scan_delegator_mod_src(struct bt_conn *conn, @@ -670,6 +674,11 @@ static int scan_delegator_mod_src(struct bt_conn *conn,
old_bis_sync_req = internal_state->requested_bis_sync[i];
internal_state->requested_bis_sync[i] = net_buf_simple_pull_le32(buf);
if (internal_state->requested_bis_sync[i] != BT_BAP_BIS_SYNC_NO_PREF) {
/* Received BIS Index bitfield uses BIT(0) for BIS Index 1 */
internal_state->requested_bis_sync[i] <<= 1;
}
if (internal_state->requested_bis_sync[i] &&
pa_sync == BT_BAP_BASS_PA_REQ_NO_SYNC) {
LOG_DBG("Cannot sync to BIS without PA");

Loading…
Cancel
Save