Skip to content

Commit 478a971

Browse files
alexsvenkoffes
authored andcommitted
[nrf fromtree] tests: bluetooth: tester: Fix bis_sink_sync
- Allows the tester to match on either ID or addr - Previously required that both needed to match, but Auto-PTS is sending the wrong address Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no> (cherry picked from commit fa7d9bf)
1 parent ec54803 commit 478a971

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

tests/bluetooth/tester/src/audio/btp_bap_broadcast.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,8 @@ static int pa_sync_req_cb(struct bt_conn *conn,
11621162
bt_addr_le_copy(&broadcaster->address, &recv_state->addr);
11631163
}
11641164

1165+
broadcast_source_to_sync = broadcaster;
1166+
11651167
broadcaster->sink_recv_state = recv_state;
11661168

11671169
btp_send_pas_sync_req_ev(conn, recv_state->src_id, recv_state->adv_sid,
@@ -1380,20 +1382,6 @@ uint8_t btp_bap_broadcast_sink_sync(const void *cmd, uint16_t cmd_len, void *rsp
13801382

13811383
LOG_DBG("");
13821384

1383-
broadcaster = remote_broadcaster_find(&cp->address, broadcast_id);
1384-
if (broadcaster == NULL) {
1385-
broadcaster = remote_broadcaster_alloc();
1386-
if (broadcaster == NULL) {
1387-
LOG_ERR("Failed to allocate broadcast source");
1388-
return BTP_STATUS_FAILED;
1389-
}
1390-
1391-
broadcaster->broadcast_id = broadcast_id;
1392-
bt_addr_le_copy(&broadcaster->address, &cp->address);
1393-
}
1394-
1395-
broadcast_source_to_sync = broadcaster;
1396-
13971385
if (IS_ENABLED(CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER) && cp->past_avail) {
13981386
/* The Broadcast Assistant supports PAST transfer, and it has found
13991387
* a Broadcaster for us. Let's sync to the Broadcaster PA with the PAST.
@@ -1421,7 +1409,22 @@ uint8_t btp_bap_broadcast_sink_sync(const void *cmd, uint16_t cmd_len, void *rsp
14211409
create_params.sid = cp->advertiser_sid;
14221410
create_params.skip = cp->skip;
14231411
create_params.timeout = cp->sync_timeout;
1412+
14241413
err = tester_gap_padv_create_sync(&create_params);
1414+
1415+
broadcaster = remote_broadcaster_find(&cp->address, broadcast_id);
1416+
if (broadcaster == NULL) {
1417+
broadcaster = remote_broadcaster_alloc();
1418+
if (broadcaster == NULL) {
1419+
LOG_ERR("Failed to allocate broadcast source");
1420+
return BTP_STATUS_FAILED;
1421+
}
1422+
1423+
broadcaster->broadcast_id = broadcast_id;
1424+
bt_addr_le_copy(&broadcaster->address, &cp->address);
1425+
}
1426+
1427+
broadcast_source_to_sync = broadcaster;
14251428
}
14261429

14271430
if (err != 0) {

0 commit comments

Comments
 (0)