All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] transport: Complete Acquire for Sink ASE entering Enabling
@ 2026-06-09 21:11 Simon Mikuda
  2026-06-09 23:04 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-06-09 21:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

On the QoS to Enabling transition the IO is not yet available because
the CIS is not established, so the handler returns early and a pending
Acquire is left unanswered once the IO later arrives.

Notify the connecting callbacks once the fd is attached so the
transport can re-run the Enabling handling and complete the Acquire.
---
 profiles/audio/transport.c |  7 +++++++
 src/shared/bap.c           | 28 +++++++++++++++++++---------
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 4b9d26c5e..22a755064 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -2397,6 +2397,13 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd,
 		return;
 
 	bap_update_links(transport);
+
+	/* IO connected; re-run Enabling to complete a deferred Acquire. */
+	if (!state && fd >= 0 && bt_bap_stream_get_state(stream) ==
+					BT_BAP_STREAM_STATE_ENABLING)
+		bap_state_changed(stream, BT_BAP_STREAM_STATE_ENABLING,
+					BT_BAP_STREAM_STATE_ENABLING,
+					user_data);
 }
 
 static bool transport_bap_is_playback(struct media_transport *transport)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index deb85b264..09f671a15 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -3006,6 +3006,20 @@ static bool bap_stream_io_attach(struct bt_bap_stream *stream, int fd,
 	return true;
 }
 
+static void bap_stream_notify_connecting(struct bt_bap_stream *stream,
+						bool connecting, int fd)
+{
+	const struct queue_entry *entry;
+
+	for (entry = queue_get_entries(stream->bap->state_cbs); entry;
+						entry = entry->next) {
+		struct bt_bap_state *state = entry->data;
+
+		if (state->connecting)
+			state->connecting(stream, connecting, fd, state->data);
+	}
+}
+
 static void bap_stream_set_io(void *data, void *user_data)
 {
 	struct bt_bap_stream *stream = data;
@@ -3042,6 +3056,10 @@ static void bap_stream_set_io(void *data, void *user_data)
 			bt_bap_stream_stop(stream, NULL, NULL);
 		break;
 	}
+
+	/* Notify IO connected so transports can complete pending requests. */
+	if (fd >= 0)
+		bap_stream_notify_connecting(stream, false, fd);
 }
 
 static void ascs_ase_rsp_add_errno(struct iovec *iov, uint8_t id, int err)
@@ -7028,7 +7046,6 @@ static void bap_stream_io_connecting(void *data, void *user_data)
 {
 	struct bt_bap_stream *stream = data;
 	int fd = PTR_TO_INT(user_data);
-	const struct queue_entry *entry;
 
 	if (!stream)
 		return;
@@ -7038,14 +7055,7 @@ static void bap_stream_io_connecting(void *data, void *user_data)
 	else
 		bap_stream_io_detach(stream);
 
-	for (entry = queue_get_entries(stream->bap->state_cbs); entry;
-							entry = entry->next) {
-		struct bt_bap_state *state = entry->data;
-
-		if (state->connecting)
-			state->connecting(stream, stream->io ? true : false,
-							fd, state->data);
-	}
+	bap_stream_notify_connecting(stream, stream->io ? true : false, fd);
 }
 
 int bt_bap_stream_io_connecting(struct bt_bap_stream *stream, int fd)
-- 
2.43.0


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

end of thread, other threads:[~2026-06-09 23:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 21:11 [PATCH BlueZ] transport: Complete Acquire for Sink ASE entering Enabling Simon Mikuda
2026-06-09 23:04 ` [BlueZ] " bluez.test.bot

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.