Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2230218rwd; Sun, 28 May 2023 10:47:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7IfwlAUAqKbf8j+CIe3Vkbe8+fq3w1bUCvdxTbIPv/FRPFfIdREnIEKhoY8ts4pxv3xLWQ X-Received: by 2002:a05:6a20:1612:b0:10f:652a:27ea with SMTP id l18-20020a056a20161200b0010f652a27eamr5657038pzj.6.1685296040094; Sun, 28 May 2023 10:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685296040; cv=none; d=google.com; s=arc-20160816; b=b59CDpFwV6XGT90D2tMlorL4LOPvjHRPbWky3Nfl1JyaXS6xZHChghA3obIbJAIbdi Mh6vLtOQXBkHSPML3reI/QtZdpA5EpYs2rR1i0zCFdR2FJwzB6r2xVq/M9QZcXnTAfPn iGHTfw5+zry+TuDWQlRrVsWCHbTLa2LqRCddJ5QeDvSov0iOqdelu300Lc0VhWWMy1tk ZVa3WlWxuYKR+s8tck8fODeW57IHjBDCxLL/yOjFF6GQyNAqxNSVTTUja4XBzMPkjNen gCg7KgUhVku4yQcaL8/StFvUbS5xxjn7UwH/wMfRECfb9T1NJncNEQeMRqphHFy/lMXV 42HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SvShymHnA6yCHDFQ/NUEQMFa31JELIkmxslAJimawFs=; b=KMpQWygXo/cnSRi4VxB0kBF7Jw0H0eyx1koIrYA+SKbCqgOMdooBkRXwCHK5gkEfQd KexIgh1dRnJPjWoizd3CiT8G8W7dsiJcXWiXPwiy7yATm/Z8jVknQ/WNkaWjVYckXtx7 FJcAUFS+HBEZHuR9oZxMA8lZxAh5NdUMXb7qR6V8z9SoPtt+IoLGGV9OIWZsANtM3ZPX zMOEaIOIkv6ezW5kIsVmPDtKs+V5HBuGi2XbP33SsVihdp1YwIWft9ozTyaVRW6M9OWu H94PCEphHMoRQwD3Zep0ztLuV+3cYfhSm+lWwSaKyDtLrk9TsLBXwraPr3cm7Rrr/zY+ 9/9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a63b952000000b00535540cc8ccsi7939343pgo.375.2023.05.28.10.47.05; Sun, 28 May 2023 10:47:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229496AbjE1Rkf (ORCPT + 99 others); Sun, 28 May 2023 13:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjE1Rke (ORCPT ); Sun, 28 May 2023 13:40:34 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57449A0 for ; Sun, 28 May 2023 10:40:33 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0A7D8240101 for ; Sun, 28 May 2023 19:40:32 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QTmCM3sNTz9rxF; Sun, 28 May 2023 19:40:31 +0200 (CEST) From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH BlueZ 1/2] shared/bap: detach io for source ASEs at QoS when disabling Date: Sun, 28 May 2023 17:40:29 +0000 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The Client may terminate a CIS when sink is in QOS and source in Disabling states (BAP v1.0.1 Sec 5.6.5). It may also terminate it when Receiver Stop Ready has completed successfully (BAP v1.0.1 Sec 5.6.5.1). On successful Receiver Stop Ready the Server shall transition the ASE back to QoS state (ASCS v1.0 Sec 5.6). It appears Samsung Galaxy Buds2 Pro (R510XXUOAWA5) ignores the Receiver Stop Ready command if CIS is already disconnected, and then gets stuck in disabling state. It works if CIS is disconnected after Receiver Stop Ready. For better compatibility, disconnect CIS only after the source ASE is back in the QoS state. This is what we also do with sinks. Link: https://github.com/bluez/bluez/issues/516 --- src/shared/bap.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index f194f466f..16a9cec5b 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1115,18 +1115,6 @@ static bool match_stream_io(const void *data, const void *user_data) return stream->io == io; } -static void stream_stop_disabling(void *data, void *user_data) -{ - struct bt_bap_stream *stream = data; - - if (stream->io || stream->ep->state != BT_ASCS_ASE_STATE_DISABLING) - return; - - DBG(stream->bap, "stream %p", stream); - - bt_bap_stream_stop(stream, NULL, NULL); -} - static bool bap_stream_io_detach(struct bt_bap_stream *stream) { struct bt_bap_stream *link; @@ -1145,9 +1133,6 @@ static bool bap_stream_io_detach(struct bt_bap_stream *stream) /* Detach link if in QoS state */ if (link->ep->state == BT_ASCS_ASE_STATE_QOS) bap_stream_io_detach(link); - } else { - /* Links without IO on disabling state shall be stopped. */ - queue_foreach(stream->links, stream_stop_disabling, NULL); } stream_io_unref(io); @@ -1218,7 +1203,6 @@ static void bap_stream_state_changed(struct bt_bap_stream *stream) bap_stream_update_io_links(stream); break; case BT_ASCS_ASE_STATE_DISABLING: - bap_stream_io_detach(stream); break; case BT_ASCS_ASE_STATE_QOS: if (stream->io && !stream->io->connecting) @@ -1252,8 +1236,8 @@ static void bap_stream_state_changed(struct bt_bap_stream *stream) bt_bap_stream_start(stream, NULL, NULL); break; case BT_ASCS_ASE_STATE_DISABLING: - if (!bt_bap_stream_get_io(stream)) - bt_bap_stream_stop(stream, NULL, NULL); + /* IO is detached when back in QOS */ + bt_bap_stream_stop(stream, NULL, NULL); break; } -- 2.40.1