From patchwork Thu Apr 27 19:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3100C7EE21 for ; Thu, 27 Apr 2023 19:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245465AbjD0TdK (ORCPT ); Thu, 27 Apr 2023 15:33:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245502AbjD0Tcw (ORCPT ); Thu, 27 Apr 2023 15:32:52 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADBA410D9 for ; Thu, 27 Apr 2023 12:32:49 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-32ac0743030so67431255ab.0 for ; Thu, 27 Apr 2023 12:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623968; x=1685215968; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=R5PZrWIw9wJtuIkYP9O2VU+XSk2bbMScan7h1oDUe4c=; b=RDNI+J+ulYs7YK+0tLOq6QEIhaX9cIXYyqD40UTRyVZMnukLlJ2hNwA3BFng8BXlVc cIdiYGZnPuCVeInd1+gStc6drbmgY7dzJ3oT5XP5PgpDdHIVL529t16+qa8SfQSHeKkH 0XuTlucRhBJmfepdFUcY5ag0zz6ETQ3OKfnxGKd0pwhF7hc7jPpCKak9kzetU8e98Ym/ 7RmAEHAJbyPZYYbkqrPqq7Uh3zsxILPrvh8zeUe5sXqlpQn1mOuF/O7Vn1PWngKOwPU8 7cIeQp7zoQe2PF/jXXUifZfHoIdp2uQnCPD2ZvF/8VLy/0hTVjNXPtOHT3Ij2bDvJ7Mi Ofbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623968; x=1685215968; 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=R5PZrWIw9wJtuIkYP9O2VU+XSk2bbMScan7h1oDUe4c=; b=lOR7VT7YETxuWln5A1vsHDiaJqoOOYG1S8/nWH+L2xLROCjLZunHHrrxKUtnup+uzC eU97rKzaWk1QA26i8tdZu7XZGLROn22MlDcyKKeIFMep+y5mF7ZIHFvA5FZdW+9Kjj1j jcUkRcGKXa0eB1zPlx4P7MOcajomXt+0rvtJ/AWJTiEfwF2J/eE0GgNzQJHijUKXgDKx opGlX3TAU5CykRltTFhD2lhzxJ0Xr+yObV/GETip8ZMyDJo0nLEBTx+GxHOM7DMcz50D NpCQDsI60R73pPnjdMH171ElkiyZlobivHuOoMF9JPxANYtMO8lxn1+sWbFQZabBDAvJ MO+g== X-Gm-Message-State: AC+VfDxWZyIy0E9fZVuETchyIi48fHy95Hyzus+PtIVlsxqgNm6IUxLB 02JmxW0XCmcLG+CO1Qf1269SDHM3vdo= X-Google-Smtp-Source: ACHHUZ76O2gb88AKRlptZfNZPc4nLHDySbkrZ6ItZiwDkv5z/RKY/SztyAeAGx4Z/zoz5Wb5lE+oZg== X-Received: by 2002:a92:d344:0:b0:32b:681d:b1e7 with SMTP id a4-20020a92d344000000b0032b681db1e7mr2055462ilh.8.1682623967890; Thu, 27 Apr 2023 12:32:47 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:47 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 1/9] media: Fix not storing Preferred Delay properly Date: Thu, 27 Apr 2023 12:32:37 -0700 Message-Id: <20230427193245.323502-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Preferred Delay properties were being stored as qos->pd_* instead of qos->ppd_*. --- profiles/audio/media.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 52c4bd80a94c..6ce668e31303 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1483,11 +1483,11 @@ static int parse_properties(DBusMessageIter *props, const char **uuid, } else if (strcasecmp(key, "PreferredMinimumDelay") == 0) { if (var != DBUS_TYPE_UINT16) return -EINVAL; - dbus_message_iter_get_basic(&value, &qos->pd_min); + dbus_message_iter_get_basic(&value, &qos->ppd_min); } else if (strcasecmp(key, "PreferredMaximumDelay") == 0) { if (var != DBUS_TYPE_UINT16) return -EINVAL; - dbus_message_iter_get_basic(&value, &qos->pd_max); + dbus_message_iter_get_basic(&value, &qos->ppd_max); } dbus_message_iter_next(props); From patchwork Thu Apr 27 19:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB60C77B61 for ; Thu, 27 Apr 2023 19:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244730AbjD0TdI (ORCPT ); Thu, 27 Apr 2023 15:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245511AbjD0Tcx (ORCPT ); Thu, 27 Apr 2023 15:32:53 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC2110CB for ; Thu, 27 Apr 2023 12:32:51 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-32b102ca487so67290315ab.2 for ; Thu, 27 Apr 2023 12:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623970; x=1685215970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2TxEgwLhiQ41y0of/BgNY+ugH8sfqwBu6KV8WR5vgIE=; b=NkxzYd7q1kYdZyHJn5dtFmiY3ClCS0/3bzD66krT9uVoqBPK09O1W3sei3gE7Vdock DPy6y5y7xq570Vbw6tmDvy3J4kLvueCqDOC9e6ar0ASvsJLLb8oqbqfMTPSt4IogE9rA 1AO/OmdWVQXvVmIIoEU2ywAs0/cAnHWa9O4ADIDSGgnUhPlnWV0tHDMTaDGBQsNmSQpz GTJeRvu4/FAdA2Q+yplfcGvHzVY7rCYQPqqz+YATRzlf/hWuF0/i7rOniFAMJxhetlVs hwGaZ0+u603I8oTwkyiTSsgPj4GdP6IhulaBOf2zTeLv8NfGRQ/+BrJw++MRUURK0u1o 4zEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623970; x=1685215970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2TxEgwLhiQ41y0of/BgNY+ugH8sfqwBu6KV8WR5vgIE=; b=Bdl0/xobQ5ggGu6iNGijU64ovFkipW1UBN0rDpdQhyYmgZmCeJYgwM+3XqaFpyesGe iajdrUmJF/jFuBUft1RxZ579pa2drOce77eIo5UB1bSgIKrKAF9YgUvMzpbqacwfbfSW bII8s3YZ0WIlfyhjHcGV7vNpTqDMEnfsY7QX5D5aH3DKl1m4aDjmYTk2eLIh4pra9zGb iUGj8ev14RbuMqskjMS3BhBe36j6u2+ktGl61yrTD6fGRvyL4HkT2xeGlCiIhN8/XbSr oTRIGAt1gNWAZW9mo19KlPuDLKkmk6l6P/N4cX6QX8nCecEHkDSkU8cS9OgqyWEVUUji 1Fyg== X-Gm-Message-State: AC+VfDwGRA10qrkPJyhQSujOHb9Wl1X5pyE7PbCeAAtoudVfEBDhe684 O7YMZ4yqIuH4m5LUqxkLVVcIFl6D9Tw= X-Google-Smtp-Source: ACHHUZ5jmZLQQM4/2PCgoQED1NI7v7UaBaBtB1MFyD/kuE91ftB2UOaJsSbiUwxiX98uuETlS7hjUg== X-Received: by 2002:a05:6e02:78f:b0:32b:1eb1:c463 with SMTP id q15-20020a056e02078f00b0032b1eb1c463mr2051023ils.26.1682623969975; Thu, 27 Apr 2023 12:32:49 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:48 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 2/9] shared/bap: Fix crash detaching streams Date: Thu, 27 Apr 2023 12:32:38 -0700 Message-Id: <20230427193245.323502-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz If a stream is being detached but bt_bap reference is already 0 don't attempt to detach the stream as they would be freed anyway: Invalid read of size 8 at 0x19A360: bap_free (bap.c:2576) by 0x19A360: bt_bap_unref (bap.c:2735) by 0x19A360: bt_bap_unref (bap.c:2727) by 0x160E9A: test_teardown (test-bap.c:412) by 0x1A8BCA: teardown_callback (tester.c:434) Address 0x55e05e0 is 16 bytes inside a block of size 160 free'd at 0x48480E4: free (vg_replace_malloc.c:872) by 0x1AD5F6: queue_foreach (queue.c:207) by 0x19A1C5: bt_bap_detach (bap.c:3879) by 0x19A1C5: bt_bap_detach (bap.c:3855) by 0x19A33F: bap_free (bap.c:2574) --- src/shared/bap.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 5a12a64d292b..bc6177a5ba90 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1168,6 +1168,14 @@ static void bap_stream_set_io(void *data, void *user_data) } } +static struct bt_bap *bt_bap_ref_safe(struct bt_bap *bap) +{ + if (!bap || !bap->ref_count) + return NULL; + + return bt_bap_ref(bap); +} + static void bap_stream_state_changed(struct bt_bap_stream *stream) { struct bt_bap *bap = stream->bap; @@ -1178,7 +1186,14 @@ static void bap_stream_state_changed(struct bt_bap_stream *stream) bt_bap_stream_statestr(stream->ep->old_state), bt_bap_stream_statestr(stream->ep->state)); - bt_bap_ref(bap); + /* Check if ref_count is already 0 which means detaching is in + * progress. + */ + bap = bt_bap_ref_safe(bap); + if (!bap) { + bap_stream_detach(stream); + return; + } /* Pre notification updates */ switch (stream->ep->state) { @@ -2730,14 +2745,6 @@ struct bt_bap *bt_bap_ref(struct bt_bap *bap) return bap; } -static struct bt_bap *bt_bap_ref_safe(struct bt_bap *bap) -{ - if (!bap || !bap->ref_count) - return NULL; - - return bt_bap_ref(bap); -} - void bt_bap_unref(struct bt_bap *bap) { if (!bap) From patchwork Thu Apr 27 19:32:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70933C77B7E for ; Thu, 27 Apr 2023 19:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244281AbjD0TdG (ORCPT ); Thu, 27 Apr 2023 15:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245514AbjD0Tcy (ORCPT ); Thu, 27 Apr 2023 15:32:54 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98E3E10CF for ; Thu, 27 Apr 2023 12:32:53 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-329518648ebso68973435ab.0 for ; Thu, 27 Apr 2023 12:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623972; x=1685215972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=E/6BjiB3CztTfLUdP27sBZNVOKuIvJqXf2EZ0PwMXGE=; b=XaKz/mw9Y2g0L8T4QZtLPLHZv+bk7NMwidoFU/ZmMh1K+AhwAEMBuy1xnJimPikhcG Wg50N2SMQlR9ipJ/Oj2V3syIsCPxE/kyylyVZbyO5V217M5odXacrBxy9eHViV9UFcTA oyAR19TPxJ8HlLjMut9u/tQjxrmiuRgn0D1kA078GYt8lqpHDgkdYUdrKEpprBDdIdvP xMFbj+X0bWAA+MZWY2cPVp3WUYNejbMPSfbiNNFfBrwpm3DM+QErjm9kanMLqk64RxrN tAQdbVrgtLdw7Lds5RQ3cueqDnSpQVVJZog5CTEE7YKZS9MhScEem1FFEUZaiHRq+nea v0RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623972; x=1685215972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E/6BjiB3CztTfLUdP27sBZNVOKuIvJqXf2EZ0PwMXGE=; b=LCe9ngwnyFZx/Du3726HlOcJxIHP3ySQ/eOrdO0hmBfj7al9M5HlpcP3Q0jSE6I1IQ QnZwVqV3eoZGE+ymjQCbKwi3ynjJ39QlydTdn/j+zzi0I3BKrdzoiviUl1giNJMGssq9 nhV4Zp1LjtMmi8m6yzW5mP9agwu9cnb0N3/vhrmt8jm9WniJQV7QMG0l8ix3NneAhhCk DfVkLZ+ocV+FEPQj0MO9/N8TDvDjhDZ7Dw9NhJswXjmuL5OO3svvtp8Yr3tRRXG3xAvC B4Cts2MOhzlvKPHJmCwZPNQ9nwICxIOzVLtjjHbWcyjLSkdjorwDxA+K8hoxnoW45egK +q4Q== X-Gm-Message-State: AC+VfDykRTq6XLtSdxHD6bOvy3/XfJ3DIUB7okdmFYVqRzLIZkMUg6q2 DFF0edFM9EDgg0CRzApZADE7/DvLjNI= X-Google-Smtp-Source: ACHHUZ5uef4hOkJhXRN/QlW1zX+SUE8pc4DiZwVY2eU2MZt0VnEFVPkMcaK33BqK0PeRLNDbNtGgAg== X-Received: by 2002:a92:2a0c:0:b0:323:1869:15a1 with SMTP id r12-20020a922a0c000000b00323186915a1mr1874873ile.25.1682623972162; Thu, 27 Apr 2023 12:32:52 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:51 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 3/9] share/bap: Fix not removing timeout on bap_free Date: Thu, 27 Apr 2023 12:32:39 -0700 Message-Id: <20230427193245.323502-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This fixes not removing the process_id timeout when freeing the session which can cause the following crash: Invalid read of size 8 at 0x18EB39: bap_debug (bap.c:553) by 0x1913A8: bap_process_queue (bap.c:3542) by 0x1A8630: timeout_callback (timeout-glib.c:25) Address 0x55e0650 is 128 bytes inside a block of size 160 free'd at 0x48480E4: free (vg_replace_malloc.c:872) --- src/shared/bap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index bc6177a5ba90..6131c312865a 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2600,6 +2600,8 @@ static void bap_free(void *data) { struct bt_bap *bap = data; + timeout_remove(bap->process_id); + bt_bap_detach(bap); bap_db_free(bap->rdb); From patchwork Thu Apr 27 19:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59D58C77B73 for ; Thu, 27 Apr 2023 19:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244959AbjD0TdE (ORCPT ); Thu, 27 Apr 2023 15:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245525AbjD0Tc5 (ORCPT ); Thu, 27 Apr 2023 15:32:57 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED2110CB for ; Thu, 27 Apr 2023 12:32:55 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-7606d6b3294so736653339f.2 for ; Thu, 27 Apr 2023 12:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623974; x=1685215974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wOpfTKwf5WNulDcph/6pfu797qStjEdA6vB7rZiGCHw=; b=cXK7ijYY3mLDfOuMozK3vBa7x5j5RHSTQB7wULcDkroR4yY+J20cUkMbzXnj7e7Kx3 Gi0Ob3IWcNjB2vee5T7S7/lc8vq3s/Q0mcj1lxYXmzN1Pmgy1678/OlZhxJD18eDoWTL A1bjOmk6bzuqaEPOsjjwDNYbKlokvhJeFKYXrUsZ5gj+TwoPuTZearDOLUS/dakJmg8Y xKWLS4W1DSRd8+eQP+sQI+tIvr3NdhUER8M1Q6CQU2UKcRhuRunccF5hsUM7TNoh/dpT PF0Xv1dOTuz4TjBDBuPuFG3i5pWE9iPmR73S8xBHHiFqrbyFEWKJXh60moufnm0BGFKF P0Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623974; x=1685215974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wOpfTKwf5WNulDcph/6pfu797qStjEdA6vB7rZiGCHw=; b=bloh//aZ9/JfP0pxYmoRVm4lewAFndjQSD5FvtZAVxgc0BtWPQUzX5TL/J5eKQ82SK HdutyaSQQgb0CcftCPKpVgkNNWjvuyPGxU0ogXjoz/JKtYvXADiWF7gfTj89jpW3myDl pu7TzpUu+Z52HKONp7GnFE34KW9D2jaN3O9DDN7be1auKyklHVORdnQ6HRuGtqVopWl+ DyxHwkkKzNj0bx+H3/rO/CQvTkO75fCwC1m/H8SD3lEe52M/cHR/BpgwP/3lQWBSYmZ4 L02NPxv3YupqeSWVVxl1ORGF15a3RQ5VgZw3kuizlUYxi6x81owFu2V1ZUKJFu3nzNwl iRvg== X-Gm-Message-State: AC+VfDxIYFsI1ZwmCVYrK/qtrH7bNZqZkX8tNKaG+jxXtGNfAaqzCbHd NL7q2fz2iXi2Z0Ya3MnBG0J8cgALq5w= X-Google-Smtp-Source: ACHHUZ77X892zXwwolICycG3Dwbk3efRn18O9Fvkh4aeveZq+ShJQ31+Y12JL+uZg44PePZ5M/CuvA== X-Received: by 2002:a5d:8048:0:b0:760:3b22:9d0 with SMTP id b8-20020a5d8048000000b007603b2209d0mr1649183ior.19.1682623974475; Thu, 27 Apr 2023 12:32:54 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:53 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 4/9] shared/tester: Add support for NULL PDUs Date: Thu, 27 Apr 2023 12:32:40 -0700 Message-Id: <20230427193245.323502-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds support for NULL PDUs which can be used to skip a round of TX/RX. --- src/shared/tester.c | 6 +++++- src/shared/tester.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/tester.c b/src/shared/tester.c index 1feaba48335c..61647eb0b176 100644 --- a/src/shared/tester.c +++ b/src/shared/tester.c @@ -914,8 +914,12 @@ static bool test_io_send(struct io *io, void *user_data) g_assert_cmpint(len, ==, iov->iov_len); - if (!test->iovcnt && test->io_complete_func) + if (!test->iovcnt && test->io_complete_func) { test->io_complete_func(test->test_data); + } else if (!test->iov->iov_base) { + test_get_iov(test); + return test_io_send(io, user_data); + } return false; } diff --git a/src/shared/tester.h b/src/shared/tester.h index 49610185a444..16f41022db2b 100644 --- a/src/shared/tester.h +++ b/src/shared/tester.h @@ -21,6 +21,8 @@ .iov_len = sizeof(data(args)), \ } +#define IOV_NULL {} + void tester_init(int *argc, char ***argv); int tester_run(void); From patchwork Thu Apr 27 19:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC443C7EE22 for ; Thu, 27 Apr 2023 19:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244974AbjD0TdJ (ORCPT ); Thu, 27 Apr 2023 15:33:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245533AbjD0TdA (ORCPT ); Thu, 27 Apr 2023 15:33:00 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F351D10CB for ; Thu, 27 Apr 2023 12:32:57 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-760f29073b4so244028039f.2 for ; Thu, 27 Apr 2023 12:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623976; x=1685215976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6pK5TjJ5FkDFV3GQCfWI9bCv3wKiC+Ep60HITp76X6o=; b=C3n1p5TaZI8ik+k/42XnmDd3rLAUVAhBf2A1p2ceOk8fNIjoCTsp5foVcUNO8epb2m QgaMsG7QbO9CswYAOhrJsFJKeQvtSpOKiGOi8hwL988mL4MTtqxdPQRD6vrD2/BnLhdS gVyD7Rl+jxJUVZxhDNyZ41t/H/54ZgRVRQUU6CpJzFt+wpIAC0l1gtcwGwqMpWJJ7hj+ okSTUPpOacP50ipbDypsSAp8s8DOjfaMA0vgsfpVjzvPqBJjXtQ/stqgxF+gB8HGYKKQ JyRUCf3/TbqXINepikIDBdrynawzkWaODARvsjiGZLz9/joqJdB07hkc8RZT4IjlI6SS a6/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623976; x=1685215976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6pK5TjJ5FkDFV3GQCfWI9bCv3wKiC+Ep60HITp76X6o=; b=GczdDUV0mhM+ePFt8aaMoGCFA1GCoO48YIqPDCC027FCMXh2jLmf3CjuKCmJgBUQen VBqUuIH3XC70NZbtysm2gJcVdjg0arla5aDL9uhxWoerwx5q7wpl4HLNsG4BNmyjN0+Y jfEoSp5kaH3Ye9pFwBICHv2KyiI9E/JvnkZqFNt18kp7Us2lK6y4P/IUrwMcx1YMl+VK 1kZbYXo5XCm9HMD02UoAig8uZqoIe7F+AfsmdX+iIDcFCeo/DwAMsLgCoifydF8Bo52Z HFZn5XOJyrJxC5cpNpoKAJ+ToBWn5zx5cw7K2YqLdiynPiJBRMJUkNiz7MjiAxTWwExh 48bw== X-Gm-Message-State: AC+VfDzJyxnYI1p7MmyWjrInca2dOM18HyxH32a1h26BtW7zWOl7Gl2O ME10ik72tywXbCa1Mnwn95cH/z5CiUw= X-Google-Smtp-Source: ACHHUZ4HjkJBLO2Yl+GF6g7hYf7BW0qnfWJQlHAe/gi7M5AjxtzXRg26DasADAF490oJvPyX66+fpA== X-Received: by 2002:a5d:924e:0:b0:763:538e:2316 with SMTP id e14-20020a5d924e000000b00763538e2316mr2169576iol.9.1682623976564; Thu, 27 Apr 2023 12:32:56 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:55 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 5/9] shared/bap: Fix typo Date: Thu, 27 Apr 2023 12:32:41 -0700 Message-Id: <20230427193245.323502-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Fix typo s/BT_BAP_CONFIG_LATENCY_BALACED/BT_BAP_CONFIG_LATENCY_BALANCED --- src/shared/bap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/bap.h b/src/shared/bap.h index 0d419aa74982..e9f769d0ef3a 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -26,7 +26,7 @@ #define BT_BAP_STREAM_STATE_RELEASING 0x06 #define BT_BAP_CONFIG_LATENCY_LOW 0x01 -#define BT_BAP_CONFIG_LATENCY_BALACED 0x02 +#define BT_BAP_CONFIG_LATENCY_BALANCED 0x02 #define BT_BAP_CONFIG_LATENCY_HIGH 0x03 #define BT_BAP_CONFIG_PHY_1M 0x01 From patchwork Thu Apr 27 19:32:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA24CC7EE24 for ; Thu, 27 Apr 2023 19:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245494AbjD0TdL (ORCPT ); Thu, 27 Apr 2023 15:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245537AbjD0TdB (ORCPT ); Thu, 27 Apr 2023 15:33:01 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCAA010CF for ; Thu, 27 Apr 2023 12:32:59 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3293e4b2cb5so70750035ab.3 for ; Thu, 27 Apr 2023 12:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623978; x=1685215978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JAzRzgFqkl4Naoj8NS6vvPgDDNigBOrReuLftwEG1Rg=; b=i03oSb8n101w6ecDZjPt+YPXd/SijX7d6Mgatatz0TFf6R4GQRKDS4i5F4VB6jtAVb L+P1c0rCCWj3l6J/MdM5bUrKx5B2VddQaP+oUZeaol9DQU/225UCFaSIheAKK0I/qnKR y3N1zMMprHdymoVmALljFdPbPbwEnT8Ev4hvvOBwdntYREwIU+y15Xhh/9JKXKt0CpyY DlKKH5N79FsphBlQgNfZi2bqLCHFW0KPXWXi0ezTKEVgnHIuDspY1NunVbymu2W7xoAw gAZEC5uyWyFOSEgyNSI4CUMq25JpdHp1Bg3xl5YMQZklAp4X6C590btBFOxYyxC7u9VC PXNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623978; x=1685215978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JAzRzgFqkl4Naoj8NS6vvPgDDNigBOrReuLftwEG1Rg=; b=GEC06KBg3igP7XwEv2UTzFHEFe/r18zl+4TJUkrF+31kUsxvELgtTHiUUrwfw9m1hp IEY68Vet7nsTcStbleWTV3DESbPjrcYo/f72k9qdmxa2poR98whdAbN3tD7QVMOJG3P1 VFEoppU1nZkDJdT4C+kBAow8nDddNCRJkcWzARxkwq8qI/xE9KKqx/UXF5HQaRr8/fyG MhvOSClioTQcKc6IegMvJGXstegnYgSHpU9zU5py9B9EouYdd0J3JuyaVGOqfE6113pR HnfQh4f4nt3JgcfPRTk48J7Tq2QiADcTn88VvV7qg4aIEgO0NvPYaYj8Y9kw4W8cKpAN Cr6Q== X-Gm-Message-State: AC+VfDxtHQbRswDkZQ6fF9IbwtcOS1vDjJ71U+oeUxULIhLDMs3scrLZ M0a4kSh6JxCdXi2VmvMV9mTH75hXHlM= X-Google-Smtp-Source: ACHHUZ4pQsqq9g5FS1HUr7k+BPYQOvyc5PGdX5Xxku0iFDr44/guFVvK8CcWbWS2RVP8GprymXw4EQ== X-Received: by 2002:a92:ccc4:0:b0:32f:2614:cda9 with SMTP id u4-20020a92ccc4000000b0032f2614cda9mr1927199ilq.3.1682623978430; Thu, 27 Apr 2023 12:32:58 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:57 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 6/9] shared/lc3: Update configuration to use iovec Date: Thu, 27 Apr 2023 12:32:42 -0700 Message-Id: <20230427193245.323502-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This use iovec as expected storage for capabilities and configuration so it is inline with what bluetoothctl has been using making it simpler to reuse these definitions. --- src/shared/lc3.h | 93 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 24 deletions(-) diff --git a/src/shared/lc3.h b/src/shared/lc3.h index fd9eb15a73ea..c702a951f50c 100644 --- a/src/shared/lc3.h +++ b/src/shared/lc3.h @@ -7,11 +7,12 @@ * */ -#define LTV(_type, _bytes...) \ +#define data(args...) ((const unsigned char[]) { args }) + +#define LC3_IOV(args...) \ { \ - .len = 1 + sizeof((uint8_t []) { _bytes }), \ - .type = _type, \ - .data = { _bytes }, \ + .iov_base = (void *)data(args), \ + .iov_len = sizeof(data(args)), \ } #define LC3_ID 0x06 @@ -52,13 +53,11 @@ #define LC3_FRAME_COUNT (LC3_BASE + 4) #define LC3_CAPABILITIES(_freq, _duration, _chan_count, _len_min, _len_max) \ - { \ - LTV(LC3_FREQ, _freq), \ - LTV(LC3_DURATION, _duration), \ - LTV(LC3_CHAN_COUNT, _chan_count), \ - LTV(LC3_FRAME_LEN, _len_min, _len_min >> 8, \ - _len_max, _len_max >> 8), \ - } + LC3_IOV(0x02, LC3_FREQ, _freq, _freq >>8, \ + 0x02, LC3_DURATION, _duration, \ + 0x02, LC3_CHAN_COUNT, _chan_count, \ + 0x05, LC3_FRAME_LEN, _len_min, _len_min >> 8, \ + _len_max, _len_max >> 8) #define LC3_CONFIG_BASE 0x01 @@ -81,32 +80,78 @@ #define LC3_CONFIG_FRAME_LEN (LC3_CONFIG_BASE + 3) #define LC3_CONFIG(_freq, _duration, _len) \ - { \ - LTV(LC3_CONFIG_FREQ, _freq), \ - LTV(LC3_CONFIG_DURATION, _duration), \ - LTV(LC3_CONFIG_FRAME_LEN, _len, _len >> 8), \ - } + LC3_IOV(0x02, LC3_CONFIG_FREQ, _freq, \ + 0x02, LC3_CONFIG_DURATION, _duration, \ + 0x03, LC3_CONFIG_FRAME_LEN, _len, _len >> 8) -#define LC3_CONFIG_8KHZ(_duration, _len) \ +#define LC3_CONFIG_8(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_8KHZ, _duration, _len) -#define LC3_CONFIG_11KHZ(_duration, _len) \ +#define LC3_CONFIG_11(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_11KHZ, _duration, _len) -#define LC3_CONFIG_16KHZ(_duration, _len) \ +#define LC3_CONFIG_16(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_16KHZ, _duration, _len) -#define LC3_CONFIG_22KHZ(_duration, _len) \ +#define LC3_CONFIG_22(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_22KHZ, _duration, _len) -#define LC3_CONFIG_24KHZ(_duration, _len) \ +#define LC3_CONFIG_24(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_24KHZ, _duration, _len) -#define LC3_CONFIG_32KHZ(_duration, _len) \ +#define LC3_CONFIG_32(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_32KHZ, _duration, _len) -#define LC3_CONFIG_44KHZ(_duration, _len) \ +#define LC3_CONFIG_44(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_44KHZ, _duration, _len) -#define LC3_CONFIG_48KHZ(_duration, _len) \ +#define LC3_CONFIG_48(_duration, _len) \ LC3_CONFIG(LC3_CONFIG_FREQ_48KHZ, _duration, _len) + +#define LC3_CONFIG_8_1 \ + LC3_CONFIG_8(LC3_CONFIG_DURATION_7_5, 26u) + +#define LC3_CONFIG_8_2 \ + LC3_CONFIG_8(LC3_CONFIG_DURATION_10, 30u) + +#define LC3_CONFIG_16_1 \ + LC3_CONFIG_16(LC3_CONFIG_DURATION_7_5, 30u) + +#define LC3_CONFIG_16_2 \ + LC3_CONFIG_16(LC3_CONFIG_DURATION_10, 40u) + +#define LC3_CONFIG_24_1 \ + LC3_CONFIG_24(LC3_CONFIG_DURATION_7_5, 45u) + +#define LC3_CONFIG_24_2 \ + LC3_CONFIG_24(LC3_CONFIG_DURATION_10, 60u) + +#define LC3_CONFIG_32_1 \ + LC3_CONFIG_32(LC3_CONFIG_DURATION_7_5, 60u) + +#define LC3_CONFIG_32_2 \ + LC3_CONFIG_32(LC3_CONFIG_DURATION_10, 80u) + +#define LC3_CONFIG_44_1 \ + LC3_CONFIG_44(LC3_CONFIG_DURATION_7_5, 98u) + +#define LC3_CONFIG_44_2 \ + LC3_CONFIG_44(LC3_CONFIG_DURATION_10, 130u) + +#define LC3_CONFIG_48_1 \ + LC3_CONFIG_48(LC3_CONFIG_DURATION_7_5, 75u) + +#define LC3_CONFIG_48_2 \ + LC3_CONFIG_48(LC3_CONFIG_DURATION_10, 100u) + +#define LC3_CONFIG_48_3 \ + LC3_CONFIG_48(LC3_CONFIG_DURATION_7_5, 90u) + +#define LC3_CONFIG_48_4 \ + LC3_CONFIG_48(LC3_CONFIG_DURATION_10, 120u) + +#define LC3_CONFIG_48_5 \ + LC3_CONFIG_48(LC3_CONFIG_DURATION_7_5, 117u) + +#define LC3_CONFIG_48_6 \ + LC3_CONFIG_48(LC3_CONFIG_DURATION_10, 155u) From patchwork Thu Apr 27 19:32:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17782C77B61 for ; Thu, 27 Apr 2023 19:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244540AbjD0Tdf (ORCPT ); Thu, 27 Apr 2023 15:33:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245542AbjD0TdG (ORCPT ); Thu, 27 Apr 2023 15:33:06 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91E410CB for ; Thu, 27 Apr 2023 12:33:01 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-32effd5c0a8so5380835ab.1 for ; Thu, 27 Apr 2023 12:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623980; x=1685215980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lq3LJobPFKKVVkTrjg4cHqsfC7i4QUvIuJQ6ilErgnM=; b=NWSXFMseg84gNTLEWj9MbEY+F1y4An7GJmasikXbj4xN3c61Fo62nknydqPQGaolDo E52VXtLNX/CLmgHJ80HAnsYqvodXEMy7PhPLJYs9kAyy9PoZ6ay/jG48ljwxiPohQ0Xs z8nQAN+2RWhsoRANeiqZQJVS9DJtvpgRN4sHJXe4K+zxDhlhY8qgHEStRnzgKht8HB7p jGD1Hq1WZaQt4Z3TusFgs6MAlA1iwk9LABWYqKqAYxv55ZO7J2XxfRUL1AEX08JKAEFL LRmBdLT8aMid3u9+qcIyRZP7NEhC+gP+cGlvmGfa39SgFP40vvSF4inVRML8mYnHzVyw 9qJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623980; x=1685215980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lq3LJobPFKKVVkTrjg4cHqsfC7i4QUvIuJQ6ilErgnM=; b=hD1YPKvwoPaHToXJO9Vw86u9gf5dOnfy/JyIsYlZQjin/UI1kofZ4jw+7fgJOFDISQ /f4yFtF0XhCuu2Of3LSpCrsySQrHvDx+HyzaW0q9Hr08SaXGu61GtGUVP1vMZtY83yhB 6EPNJXusPUPwjdkMZF4hzSnJqRUvtfDD/zHd5rX8bnl0qHfgjC3h+q8Hm10PCQI9G5mO 4cIgktP+ZrZaDppFFvncTdqselKLLcVSB7yxHuYFArISI5XobKjtFcQcL0c4pkvQOEjC Js0xyVMlLoDmYWuAf0j86RA6/Ir8ie1jlYBJJSuP1dM30urvPi/WJDnpV+Tj2FDxHCgw ILAA== X-Gm-Message-State: AC+VfDx9RTOS/FLeP29EaV3/5HJYVyAtAmPU6DwtSzPUYx6Q09MGTlMp UlPv9gEOS0VM6JK4BvYLJcQ6kWrq7cI= X-Google-Smtp-Source: ACHHUZ729r9l5Zs93hkPiH7gswjaB20NF676sud+lQAUmocBdPGyIO2KRt9v+wFAdtUfPnboPMzNCw== X-Received: by 2002:a92:609:0:b0:32c:bd05:9b2f with SMTP id x9-20020a920609000000b0032cbd059b2fmr1873286ilg.27.1682623980274; Thu, 27 Apr 2023 12:33:00 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.32.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:32:59 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 7/9] test-bap: Introduce SCC tests for LC3 Date: Thu, 27 Apr 2023 12:32:43 -0700 Message-Id: <20230427193245.323502-7-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz 4.8.1 Unicast Client Initiates a Config Codec Operation – LC3 (Page 39): Test Purpose: Verify that a Unicast Client IUT can initiate a Config Codec operation for an LC3 codec. Test Case Configuration: BAP/UCL/SCC/BV-001-C [UCL SRC Config Codec, LC3 8_1] BAP/UCL/SCC/BV-002-C [UCL SRC Config Codec, LC3 8_2] BAP/UCL/SCC/BV-003-C [UCL SRC Config Codec, LC3 16_1] BAP/UCL/SCC/BV-004-C [UCL SRC Config Codec, LC3 16_2] BAP/UCL/SCC/BV-005-C [UCL SRC Config Codec, LC3 24_1] BAP/UCL/SCC/BV-006-C [UCL SRC Config Codec, LC3 24_2] BAP/UCL/SCC/BV-007-C [UCL SRC Config Codec, LC3 32_1] BAP/UCL/SCC/BV-008-C [UCL SRC Config Codec, LC3 32_2] BAP/UCL/SCC/BV-009-C [UCL SRC Config Codec, LC3 44.1_1] BAP/UCL/SCC/BV-010-C [UCL SRC Config Codec, LC3 44.1_2] BAP/UCL/SCC/BV-011-C [UCL SRC Config Codec, LC3 48_1] BAP/UCL/SCC/BV-012-C [UCL SRC Config Codec, LC3 48_2] BAP/UCL/SCC/BV-013-C [UCL SRC Config Codec, LC3 48_3] BAP/UCL/SCC/BV-014-C [UCL SRC Config Codec, LC3 48_4] BAP/UCL/SCC/BV-015-C [UCL SRC Config Codec, LC3 48_5] BAP/UCL/SCC/BV-016-C [UCL SRC Config Codec, LC3 48_6] BAP/UCL/SCC/BV-017-C [UCL SNK Config Codec, LC3 8_1] BAP/UCL/SCC/BV-018-C [UCL SNK Config Codec, LC3 8_2] BAP/UCL/SCC/BV-019-C [UCL SNK Config Codec, LC3 16_1] BAP/UCL/SCC/BV-020-C [UCL SNK Config Codec, LC3 16_2] BAP/UCL/SCC/BV-021-C [UCL SNK Config Codec, LC3 24_1] BAP/UCL/SCC/BV-022-C [UCL SNK Config Codec, LC3 24_2] BAP/UCL/SCC/BV-023-C [UCL SNK Config Codec, LC3 32_1] BAP/UCL/SCC/BV-024-C [UCL SNK Config Codec, LC3 32_2] BAP/UCL/SCC/BV-025-C [UCL SNK Config Codec, LC3 44.1_1] BAP/UCL/SCC/BV-026-C [UCL SNK Config Codec, LC3 44.1_2] BAP/UCL/SCC/BV-027-C [UCL SNK Config Codec, LC3 48_1] BAP/UCL/SCC/BV-028-C [UCL SNK Config Codec, LC3 48_2] BAP/UCL/SCC/BV-029-C [UCL SNK Config Codec, LC3 48_3] BAP/UCL/SCC/BV-030-C [UCL SNK Config Codec, LC3 48_4] BAP/UCL/SCC/BV-031-C [UCL SNK Config Codec, LC3 48_5] BAP/UCL/SCC/BV-032-C [UCL SNK Config Codec, LC3 48_6] Pass verdict: The IUT successfully writes to the ASE Control point with the opcode set to 0x01 (Config Codec) and correctly formatted parameter values from Table 4.9. The Codec_ID field is a 5-octet field with octet 0 set to the LC3 Coding_Format value defined in Bluetooth Assigned Numbers, octets 1–4 set to 0x0000. Test Summary ------------ BAP/UCL/SCC/BV-001-C Passed BAP/UCL/SCC/BV-002-C Passed BAP/UCL/SCC/BV-003-C Passed BAP/UCL/SCC/BV-004-C Passed BAP/UCL/SCC/BV-005-C Passed BAP/UCL/SCC/BV-006-C Passed BAP/UCL/SCC/BV-007-C Passed BAP/UCL/SCC/BV-008-C Passed BAP/UCL/SCC/BV-009-C Passed BAP/UCL/SCC/BV-010-C Passed BAP/UCL/SCC/BV-011-C Passed BAP/UCL/SCC/BV-012-C Passed BAP/UCL/SCC/BV-013-C Passed BAP/UCL/SCC/BV-014-C Passed BAP/UCL/SCC/BV-015-C Passed BAP/UCL/SCC/BV-016-C Passed BAP/UCL/SCC/BV-017-C Passed BAP/UCL/SCC/BV-018-C Passed BAP/UCL/SCC/BV-019-C Passed BAP/UCL/SCC/BV-020-C Passed BAP/UCL/SCC/BV-021-C Passed BAP/UCL/SCC/BV-022-C Passed BAP/UCL/SCC/BV-023-C Passed BAP/UCL/SCC/BV-024-C Passed BAP/UCL/SCC/BV-025-C Passed BAP/UCL/SCC/BV-026-C Passed BAP/UCL/SCC/BV-027-C Passed BAP/UCL/SCC/BV-028-C Passed BAP/UCL/SCC/BV-029-C Passed BAP/UCL/SCC/BV-030-C Passed BAP/UCL/SCC/BV-031-C Passed BAP/UCL/SCC/BV-032-C Passed Total: 32, Passed: 32 (100.0%), Failed: 0, Not Run: 0 Overall execution time: 0.373 seconds --- unit/test-bap.c | 538 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 531 insertions(+), 7 deletions(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index afeefac84091..269dcf6520c0 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -30,20 +30,45 @@ #include "src/shared/gatt-db.h" #include "src/shared/gatt-client.h" #include "src/shared/bap.h" +#include "src/shared/lc3.h" + +struct test_config { + struct bt_bap_pac_qos pqos; + struct iovec cc; + struct bt_bap_qos qos; + bool snk; + bool src; +}; struct test_data { struct bt_gatt_client *client; struct bt_bap *bap; + struct bt_bap_pac *snk; + struct bt_bap_pac *src; + struct iovec *caps; + struct test_config *cfg; + struct bt_bap_stream *stream; size_t iovcnt; struct iovec *iov; }; +/* + * Frequencies: 8Khz 11Khz 16Khz 22Khz 24Khz 32Khz 44.1Khz 48Khz + * Duration: 7.5 ms 10 ms + * Channel count: 3 + * Frame length: 30-240 + */ +static struct iovec lc3_caps = LC3_CAPABILITIES(LC3_FREQ_ANY, LC3_DURATION_ANY, + 3u, 30, 240); + #define iov_data(args...) ((const struct iovec[]) { args }) -#define define_test(name, function, args...) \ +#define define_test(name, function, _cfg, args...) \ do { \ const struct iovec iov[] = { args }; \ static struct test_data data; \ + data.caps = &lc3_caps; \ + data.cfg = _cfg; \ data.iovcnt = ARRAY_SIZE(iov_data(args)); \ data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \ tester_add(name, &data, test_setup, function, \ @@ -307,6 +332,38 @@ static void test_complete_cb(const void *user_data) tester_test_passed(); } +static void bap_config(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + if (code) + tester_test_failed(); +} + +static bool pac_found(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, + void *user_data) +{ + struct test_data *data = user_data; + unsigned int config_id; + + data->stream = bt_bap_stream_new(data->bap, lpac, rpac, + &data->cfg->qos, + &data->cfg->cc); + g_assert(data->stream); + + config_id = bt_bap_stream_config(data->stream, &data->cfg->qos, + &data->cfg->cc, bap_config, data); + g_assert(config_id); + + return true; +} + +static void bap_ready(struct bt_bap *bap, void *user_data) +{ + bt_bap_foreach_pac(bap, BT_BAP_SINK, pac_found, user_data); + bt_bap_foreach_pac(bap, BT_BAP_SOURCE, pac_found, user_data); +} + static void test_client(const void *user_data) { struct test_data *data = (void *)user_data; @@ -321,11 +378,29 @@ static void test_client(const void *user_data) db = gatt_db_new(); g_assert(db); + if (data->cfg) { + if (data->cfg->src) { + data->snk = bt_bap_add_pac(db, "test-bap-snk", + BT_BAP_SINK, LC3_ID, + NULL, data->caps, NULL); + g_assert(data->snk); + } + + if (data->cfg->snk) { + data->src = bt_bap_add_pac(db, "test-bap-src", + BT_BAP_SOURCE, LC3_ID, + NULL, data->caps, NULL); + g_assert(data->src); + } + } + data->bap = bt_bap_new(db, bt_gatt_client_get_db(data->client)); g_assert(data->bap); bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL); + bt_bap_ready_register(data->bap, bap_ready, data, NULL); + bt_bap_attach(data->bap, data->client); } @@ -531,22 +606,22 @@ static void test_disc(void) * The IUT reads the values of the characteristics specified in the PAC * Characteristic and Location Characteristic columns. */ - define_test("BAP/UCL/DISC/BV-01-C", test_client, DISC_SINK_PAC); - define_test("BAP/UCL/DISC/BV-02-C", test_client, DISC_SOURCE_PAC); + define_test("BAP/UCL/DISC/BV-01-C", test_client, NULL, DISC_SINK_PAC); + define_test("BAP/UCL/DISC/BV-02-C", test_client, NULL, DISC_SOURCE_PAC); /* BAP/UCL/DISC/BV-06-C [Discover Available Audio Contexts] * * The IUT successfully reads the value of the Available Audio Contexts * characteristic on the LowerTester. */ - define_test("BAP/UCL/DISC/BV-06-C", test_client, DISC_CTX); + define_test("BAP/UCL/DISC/BV-06-C", test_client, NULL, DISC_CTX); /* BAP/UCL/DISC/BV-05-C [Discover Supported Audio Contexts] * * The IUT successfully reads the value of the Supported Audio Contexts * characteristic on the Lower Tester. */ - define_test("BAP/UCL/DISC/BV-05-C", test_client, DISC_SUP_CTX); + define_test("BAP/UCL/DISC/BV-05-C", test_client, NULL, DISC_SUP_CTX); /* BAP/UCL/DISC/BV-03-C [Discover Sink ASE_ID] * BAP/UCL/DISC/BV-04-C [Discover Source ASE_ID] @@ -554,8 +629,456 @@ static void test_disc(void) * The IUT successfully reads the ASE_ID values of each discovered ASE * characteristic on the LowerTester. */ - define_test("BAP/UCL/DISC/BV-03-C", test_client, DISC_SINK_ASE); - define_test("BAP/UCL/DISC/BV-04-C", test_client, DISC_SOURCE_ASE); + define_test("BAP/UCL/DISC/BV-03-C", test_client, NULL, DISC_SINK_ASE); + define_test("BAP/UCL/DISC/BV-04-C", test_client, NULL, DISC_SOURCE_ASE); +} + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 010101020206000000000_cfg + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0101010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 01010102010a00204e00409c00204e00409c000600000000_cfg + */ +#define SCC_SNK(_cfg...) \ + DISC_SOURCE_ASE, \ + IOV_DATA(0x52, 0x22, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x06, 0x00, \ + 0x00, 0x00, 0x00, _cfg), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x0a, 0x00, \ + 0x20, 0x4e, 0x00, 0x40, 0x9c, 0x00, 0x20, 0x4e, 0x00, \ + 0x40, 0x9c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, _cfg) + +#define QOS_BALANCED_2M \ + { \ + .target_latency = BT_BAP_CONFIG_LATENCY_BALANCED, \ + .phy = BT_BAP_CONFIG_PHY_2M, \ + } + +static struct test_config cfg_snk_8_1 = { + .cc = LC3_CONFIG_8_1, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_8_1 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1a, \ + 0x00) + +static struct test_config cfg_snk_8_2 = { + .cc = LC3_CONFIG_8_2, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_8_2 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x04, 0x1e, \ + 0x00) + +static struct test_config cfg_snk_16_1 = { + .cc = LC3_CONFIG_16_1, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_16_1 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1e, \ + 0x00) + +static struct test_config cfg_snk_16_2 = { + .cc = LC3_CONFIG_16_2, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_16_2 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, 0x28, \ + 0x00) + +static struct test_config cfg_snk_24_1 = { + .cc = LC3_CONFIG_24_1, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_24_1 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x00, 0x03, 0x04, 0x2d, \ + 0x00) + +static struct test_config cfg_snk_24_2 = { + .cc = LC3_CONFIG_24_2, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_24_2 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x01, 0x03, 0x04, 0x3c, \ + 0x00) + +static struct test_config cfg_snk_32_1 = { + .cc = LC3_CONFIG_32_1, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_32_1 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x00, 0x03, 0x04, 0x3c, \ + 0x00) + +static struct test_config cfg_snk_32_2 = { + .cc = LC3_CONFIG_32_2, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_32_2 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x01, 0x03, 0x04, 0x50, \ + 0x00) + +static struct test_config cfg_snk_44_1 = { + .cc = LC3_CONFIG_44_1, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_44_1 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x00, 0x03, 0x04, 0x62, \ + 0x00) + +static struct test_config cfg_snk_44_2 = { + .cc = LC3_CONFIG_44_2, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_44_2 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x01, 0x03, 0x04, 0x82, \ + 0x00) + +static struct test_config cfg_snk_48_1 = { + .cc = LC3_CONFIG_48_1, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_48_1 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x4b, \ + 0x00) + +static struct test_config cfg_snk_48_2 = { + .cc = LC3_CONFIG_48_2, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_48_2 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x64, \ + 0x00) + +static struct test_config cfg_snk_48_3 = { + .cc = LC3_CONFIG_48_3, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_48_3 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x5a, \ + 0x00) + +static struct test_config cfg_snk_48_4 = { + .cc = LC3_CONFIG_48_4, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_48_4 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x78, \ + 0x00) + +static struct test_config cfg_snk_48_5 = { + .cc = LC3_CONFIG_48_5, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_48_5 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x75, \ + 0x00) + +static struct test_config cfg_snk_48_6 = { + .cc = LC3_CONFIG_48_6, + .qos = QOS_BALANCED_2M, + .snk = true, +}; + +#define SCC_SNK_48_6 \ + SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x9b, \ + 0x00) + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 010103020206000000000_cfg + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0101030000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x001c + * Data: 03010102010a00204e00409c00204e00409c000600000000_cfg + */ +#define SCC_SRC(_cfg...) \ + DISC_SOURCE_ASE, \ + IOV_DATA(0x52, 0x22, 0x00, 0x01, 0x01, 0x03, 0x02, 0x02, 0x06, 0x00, \ + 0x00, 0x00, 0x00, _cfg), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x01, 0x01, 0x02, 0x01, 0x0a, 0x00, \ + 0x20, 0x4e, 0x00, 0x40, 0x9c, 0x00, 0x20, 0x4e, 0x00, \ + 0x40, 0x9c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, _cfg) + +static struct test_config cfg_src_8_1 = { + .cc = LC3_CONFIG_8_1, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_8_1 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1a, \ + 0x00) + +static struct test_config cfg_src_8_2 = { + .cc = LC3_CONFIG_8_2, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_8_2 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x04, 0x1e, \ + 0x00) + +static struct test_config cfg_src_16_1 = { + .cc = LC3_CONFIG_16_1, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_16_1 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1e, \ + 0x00) + +static struct test_config cfg_src_16_2 = { + .cc = LC3_CONFIG_16_2, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_16_2 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, 0x28, \ + 0x00) + +static struct test_config cfg_src_24_1 = { + .cc = LC3_CONFIG_24_1, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_24_1 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x00, 0x03, 0x04, 0x2d, \ + 0x00) + +static struct test_config cfg_src_24_2 = { + .cc = LC3_CONFIG_24_2, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_24_2 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x01, 0x03, 0x04, 0x3c, \ + 0x00) + +static struct test_config cfg_src_32_1 = { + .cc = LC3_CONFIG_32_1, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_32_1 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x00, 0x03, 0x04, 0x3c, \ + 0x00) + +static struct test_config cfg_src_32_2 = { + .cc = LC3_CONFIG_32_2, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_32_2 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x01, 0x03, 0x04, 0x50, \ + 0x00) + +static struct test_config cfg_src_44_1 = { + .cc = LC3_CONFIG_44_1, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_44_1 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x00, 0x03, 0x04, 0x62, \ + 0x00) + +static struct test_config cfg_src_44_2 = { + .cc = LC3_CONFIG_44_2, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_44_2 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x01, 0x03, 0x04, 0x82, \ + 0x00) + +static struct test_config cfg_src_48_1 = { + .cc = LC3_CONFIG_48_1, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_48_1 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x4b, \ + 0x00) + +static struct test_config cfg_src_48_2 = { + .cc = LC3_CONFIG_48_2, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_48_2 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x64, \ + 0x00) + +static struct test_config cfg_src_48_3 = { + .cc = LC3_CONFIG_48_3, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_48_3 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x5a, \ + 0x00) + +static struct test_config cfg_src_48_4 = { + .cc = LC3_CONFIG_48_4, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_48_4 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x78, \ + 0x00) + +static struct test_config cfg_src_48_5 = { + .cc = LC3_CONFIG_48_5, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_48_5 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x75, \ + 0x00) + +static struct test_config cfg_src_48_6 = { + .cc = LC3_CONFIG_48_6, + .qos = QOS_BALANCED_2M, + .src = true, +}; + +#define SCC_SRC_48_6 \ + SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x9b, \ + 0x00) + +static void test_scc(void) +{ + /* Test Purpose: + * Verify that a Unicast Client IUT can initiate a Config Codec + * operation for an LC3 codec. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control point with the opcode + * set to 0x01 (Config Codec) and correctly formatted parameter values + * from Table 4.9. The Codec_ID field is a 5-octet field with octet 0 + * set to the LC3 Coding_Format value defined in Bluetooth Assigned + * Numbers, octets 1–4 set to 0x0000. Each parameter (if present) + * included in the data sent in Codec_Specific_Configuration is + * formatted in an LTV structure with the length, type, and value + * specified in Table 4.10. + */ + define_test("BAP/UCL/SCC/BV-001-C", test_client, &cfg_snk_8_1, + SCC_SNK_8_1); + define_test("BAP/UCL/SCC/BV-002-C", test_client, &cfg_snk_8_2, + SCC_SNK_8_2); + define_test("BAP/UCL/SCC/BV-003-C", test_client, &cfg_snk_16_1, + SCC_SNK_16_1); + define_test("BAP/UCL/SCC/BV-004-C", test_client, &cfg_snk_16_2, + SCC_SNK_16_2); + define_test("BAP/UCL/SCC/BV-005-C", test_client, &cfg_snk_24_1, + SCC_SNK_24_1); + define_test("BAP/UCL/SCC/BV-006-C", test_client, &cfg_snk_24_2, + SCC_SNK_24_2); + define_test("BAP/UCL/SCC/BV-007-C", test_client, &cfg_snk_32_1, + SCC_SNK_32_1); + define_test("BAP/UCL/SCC/BV-008-C", test_client, &cfg_snk_32_2, + SCC_SNK_32_2); + define_test("BAP/UCL/SCC/BV-009-C", test_client, &cfg_snk_44_1, + SCC_SNK_44_1); + define_test("BAP/UCL/SCC/BV-010-C", test_client, &cfg_snk_44_2, + SCC_SNK_44_2); + define_test("BAP/UCL/SCC/BV-011-C", test_client, &cfg_snk_48_1, + SCC_SNK_48_1); + define_test("BAP/UCL/SCC/BV-012-C", test_client, &cfg_snk_48_2, + SCC_SNK_48_2); + define_test("BAP/UCL/SCC/BV-013-C", test_client, &cfg_snk_48_3, + SCC_SNK_48_3); + define_test("BAP/UCL/SCC/BV-014-C", test_client, &cfg_snk_48_4, + SCC_SNK_48_4); + define_test("BAP/UCL/SCC/BV-015-C", test_client, &cfg_snk_48_5, + SCC_SNK_48_5); + define_test("BAP/UCL/SCC/BV-016-C", test_client, &cfg_snk_48_6, + SCC_SNK_48_6); + define_test("BAP/UCL/SCC/BV-017-C", test_client, &cfg_src_8_1, + SCC_SRC_8_1); + define_test("BAP/UCL/SCC/BV-018-C", test_client, &cfg_src_8_2, + SCC_SRC_8_2); + define_test("BAP/UCL/SCC/BV-019-C", test_client, &cfg_src_16_1, + SCC_SRC_16_1); + define_test("BAP/UCL/SCC/BV-020-C", test_client, &cfg_src_16_2, + SCC_SRC_16_2); + define_test("BAP/UCL/SCC/BV-021-C", test_client, &cfg_src_24_1, + SCC_SRC_24_1); + define_test("BAP/UCL/SCC/BV-022-C", test_client, &cfg_src_24_2, + SCC_SRC_24_2); + define_test("BAP/UCL/SCC/BV-023-C", test_client, &cfg_src_32_1, + SCC_SRC_32_1); + define_test("BAP/UCL/SCC/BV-024-C", test_client, &cfg_src_32_2, + SCC_SRC_32_2); + define_test("BAP/UCL/SCC/BV-025-C", test_client, &cfg_src_44_1, + SCC_SRC_44_1); + define_test("BAP/UCL/SCC/BV-026-C", test_client, &cfg_src_44_2, + SCC_SRC_44_2); + define_test("BAP/UCL/SCC/BV-027-C", test_client, &cfg_src_48_1, + SCC_SRC_48_1); + define_test("BAP/UCL/SCC/BV-028-C", test_client, &cfg_src_48_2, + SCC_SRC_48_2); + define_test("BAP/UCL/SCC/BV-029-C", test_client, &cfg_src_48_3, + SCC_SRC_48_3); + define_test("BAP/UCL/SCC/BV-030-C", test_client, &cfg_src_48_4, + SCC_SRC_48_4); + define_test("BAP/UCL/SCC/BV-031-C", test_client, &cfg_src_48_5, + SCC_SRC_48_5); + define_test("BAP/UCL/SCC/BV-032-C", test_client, &cfg_src_48_6, + SCC_SRC_48_6); } int main(int argc, char *argv[]) @@ -563,6 +1086,7 @@ int main(int argc, char *argv[]) tester_init(&argc, &argv); test_disc(); + test_scc(); return tester_run(); } From patchwork Thu Apr 27 19:32:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EF01C77B7E for ; Thu, 27 Apr 2023 19:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244984AbjD0Tdg (ORCPT ); Thu, 27 Apr 2023 15:33:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245543AbjD0TdG (ORCPT ); Thu, 27 Apr 2023 15:33:06 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8428610CF for ; Thu, 27 Apr 2023 12:33:03 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7606d460da7so210527039f.1 for ; Thu, 27 Apr 2023 12:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623982; x=1685215982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1Zf1jMK3UJ9SfKs4kbWstHqgU/7a87nWIjklSePkN28=; b=cnSfbB4s2VVd29iIziPZNEUwis+SgRWUpef8OcmERCBQ+bKn4BKCLcwwPnzpU6KDus h/KeOuQqyfbVWGSPw0a5/FJbVKPpx0KJRERg1lBI8qO3lFYgewc/enC1u1svHMMBkElE UJdup1rMa4IAkM4zvwiZVgMPsvVJUkJIYMv1kHKRj4qROV11e4rG4DPC7+fP1W73HqPG EGZZenvPz3vpyFFDNJeg07YJDsSLAKNH7vmfHUVJmwvRAekMCIQ40V5w69S9IXdpsUKs usg+RW6LVZTOccnLe+v4iHdML74ctSu+kuE4o2YGxEeUyRPddvHk9N46y/NCxVQ8XqQ+ Z6Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623982; x=1685215982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Zf1jMK3UJ9SfKs4kbWstHqgU/7a87nWIjklSePkN28=; b=U+O8FCRvZmAQ8VnvoB8j8p0bOgMddzAau/nv5GjIKArg4iqL5O1SZthD9V3ZzoHvQB RXCpa7ya2ixYj5/g3ypFMAT/phtAxrxqSbzfR0JrCPbB3L6mlWGjhKDfa5R64sEYR+vW MXOZJmQc7y11TDKWcuhPF8acUE0ERBT2KSH0uIohYK1QQ2gesLq95Mu9G/18ipalDvC9 vG1dEix2bT+oIXwGJerpASu5rWf4Yc6NMf7jLTtSdzR90RPpF6BCqXpgP3ptvOq8dsMp THY2230d3Y1iLXGf2TmzNUfK75he3/xhGLrozSjygBsLajQEeOV9vvSd6lXOmyLvXghD hKTA== X-Gm-Message-State: AC+VfDwJhzVGw/2GIJ9VAY6gX5qvNFWSiL2JovaznC4fWbtCOyKWGTMe ptwGUuAxk91yZjasIAV9ENsKPeo805g= X-Google-Smtp-Source: ACHHUZ6tEv3ATUakdwB4TapHy3QIPonmspz8mY+CCA1+RQ/Ci4HcDGjpvOLBeB1vJLvTEh4UFVhUMg== X-Received: by 2002:a5e:db45:0:b0:763:5f1b:2f6f with SMTP id r5-20020a5edb45000000b007635f1b2f6fmr1917286iop.7.1682623982242; Thu, 27 Apr 2023 12:33:02 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.33.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:33:00 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 8/9] shared/util: Fix runtime error Date: Thu, 27 Apr 2023 12:32:44 -0700 Message-Id: <20230427193245.323502-8-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This fixes the following errors: src/shared/util.c:271:2: runtime error: null pointer passed as argument 2, which is declared to never be null --- src/shared/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/util.c b/src/shared/util.c index d31daacc4b93..9a4a8d77abce 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -268,7 +268,8 @@ void *util_iov_push_mem(struct iovec *iov, size_t len, const void *data) if (!p) return NULL; - memcpy(p, data, len); + if (data) + memcpy(p, data, len); return p; } From patchwork Thu Apr 27 19:32:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 677741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60944C77B73 for ; Thu, 27 Apr 2023 19:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245024AbjD0Tdh (ORCPT ); Thu, 27 Apr 2023 15:33:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245453AbjD0TdJ (ORCPT ); Thu, 27 Apr 2023 15:33:09 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 489B510DA for ; Thu, 27 Apr 2023 12:33:06 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-32f23e2249bso12721705ab.0 for ; Thu, 27 Apr 2023 12:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682623985; x=1685215985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=W63wz9PM6AvCAMQzs8mg0htB9fJPZP4GWCCPe/Uebys=; b=PxCIgSc47qMIJveM15ljaRDCsjPz3AlYJFuP2YvSEuOB9YU4powz0Upe6SaxZop82N 9ErHtErS4Ko0voLKmXQniWtjPJC5REPpTR+GjifLhEBjBbrktCakmTQyMBMqyOYHigpj c0uedqzWBakLElh3ZsiAYDYlZ9JLIwTFpSq+YU1+yo2GFGDeqJZ/NHiSm0eyckfkZBPs cKEXJQD7IAdpsHfJBVGC+5J2fD/JTWLJoz5VOXUOLukfI13q+vMH4jWrUjTjCVM5gDnH ar3ipsnIm+682tFaifvEvWWTbdJevsD/J4EhTl5waIxK9H8yv8b48xe/ry2fNjinbNHc vyVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682623985; x=1685215985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W63wz9PM6AvCAMQzs8mg0htB9fJPZP4GWCCPe/Uebys=; b=aoeUU8m8yTLN7v47FvpNWted3KtIKsdjCLuUEqeLnwGPtRx+qwvTLIlIRgj84Z1yhv hhU5rLHS08svT0lsqWlK58jT3wMVyIXD7XKkAL6zc4v8gAwHn8+OQkB5x7LVIvtjFKiJ builpu8APkOmIXeiBOOjACPioZRxnn1KFb38Y9KSnmGnO8SHQrBmaGWwuKYckHv08JWz Z628qhJ3wsc/JnunSpyO/G1ARuCfIWBw0iXsszixdHv3gnx1eI73i4OVBv88g3/iM3Rq kBMpCbYf0I/NVURU0+b2YayU8MK/CphZoNx7IzOhyCFMjvfosVnGcJ1UGgtCiyPLryJF ZE+A== X-Gm-Message-State: AC+VfDxp9ikYyhfrwhUlq/LyP+w9QDwH9qoOu0R2mKU+JaoqJkzfnVdy N2uaY6RAFPLCxhMBvT5DAEFmGxkEcUQ= X-Google-Smtp-Source: ACHHUZ44E+DnNjJRXx3XYiJnY6gzmwKTdEXrI0dPifbw3zLBqEJHy7W5W2OeJrEE9gQZp33LvTKEMw== X-Received: by 2002:a05:6e02:18ce:b0:329:4142:e9ff with SMTP id s14-20020a056e0218ce00b003294142e9ffmr4904778ilu.10.1682623984285; Thu, 27 Apr 2023 12:33:04 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id n12-20020a056638264c00b00411baa5ec5asm3349898jat.154.2023.04.27.12.33.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 12:33:03 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 9/9] test-bap: Add SCC tests for Vendor-Specific codec Date: Thu, 27 Apr 2023 12:32:45 -0700 Message-Id: <20230427193245.323502-9-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427193245.323502-1-luiz.dentz@gmail.com> References: <20230427193245.323502-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz 4.8.2 Unicast Client Initiates a Config Codec Operation – Vendor-Specific (page 42): Test Purpose: Verify that a Unicast Client IUT can initiate a Config Codec operation for a vendor-specific codec. Test Case Configuration: BAP/UCL/SCC/BV-033-C [UCL SRC Config Codec, VS] BAP/UCL/SCC/BV-034-C [UCL SNK Config Codec, VS] Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x01 (Config Codec) and the specified parameters. The Codec_ID parameter is formatted with octet 0 set to 0xFF, octets 1–2 set to TSPX_VS_Company_ID, and octets 3–4 set to TSPX_VS_Codec_ID. BAP/UCL/SCC/BV-033-C Passed BAP/UCL/SCC/BV-034-C Passed --- unit/test-bap.c | 334 +++++++++++++++++++++++++++++++----------------- 1 file changed, 216 insertions(+), 118 deletions(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index 269dcf6520c0..241dffbd1c09 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -38,10 +38,12 @@ struct test_config { struct bt_bap_qos qos; bool snk; bool src; + bool vs; }; struct test_data { struct bt_gatt_client *client; + struct gatt_db *db; struct bt_bap *bap; struct bt_bap_pac *snk; struct bt_bap_pac *src; @@ -364,37 +366,56 @@ static void bap_ready(struct bt_bap *bap, void *user_data) bt_bap_foreach_pac(bap, BT_BAP_SOURCE, pac_found, user_data); } +static void test_client_config(struct test_data *data) +{ + if (!data->cfg) + return; + + if (data->cfg->src) { + if (data->cfg->vs) + data->snk = bt_bap_add_vendor_pac(data->db, + "test-bap-snk", + BT_BAP_SINK, 0x0ff, + 0x0001, 0x0001, + NULL, data->caps, NULL); + else + data->snk = bt_bap_add_pac(data->db, "test-bap-snk", + BT_BAP_SINK, LC3_ID, + NULL, data->caps, NULL); + g_assert(data->snk); + } + + if (data->cfg->snk) { + if (data->cfg->vs) + data->src = bt_bap_add_vendor_pac(data->db, + "test-bap-src", + BT_BAP_SOURCE, 0x0ff, + 0x0001, 0x0001, + NULL, data->caps, NULL); + else + data->src = bt_bap_add_pac(data->db, "test-bap-src", + BT_BAP_SOURCE, LC3_ID, + NULL, data->caps, NULL); + g_assert(data->src); + } +} + static void test_client(const void *user_data) { struct test_data *data = (void *)user_data; struct io *io; - struct gatt_db *db; io = tester_setup_io(data->iov, data->iovcnt); g_assert(io); tester_io_set_complete_func(test_complete_cb); - db = gatt_db_new(); - g_assert(db); + data->db = gatt_db_new(); + g_assert(data->db); - if (data->cfg) { - if (data->cfg->src) { - data->snk = bt_bap_add_pac(db, "test-bap-snk", - BT_BAP_SINK, LC3_ID, - NULL, data->caps, NULL); - g_assert(data->snk); - } + test_client_config(data); - if (data->cfg->snk) { - data->src = bt_bap_add_pac(db, "test-bap-src", - BT_BAP_SOURCE, LC3_ID, - NULL, data->caps, NULL); - g_assert(data->src); - } - } - - data->bap = bt_bap_new(db, bt_gatt_client_get_db(data->client)); + data->bap = bt_bap_new(data->db, bt_gatt_client_get_db(data->client)); g_assert(data->bap); bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL); @@ -412,6 +433,10 @@ static void test_teardown(const void *user_data) bt_gatt_client_unref(data->client); util_iov_free(data->iov, data->iovcnt); + bt_bap_remove_pac(data->snk); + bt_bap_remove_pac(data->src); + gatt_db_unref(data->db); + tester_teardown_complete(); } @@ -452,14 +477,17 @@ static void test_teardown(const void *user_data) * Front Left (0x00000001) * Front Right (0x00000002) */ -#define DISC_SINK_PAC \ +#define DISC_SNK_PAC(_caps...) \ IOV_DATA(0x0a, 0x03, 0x00), \ - IOV_DATA(0x0b, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ - 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ - 0x1e, 0x00, 0xf0, 0x00, 0x00), \ + IOV_DATA(0x0b, 0x01, _caps), \ IOV_DATA(0x0a, 0x06, 0x00), \ IOV_DATA(0x0b, 0x03, 0x00, 0x00, 0x00) +#define DISC_SNK_LC3 \ + DISC_SNK_PAC(0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ + 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ + 0x1e, 0x00, 0xf0, 0x00, 0x00) + /* ATT: Read Request (0x0a) len 2 * Handle: 0x0009 Type: Source PAC (0x2bcb) * ATT: Read Response (0x0b) len 24 @@ -497,37 +525,50 @@ static void test_teardown(const void *user_data) * Front Left (0x00000001) * Front Right (0x00000002) */ -#define DISC_SOURCE_PAC \ - DISC_SINK_PAC, \ +#define DISC_SRC_PAC(_caps...) \ + DISC_SNK_PAC(_caps), \ IOV_DATA(0x0a, 0x09, 0x00), \ - IOV_DATA(0x0b, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ - 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ - 0x1e, 0x00, 0xf0, 0x00, 0x00), \ + IOV_DATA(0x0b, 0x01, _caps), \ IOV_DATA(0x0a, 0x0c, 0x00), \ IOV_DATA(0x0b, 0x03, 0x00, 0x00, 0x00) +#define DISC_SRC_LC3 \ + DISC_SRC_PAC(0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ + 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ + 0x1e, 0x00, 0xf0, 0x00, 0x00) + /* ATT: Read Request (0x0a) len 2 * Handle: 0x000f Type: Available Audio Contexts (0x2bcd) * ATT: Read Response (0x0b) len 4 * Value: ff0f0e00 * Handle: 0x000f Type: Available Audio Contexts (0x2bcd) */ -#define DISC_CTX \ - DISC_SOURCE_PAC, \ +#define DISC_CTX(_caps...) \ + DISC_SRC_PAC(_caps), \ IOV_DATA(0x0a, 0x0f, 0x00), \ IOV_DATA(0x0b, 0xff, 0x0f, 0x0e, 0x00) +#define DISC_CTX_LC3 \ + DISC_CTX(0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ + 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ + 0x1e, 0x00, 0xf0, 0x00, 0x00) + /* ATT: Read Request (0x0a) len 2 * Handle: 0x0012 Type: Supported Audio Contexts (0x2bce) * ATT: Read Response (0x0b) len 4 * Value: ff0f0e00 * Handle: 0x0012 Type: Supported Audio Contexts (0x2bce) */ -#define DISC_SUP_CTX \ - DISC_CTX, \ +#define DISC_SUP_CTX(_caps...) \ + DISC_CTX(_caps), \ IOV_DATA(0x0a, 0x12, 0x00), \ IOV_DATA(0x0b, 0xff, 0x0f, 0x0e, 0x00) +#define DISC_SUP_CTX_LC3 \ + DISC_SUP_CTX(0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ + 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ + 0x1e, 0x00, 0xf0, 0x00, 0x00) + /* ATT: Read Request (0x0a) len 2 * Handle: 0x0016 Type: Sink ASE (0x2bc4) * ATT: Read Response (0x0b) len 4 @@ -549,8 +590,8 @@ static void test_teardown(const void *user_data) * Notification (0x01) * ATT: Write Response (0x13) len 0 */ -#define DISC_SINK_ASE \ - DISC_SUP_CTX, \ +#define DISC_SNK_ASE(_caps...) \ + DISC_SUP_CTX(_caps), \ IOV_DATA(0x0a, 0x16, 0x00), \ IOV_DATA(0x0b, 0x01, 0x00), \ IOV_DATA(0x12, 0x17, 0x00, 0x01, 0x00), \ @@ -560,6 +601,11 @@ static void test_teardown(const void *user_data) IOV_DATA(0x12, 0x1a, 0x00, 0x01, 0x00), \ IOV_DATA(0x13) +#define DISC_SNK_ASE_LC3 \ + DISC_SNK_ASE(0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ + 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ + 0x1e, 0x00, 0xf0, 0x00, 0x00) + /* ATT: Read Request (0x0a) len 2 * Handle: 0x001c Type: Source ASE (0x2bc5) * ATT: Read Response (0x0b) len 4 @@ -586,8 +632,8 @@ static void test_teardown(const void *user_data) * Notification (0x01) * ATT: Write Response (0x13) len 0 */ -#define DISC_SOURCE_ASE \ - DISC_SINK_ASE, \ +#define DISC_SRC_ASE(_cfg...) \ + DISC_SNK_ASE(_cfg), \ IOV_DATA(0x0a, 0x1c, 0x00), \ IOV_DATA(0x0b, 0x03, 0x00), \ IOV_DATA(0x12, 0x1d, 0x00, 0x01, 0x00), \ @@ -599,6 +645,11 @@ static void test_teardown(const void *user_data) IOV_DATA(0x12, 0x23, 0x00, 0x01, 0x00), \ IOV_DATA(0x13) +#define DISC_SRC_ASE_LC3 \ + DISC_SRC_ASE(0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x01, \ + 0xff, 0x00, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x05, 0x04, \ + 0x1e, 0x00, 0xf0, 0x00, 0x00) + static void test_disc(void) { /* The IUT discovers the characteristics specified in the PAC @@ -606,22 +657,23 @@ static void test_disc(void) * The IUT reads the values of the characteristics specified in the PAC * Characteristic and Location Characteristic columns. */ - define_test("BAP/UCL/DISC/BV-01-C", test_client, NULL, DISC_SINK_PAC); - define_test("BAP/UCL/DISC/BV-02-C", test_client, NULL, DISC_SOURCE_PAC); + define_test("BAP/UCL/DISC/BV-01-C", test_client, NULL, DISC_SNK_LC3); + define_test("BAP/UCL/DISC/BV-02-C", test_client, NULL, DISC_SRC_LC3); /* BAP/UCL/DISC/BV-06-C [Discover Available Audio Contexts] * * The IUT successfully reads the value of the Available Audio Contexts * characteristic on the LowerTester. */ - define_test("BAP/UCL/DISC/BV-06-C", test_client, NULL, DISC_CTX); + define_test("BAP/UCL/DISC/BV-06-C", test_client, NULL, DISC_CTX_LC3); /* BAP/UCL/DISC/BV-05-C [Discover Supported Audio Contexts] * * The IUT successfully reads the value of the Supported Audio Contexts * characteristic on the Lower Tester. */ - define_test("BAP/UCL/DISC/BV-05-C", test_client, NULL, DISC_SUP_CTX); + define_test("BAP/UCL/DISC/BV-05-C", test_client, NULL, + DISC_SUP_CTX_LC3); /* BAP/UCL/DISC/BV-03-C [Discover Sink ASE_ID] * BAP/UCL/DISC/BV-04-C [Discover Source ASE_ID] @@ -629,29 +681,33 @@ static void test_disc(void) * The IUT successfully reads the ASE_ID values of each discovered ASE * characteristic on the LowerTester. */ - define_test("BAP/UCL/DISC/BV-03-C", test_client, NULL, DISC_SINK_ASE); - define_test("BAP/UCL/DISC/BV-04-C", test_client, NULL, DISC_SOURCE_ASE); + define_test("BAP/UCL/DISC/BV-03-C", test_client, NULL, + DISC_SNK_ASE_LC3); + define_test("BAP/UCL/DISC/BV-04-C", test_client, NULL, + DISC_SRC_ASE_LC3); } /* ATT: Write Command (0x52) len 23 * Handle: 0x0022 - * Data: 010101020206000000000_cfg + * Data: 0101010202_cfg * ATT: Handle Value Notification (0x1b) len 7 * Handle: 0x0022 * Data: 0101010000 * ATT: Handle Value Notification (0x1b) len 37 * Handle: 0x0016 - * Data: 01010102010a00204e00409c00204e00409c000600000000_cfg + * Data: 01010102010a00204e00409c00204e00409c00_cfg */ #define SCC_SNK(_cfg...) \ - DISC_SOURCE_ASE, \ - IOV_DATA(0x52, 0x22, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x06, 0x00, \ - 0x00, 0x00, 0x00, _cfg), \ + IOV_DATA(0x52, 0x22, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, _cfg), \ IOV_DATA(0x1b, 0x22, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00), \ IOV_NULL, \ IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x0a, 0x00, \ 0x20, 0x4e, 0x00, 0x40, 0x9c, 0x00, 0x20, 0x4e, 0x00, \ - 0x40, 0x9c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, _cfg) + 0x40, 0x9c, 0x00, _cfg) + +#define SCC_SNK_LC3(_cc...) \ + DISC_SRC_ASE_LC3, \ + SCC_SNK(0x06, 0x00, 0x00, 0x00, 0x00, _cc) #define QOS_BALANCED_2M \ { \ @@ -666,8 +722,8 @@ static struct test_config cfg_snk_8_1 = { }; #define SCC_SNK_8_1 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1a, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x1a, 0x00) static struct test_config cfg_snk_8_2 = { .cc = LC3_CONFIG_8_2, @@ -676,8 +732,8 @@ static struct test_config cfg_snk_8_2 = { }; #define SCC_SNK_8_2 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x04, 0x1e, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x1e, 0x00) static struct test_config cfg_snk_16_1 = { .cc = LC3_CONFIG_16_1, @@ -686,8 +742,8 @@ static struct test_config cfg_snk_16_1 = { }; #define SCC_SNK_16_1 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1e, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x1e, 0x00) static struct test_config cfg_snk_16_2 = { .cc = LC3_CONFIG_16_2, @@ -696,8 +752,8 @@ static struct test_config cfg_snk_16_2 = { }; #define SCC_SNK_16_2 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, 0x28, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x28, 0x00) static struct test_config cfg_snk_24_1 = { .cc = LC3_CONFIG_24_1, @@ -706,8 +762,8 @@ static struct test_config cfg_snk_24_1 = { }; #define SCC_SNK_24_1 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x00, 0x03, 0x04, 0x2d, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x2d, 0x00) static struct test_config cfg_snk_24_2 = { .cc = LC3_CONFIG_24_2, @@ -716,8 +772,8 @@ static struct test_config cfg_snk_24_2 = { }; #define SCC_SNK_24_2 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x01, 0x03, 0x04, 0x3c, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x3c, 0x00) static struct test_config cfg_snk_32_1 = { .cc = LC3_CONFIG_32_1, @@ -726,8 +782,8 @@ static struct test_config cfg_snk_32_1 = { }; #define SCC_SNK_32_1 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x00, 0x03, 0x04, 0x3c, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x3c, 0x00) static struct test_config cfg_snk_32_2 = { .cc = LC3_CONFIG_32_2, @@ -736,8 +792,8 @@ static struct test_config cfg_snk_32_2 = { }; #define SCC_SNK_32_2 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x01, 0x03, 0x04, 0x50, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x50, 0x00) static struct test_config cfg_snk_44_1 = { .cc = LC3_CONFIG_44_1, @@ -746,8 +802,8 @@ static struct test_config cfg_snk_44_1 = { }; #define SCC_SNK_44_1 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x00, 0x03, 0x04, 0x62, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x62, 0x00) static struct test_config cfg_snk_44_2 = { .cc = LC3_CONFIG_44_2, @@ -756,8 +812,8 @@ static struct test_config cfg_snk_44_2 = { }; #define SCC_SNK_44_2 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x01, 0x03, 0x04, 0x82, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x82, 0x00) static struct test_config cfg_snk_48_1 = { .cc = LC3_CONFIG_48_1, @@ -766,8 +822,8 @@ static struct test_config cfg_snk_48_1 = { }; #define SCC_SNK_48_1 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x4b, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x4b, 0x00) static struct test_config cfg_snk_48_2 = { .cc = LC3_CONFIG_48_2, @@ -776,8 +832,8 @@ static struct test_config cfg_snk_48_2 = { }; #define SCC_SNK_48_2 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x64, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x64, 0x00) static struct test_config cfg_snk_48_3 = { .cc = LC3_CONFIG_48_3, @@ -786,8 +842,8 @@ static struct test_config cfg_snk_48_3 = { }; #define SCC_SNK_48_3 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x5a, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x5a, 0x00) static struct test_config cfg_snk_48_4 = { .cc = LC3_CONFIG_48_4, @@ -796,8 +852,8 @@ static struct test_config cfg_snk_48_4 = { }; #define SCC_SNK_48_4 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x78, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x78, 0x00) static struct test_config cfg_snk_48_5 = { .cc = LC3_CONFIG_48_5, @@ -806,8 +862,8 @@ static struct test_config cfg_snk_48_5 = { }; #define SCC_SNK_48_5 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x75, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x75, 0x00) static struct test_config cfg_snk_48_6 = { .cc = LC3_CONFIG_48_6, @@ -816,28 +872,30 @@ static struct test_config cfg_snk_48_6 = { }; #define SCC_SNK_48_6 \ - SCC_SNK(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x9b, \ - 0x00) + SCC_SNK_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x9b, 0x00) /* ATT: Write Command (0x52) len 23 * Handle: 0x0022 - * Data: 010103020206000000000_cfg + * Data: 0101030202_cfg * ATT: Handle Value Notification (0x1b) len 7 * Handle: 0x0022 * Data: 0101030000 * ATT: Handle Value Notification (0x1b) len 37 * Handle: 0x001c - * Data: 03010102010a00204e00409c00204e00409c000600000000_cfg + * Data: 03010102010a00204e00409c00204e00409c00_cfg */ #define SCC_SRC(_cfg...) \ - DISC_SOURCE_ASE, \ - IOV_DATA(0x52, 0x22, 0x00, 0x01, 0x01, 0x03, 0x02, 0x02, 0x06, 0x00, \ - 0x00, 0x00, 0x00, _cfg), \ + IOV_DATA(0x52, 0x22, 0x00, 0x01, 0x01, 0x03, 0x02, 0x02, _cfg), \ IOV_DATA(0x1b, 0x22, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00), \ IOV_NULL, \ IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x01, 0x01, 0x02, 0x01, 0x0a, 0x00, \ 0x20, 0x4e, 0x00, 0x40, 0x9c, 0x00, 0x20, 0x4e, 0x00, \ - 0x40, 0x9c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, _cfg) + 0x40, 0x9c, 0x00, _cfg) + +#define SCC_SRC_LC3(_cc...) \ + DISC_SRC_ASE_LC3, \ + SCC_SRC(0x06, 0x00, 0x00, 0x00, 0x00, _cc) static struct test_config cfg_src_8_1 = { .cc = LC3_CONFIG_8_1, @@ -846,8 +904,8 @@ static struct test_config cfg_src_8_1 = { }; #define SCC_SRC_8_1 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1a, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x1a, 0x00) static struct test_config cfg_src_8_2 = { .cc = LC3_CONFIG_8_2, @@ -856,8 +914,8 @@ static struct test_config cfg_src_8_2 = { }; #define SCC_SRC_8_2 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x04, 0x1e, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x1e, 0x00) static struct test_config cfg_src_16_1 = { .cc = LC3_CONFIG_16_1, @@ -866,8 +924,8 @@ static struct test_config cfg_src_16_1 = { }; #define SCC_SRC_16_1 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03, 0x04, 0x1e, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x1e, 0x00) static struct test_config cfg_src_16_2 = { .cc = LC3_CONFIG_16_2, @@ -876,8 +934,8 @@ static struct test_config cfg_src_16_2 = { }; #define SCC_SRC_16_2 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, 0x28, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x28, 0x00) static struct test_config cfg_src_24_1 = { .cc = LC3_CONFIG_24_1, @@ -886,8 +944,8 @@ static struct test_config cfg_src_24_1 = { }; #define SCC_SRC_24_1 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x00, 0x03, 0x04, 0x2d, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x2d, 0x00) static struct test_config cfg_src_24_2 = { .cc = LC3_CONFIG_24_2, @@ -896,8 +954,8 @@ static struct test_config cfg_src_24_2 = { }; #define SCC_SRC_24_2 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x01, 0x03, 0x04, 0x3c, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x05, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x3c, 0x00) static struct test_config cfg_src_32_1 = { .cc = LC3_CONFIG_32_1, @@ -906,8 +964,8 @@ static struct test_config cfg_src_32_1 = { }; #define SCC_SRC_32_1 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x00, 0x03, 0x04, 0x3c, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x3c, 0x00) static struct test_config cfg_src_32_2 = { .cc = LC3_CONFIG_32_2, @@ -916,8 +974,8 @@ static struct test_config cfg_src_32_2 = { }; #define SCC_SRC_32_2 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x01, 0x03, 0x04, 0x50, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x06, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x50, 0x00) static struct test_config cfg_src_44_1 = { .cc = LC3_CONFIG_44_1, @@ -926,8 +984,8 @@ static struct test_config cfg_src_44_1 = { }; #define SCC_SRC_44_1 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x00, 0x03, 0x04, 0x62, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x62, 0x00) static struct test_config cfg_src_44_2 = { .cc = LC3_CONFIG_44_2, @@ -936,8 +994,8 @@ static struct test_config cfg_src_44_2 = { }; #define SCC_SRC_44_2 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x01, 0x03, 0x04, 0x82, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x07, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x82, 0x00) static struct test_config cfg_src_48_1 = { .cc = LC3_CONFIG_48_1, @@ -946,8 +1004,8 @@ static struct test_config cfg_src_48_1 = { }; #define SCC_SRC_48_1 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x4b, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x4b, 0x00) static struct test_config cfg_src_48_2 = { .cc = LC3_CONFIG_48_2, @@ -956,8 +1014,8 @@ static struct test_config cfg_src_48_2 = { }; #define SCC_SRC_48_2 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x64, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x64, 0x00) static struct test_config cfg_src_48_3 = { .cc = LC3_CONFIG_48_3, @@ -966,8 +1024,8 @@ static struct test_config cfg_src_48_3 = { }; #define SCC_SRC_48_3 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x5a, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x5a, 0x00) static struct test_config cfg_src_48_4 = { .cc = LC3_CONFIG_48_4, @@ -976,8 +1034,8 @@ static struct test_config cfg_src_48_4 = { }; #define SCC_SRC_48_4 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x78, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x78, 0x00) static struct test_config cfg_src_48_5 = { .cc = LC3_CONFIG_48_5, @@ -986,8 +1044,8 @@ static struct test_config cfg_src_48_5 = { }; #define SCC_SRC_48_5 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, 0x75, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x00, 0x03, 0x04, \ + 0x75, 0x00) static struct test_config cfg_src_48_6 = { .cc = LC3_CONFIG_48_6, @@ -996,8 +1054,33 @@ static struct test_config cfg_src_48_6 = { }; #define SCC_SRC_48_6 \ - SCC_SRC(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, 0x9b, \ - 0x00) + SCC_SRC_LC3(0x0a, 0x02, 0x01, 0x08, 0x02, 0x02, 0x01, 0x03, 0x04, \ + 0x9b, 0x00) + +static struct test_config cfg_snk_vs = { + .cc = IOV_NULL, + .qos = QOS_BALANCED_2M, + .snk = true, + .vs = true, +}; + +#define DISC_SRC_ASE_VS \ + DISC_SRC_ASE(0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00) + +#define SCC_SNK_VS \ + DISC_SRC_ASE_VS, \ + SCC_SNK(0xff, 0x01, 0x00, 0x01, 0x00, 0x00) + +static struct test_config cfg_src_vs = { + .cc = IOV_NULL, + .qos = QOS_BALANCED_2M, + .src = true, + .vs = true, +}; + +#define SCC_SRC_VS \ + DISC_SRC_ASE_VS, \ + SCC_SRC(0xff, 0x01, 0x00, 0x01, 0x00, 0x00) static void test_scc(void) { @@ -1079,6 +1162,21 @@ static void test_scc(void) SCC_SRC_48_5); define_test("BAP/UCL/SCC/BV-032-C", test_client, &cfg_src_48_6, SCC_SRC_48_6); + /* Test Purpose: + * Verify that a Unicast Client IUT can initiate a Config Codec + * operation for a vendor-specific codec. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic + * with the opcode set to 0x01 (Config Codec) and the specified + * parameters. The Codec_ID parameter is formatted with octet 0 set to + * 0xFF, octets 1–2 set to TSPX_VS_Company_ID, and octets 3–4 set to + * TSPX_VS_Codec_ID. + */ + define_test("BAP/UCL/SCC/BV-033-C", test_client, &cfg_snk_vs, + SCC_SNK_VS); + define_test("BAP/UCL/SCC/BV-034-C", test_client, &cfg_src_vs, + SCC_SRC_VS); } int main(int argc, char *argv[])