Skip to content

Commit b59d8d5

Browse files
nirav-agrawalcfriedt
authored andcommitted
bluetooth: bap_unicast_client: fix PTS BAP/UCL/SCC/BV-103-C failure
- In bap_unicast_client, it was assumed that ASE is binded with CIS handler during sending "received_stop_ready" to unicast_server. - In case where unicast_client has not started the stream with "receiver_start_ready" att command to server, but wants to disable ASE which was Enabled previously (but not stream!) causes failure since there is no cis_create has happened and linked to ASE. - In BAP_TS, "BAP/UCL/SCC/BV-103-C" has a same test conditions where client first enables the ASE, disable the ASE, and expecting "receiver_stop_ready" att command from client to server followed by server notification to enter its ASE in QoS_configured state. - Removed this condition checks to send expected att command to server from Enabling ASE state to Disable ASE. Signed-off-by: Nirav Agrawal <[email protected]>
1 parent 2784cac commit b59d8d5

File tree

3 files changed

+8
-31
lines changed

3 files changed

+8
-31
lines changed

subsys/bluetooth/audio/bap_stream.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,11 @@ bool bt_bap_stream_can_disconnect(const struct bt_bap_stream *stream)
483483

484484
pair_ep = bt_bap_iso_get_paired_ep(stream_ep);
485485

486-
/* If there are no paired endpoint, or the paired endpoint is
487-
* not in the streaming state, we can disconnect the CIS
486+
/* If there are no paired endpoint, or the paired endpoint is in the QoS Configured
487+
* or Codec Configured state, we can disconnect the CIS
488488
*/
489-
if (pair_ep == NULL || pair_ep->status.state != BT_BAP_EP_STATE_STREAMING) {
489+
if (pair_ep == NULL || pair_ep->status.state == BT_BAP_EP_STATE_QOS_CONFIGURED ||
490+
pair_ep->status.state == BT_BAP_EP_STATE_CODEC_CONFIGURED) {
490491
return true;
491492
}
492493
}

subsys/bluetooth/audio/bap_unicast_client.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/*
66
* Copyright (c) 2020 Intel Corporation
77
* Copyright (c) 2022-2025 Nordic Semiconductor ASA
8+
* Copyright 2025 NXP
89
*
910
* SPDX-License-Identifier: Apache-2.0
1011
*/
@@ -3517,7 +3518,6 @@ int bt_bap_unicast_client_disable(struct bt_bap_stream *stream)
35173518
int bt_bap_unicast_client_stop(struct bt_bap_stream *stream)
35183519
{
35193520
struct bt_bap_ep *ep = stream->ep;
3520-
enum bt_iso_state iso_state;
35213521
struct net_buf_simple *buf;
35223522
struct bt_ascs_start_op *req;
35233523
int err;
@@ -3530,27 +3530,6 @@ int bt_bap_unicast_client_stop(struct bt_bap_stream *stream)
35303530
return -ENOTCONN;
35313531
}
35323532

3533-
/* ASCS_v1.0 3.2 ASE state machine transitions
3534-
*
3535-
* If the server detects link loss of a CIS for an ASE in the Streaming state or the
3536-
* Disabling state, the server shall immediately transition that ASE to the QoS Configured
3537-
* state.
3538-
*
3539-
* This effectively means that if an ASE no longer has a connected CIS, the server shall
3540-
* bring it to the QoS Configured state. That means that we, as a unicast client, should not
3541-
* attempt to stop it
3542-
*/
3543-
if (ep->iso == NULL) {
3544-
LOG_DBG("Stream endpoint does not have a CIS, server will stop the ASE");
3545-
return -EALREADY;
3546-
}
3547-
3548-
iso_state = ep->iso->chan.state;
3549-
if (iso_state != BT_ISO_STATE_CONNECTED && iso_state != BT_ISO_STATE_CONNECTING) {
3550-
LOG_DBG("Stream endpoint CIS is not connected, server will stop the ASE");
3551-
return -EALREADY;
3552-
}
3553-
35543533
buf = bt_bap_unicast_client_ep_create_pdu(stream->conn, BT_ASCS_STOP_OP);
35553534
if (buf == NULL) {
35563535
LOG_DBG("Could not create PDU");

subsys/bluetooth/audio/cap_initiator.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2022-2025 Nordic Semiconductor ASA
3+
* Copyright 2025 NXP
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
@@ -2389,13 +2390,11 @@ void bt_cap_initiator_disabled(struct bt_cap_stream *cap_stream)
23892390
proc_param->in_progress = true;
23902391

23912392
err = bt_bap_stream_stop(next_bap_stream);
2392-
if (err != 0 && err != -EALREADY) {
2393+
if (err != 0) {
23932394
LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err);
23942395

23952396
bt_cap_common_abort_proc(next_bap_stream->conn, err);
23962397
cap_initiator_unicast_audio_proc_complete();
2397-
} else if (err == -EALREADY) {
2398-
proc_param->in_progress = false;
23992398
} /* else wait for server notification*/
24002399
}
24012400
}
@@ -2449,13 +2448,11 @@ void bt_cap_initiator_stopped(struct bt_cap_stream *cap_stream)
24492448
proc_param->in_progress = true;
24502449

24512450
err = bt_bap_stream_stop(next_bap_stream);
2452-
if (err != 0 && err != -EALREADY) {
2451+
if (err != 0) {
24532452
LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err);
24542453

24552454
bt_cap_common_abort_proc(next_bap_stream->conn, err);
24562455
cap_initiator_unicast_audio_proc_complete();
2457-
} else if (err == -EALREADY) {
2458-
proc_param->in_progress = false;
24592456
}
24602457
} /* else await notification from server */
24612458
} else {

0 commit comments

Comments
 (0)