From 5ccbff0898fa4b006cb4b26c9b82cae129aa368f Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Fri, 8 Aug 2025 21:50:39 +0300 Subject: [PATCH] shared/bap: check ASE state in find_ep_ucast ASE may be in non-configurable state also if it has no associated stream, eg. as a result of failed stream teardown or other misbehavior. Check also ASE state when selecting a "free" one. Fixes wrongly picking ASE that is not IDLE/CONFIG/QOS and cannot be configured. --- src/shared/bap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index a6de51fb9..c0f0c4f3c 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6224,6 +6224,15 @@ static bool find_ep_ucast(const void *data, const void *user_data) } } + switch (ep->state) { + case BT_ASCS_ASE_STATE_IDLE: + case BT_ASCS_ASE_STATE_CONFIG: + case BT_ASCS_ASE_STATE_QOS: + break; + default: + return false; + } + if (ep->dir != match->rpac->type) return false; -- 2.47.3