All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] shared/bap: reset local ep state on stream detach
@ 2025-08-11 18:48 Pauli Virtanen
  2025-08-11 20:09 ` [BlueZ,v2] " bluez.test.bot
  2025-08-12  1:20 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Pauli Virtanen @ 2025-08-11 18:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

When removing streams in bt_bap_detach(), they are detached directly
without going through normal state transitions.  As BAP Unicast Server,
this leaves local endpoints to the state they were in, so they persist
if client connects again.  This is not wanted.

For server streams, clear the local ASE state on detach.  At that point,
the ASE is either already idle or the session is detached.

Don't modify state of remote endpoints (BAP Client streams), as only
remote server should do that.
---

Notes:
    v2:
    - clear endpoint in bap_ucast_detach(), for BAP Server only

 src/shared/bap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index c0f0c4f3c..9b7395223 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1357,6 +1357,12 @@ static void bap_ucast_detach(struct bt_bap_stream *stream)
 	bap_stream_clear_cfm(stream);
 
 	ep->stream = NULL;
+
+	if (!stream->client) {
+		ep->state = BT_ASCS_ASE_STATE_IDLE;
+		ep->old_state = BT_ASCS_ASE_STATE_IDLE;
+	}
+
 	bt_bap_stream_unref(stream);
 }
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-12  1:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 18:48 [PATCH BlueZ v2] shared/bap: reset local ep state on stream detach Pauli Virtanen
2025-08-11 20:09 ` [BlueZ,v2] " bluez.test.bot
2025-08-12  1:20 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.