diff mbox series

[BlueZ,v2,09/15] shared/bap: Fix not notifying idle state

Message ID 20250407200124.881534-10-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v2,01/15] test-bap: Introduce DISC tests for LC3 | expand

Commit Message

Luiz Augusto von Dentz April 7, 2025, 8:01 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The idle state must be notified like any other state.
---
 src/shared/bap.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index dbeb43fe509d..ec23e882f389 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -1138,6 +1138,21 @@  static void stream_notify_release(struct bt_bap_stream *stream)
 					bt_bap_get_att(stream->bap));
 }
 
+static void stream_notify_idle(struct bt_bap_stream *stream)
+{
+	struct bt_bap_endpoint *ep = stream->ep;
+	struct bt_ascs_ase_status status;
+
+	DBG(stream->bap, "stream %p", stream);
+
+	memset(&status, 0, sizeof(status));
+	status.id = ep->id;
+	status.state = BT_ASCS_ASE_STATE_IDLE;
+
+	gatt_db_attribute_notify(ep->attr, (void *)&status, sizeof(status),
+					bt_bap_get_att(stream->bap));
+}
+
 static struct bt_bap *bt_bap_ref_safe(struct bt_bap *bap)
 {
 	if (!bap || !bap->ref_count || !queue_find(sessions, NULL, bap))
@@ -1712,6 +1727,7 @@  static void stream_notify(struct bt_bap_stream *stream, uint8_t state)
 
 	switch (state) {
 	case BT_ASCS_ASE_STATE_IDLE:
+		stream_notify_idle(stream);
 		break;
 	case BT_ASCS_ASE_STATE_CONFIG:
 		stream_notify_config(stream);