Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1381273rwb; Tue, 29 Nov 2022 12:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+mfxd3/bVz6Xzdnt3sOIZrwIoCFik7CTJfzJ2BtPKyriWXdhiSEi0HAxKkRMrbD7JSj+1 X-Received: by 2002:a65:6c11:0:b0:477:2bc0:f1b with SMTP id y17-20020a656c11000000b004772bc00f1bmr32959884pgu.566.1669754875774; Tue, 29 Nov 2022 12:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669754875; cv=none; d=google.com; s=arc-20160816; b=Nk0lxIxRa2xRx7QqIQkVxBHJiCcnZOblWpcTWWr7Y/58UfS2VIy5Z0EoKPGYRgBMWg euKTorpEucco9NO2R9eAgEqnyTq6D8j0PQFP/KVo+iLqWJZ8stnugagW+YKMUxOCHF+X /cLbkyoTQWLBDsf8U3TqjPjzO1RHpDSmZYU6SzGLfs9WOGdLO54YuqQBP5f1V3RK7HAa b6hjRB6HII7Ap0GHig0+wBhqQMErVII89rLf1IDGuqbKgmhxTtVVvNmmQCLBhz60WqU4 wMo2za7LyygbFGtL6RxYtSVbyzYUVlD3oBTrY9b1tv4yTjZ1LRtPB1Wi8IRif46FCh/9 qy6g== 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:to:from:dkim-signature; bh=rIuN04fzi/QvqGgsYhrpXfuUt7W+BqBRJCjrS+p5YYk=; b=YGN2wsZOY8+40gC8+ba6Fi727Td3TxOMbNGnkQrOn6h7Z0/XCm2YJxK8SiiTlQCAFZ 5Qve56kclWVvVf5JQ2bA5fzBKNIoGTq87wSfEfbiUQDEoWNpmGoVJ8nXB7XqW1vTapNX OdnuiAYHLatFPxJ4bUWTQ648WWjobnDQpdQAjdvDX3hThQEAa61pKygmKnpBOV5PTUew WTQbi8zAaUfboJvkNollnaXLHsrzx0kLC0hXc9VqY2kQYOC8gBrrnpWx6+7V07TVxxAv wsGby6yJCBq+t6R+O4O5h4razqarazl2ZEvdpSqNVB1yobD/pLFgBvkR+k4BTRP0O+1O ekZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iIS4kkzv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a631b56000000b0043cb43f584fsi15130833pgm.482.2022.11.29.12.47.04; Tue, 29 Nov 2022 12:47:55 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iIS4kkzv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233673AbiK2UqB (ORCPT + 99 others); Tue, 29 Nov 2022 15:46:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbiK2UqA (ORCPT ); Tue, 29 Nov 2022 15:46:00 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5072657A for ; Tue, 29 Nov 2022 12:45:59 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id d18so3817486pls.4 for ; Tue, 29 Nov 2022 12:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=rIuN04fzi/QvqGgsYhrpXfuUt7W+BqBRJCjrS+p5YYk=; b=iIS4kkzvcBoxVff78BFcY/TwsdgCr+SA1YI2noHW5DTgxfF7vLB6gasNTfU6E9OtZ8 bSjV2AKmL7DPqDqce9lOZgiG9kP9PseLTjkoMV7zi2DIbf6gqNmAOQ2tcDhkcNlwHBQM Fye82Edb3s74nqDHL4LcEgWzVRw8nYNg4WSJD5897GpFfv2I8AKYA1I9YYwtW7yT8VCs yUjVu0714Zwm/luY3zrt39nX79ubmpvSkNZ5hykih/cXLpE5vcYIQNktW7UwH65aBcb4 r6q3Cxtd0dF8I8RpHO/YpN9NY1HgbcJa8cdxFogiw4gMANmKNwNtcABfPvyAw/pFfBDq PJKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rIuN04fzi/QvqGgsYhrpXfuUt7W+BqBRJCjrS+p5YYk=; b=qeH19kTUS+eQHQIfc224gci6lo6El4ssP05O8Nw37sRaoPmfP65NAg0Nb21Cxy3K2q uWHQ/XUY0k+ERzNy376n+AOAAmwjgPdfY66MDmDyIG4lDG1d7EwYNv5uOCIK/0LSFZBe 9cksbk0RiM3QU9FEzj7yLsxe8t3trsCAO+FGfDbVJntaRvozJiqH/O5SlmWsGNNuPpHz sONd1m0hZJV5Q+4BR1tAOSMyvNoqm6+v1IuqGngthK0zBiR4n0Sk22YszS+g4kIT7zcq 9IAronPWekKCZSibGDKLtiKqWBlCiSJFMLUjnRt0kIpQoyKpk2Q7wH7dfp6BoKnzo5VD 14ng== X-Gm-Message-State: ANoB5pkmKOfevY30w8PYSS1pw7j33DLgYYLGRxRqkBkkj/bT5toZHqhs 2J6cCxR14nB+dn/ESywNfSifxEsOsA77BA== X-Received: by 2002:a17:902:ce90:b0:186:ab02:664c with SMTP id f16-20020a170902ce9000b00186ab02664cmr40647183plg.49.1669754758447; Tue, 29 Nov 2022 12:45:58 -0800 (PST) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id i7-20020a17090332c700b001887e30b9ddsm11216214plr.257.2022.11.29.12.45.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 12:45:57 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/5] shared/bap: Fix not reading all instances of PAC Sinks/Sources Date: Tue, 29 Nov 2022 12:45:52 -0800 Message-Id: <20221129204556.1535821-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 From: Luiz Augusto von Dentz Both PAC Sink and Source are allowed to have multiple instances: - The server wanted to support a smaller maximum transmission unit (ATT_MTU, as defined in Volume 3, Part F, Section 3.2.8 in [2]) size. Exposing all supported PAC records in a single Sink PAC characteristic would require the server to increase its supported Maximum Transmission Unit (MTU) size to a value the server considered excessive. - The server wanted to expose support for proprietary audio capabilities (such as vendor-specific audio codecs, as denoted by the Codec_ID parameter value) separately from support for non-vendor-specific audio capabilities and used separate Sink PAC characteristics to expose such support. - The server wanted to minimize the amount of data to be transferred, when sending notifications to a client that the Sink PAC characteristic value changed, by exposing the audio capabilities likely to change quicker than others in separate Sink PAC characteristics. --- src/shared/bap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 21aa8aa6c5ca..7a24824a71fc 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2908,10 +2908,12 @@ static void foreach_pacs_char(struct gatt_db_attribute *attr, void *user_data) DBG(bap, "Sink PAC found: handle 0x%04x", value_handle); pacs = bap_get_pacs(bap); - if (!pacs || pacs->sink) + if (!pacs) return; - pacs->sink = attr; + if (!pacs->sink) + pacs->sink = attr; + bap_read_value(bap, value_handle, read_sink_pac, bap); } @@ -2919,10 +2921,12 @@ static void foreach_pacs_char(struct gatt_db_attribute *attr, void *user_data) DBG(bap, "Source PAC found: handle 0x%04x", value_handle); pacs = bap_get_pacs(bap); - if (!pacs || pacs->source) + if (!pacs) return; - pacs->source = attr; + if (!pacs->source) + pacs->source = attr; + bap_read_value(bap, value_handle, read_source_pac, NULL); } -- 2.37.3