From patchwork Tue Apr 25 20:47:23 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: 13223793 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 64962C77B61 for ; Tue, 25 Apr 2023 20:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236239AbjDYUrf (ORCPT ); Tue, 25 Apr 2023 16:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjDYUre (ORCPT ); Tue, 25 Apr 2023 16:47:34 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C0D13F99 for ; Tue, 25 Apr 2023 13:47:33 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63b5465fc13so5052263b3a.3 for ; Tue, 25 Apr 2023 13:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455652; x=1685047652; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=CrG2MhT2z2SJPX4B7uDj5q7JMtwew5msulcQVSX1wpc=; b=qUtMzLuNUZfnVHuuxlfduel9JUGO5O3lEL8NQL5G6aTRcX4+IiZv66QMaCaKea/Dj8 c/7yf4IiMVZSB9QQV46hl07A+FV+l8MPpnpKJWExBeujhzHQYWM6R9Tp1Njn3EqyAiOG nqz+E/rDuEWBzzN9KmLP+o8zpwoBP498Xo5CD6OeF4ocZ6bqVTnGgyhFckOGSIRtJZfZ 2rv+eBqoK+KXI3c6G4Esw+v25EO+lUqIhgvIo/LZapqynVMuwfY/M8k0eHckg3ABZC43 WjAbHpHZjSFi73eDTxseQBMSJ5v34RybMFeVKmL110PCWPC2pqj5sbq7ZPefRnMarsDT 6dEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455652; x=1685047652; 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=CrG2MhT2z2SJPX4B7uDj5q7JMtwew5msulcQVSX1wpc=; b=FfuwR5YpQpkBBgzUHwPgvgOWfOYK0EVoUydOaHvNk5H3SWPYKoajvOes2k2vKQ8YVZ UJhECP4Z3tSv65amKR7ZGj+Xcr3nUUxBeqOuF3Iio36/W0MOO+hOb/0GFTtkD2ZGgSoe 2deK2zjNMSyCrQvGrQYfeOy+pRz0NZ7DihXyzPz/bLwuvQCsucFRVtHr9qClPdbnYNSS iJF25XIEBbE+PeNEb+ZpYu72MPiByoCTrrfolccM+CNdu0S/uBjyid7cgnC1xZc9co5e 3ZwW1BAcz+7WDoHnQ9A3htZlPpnqFsjxyxQgtPCH/2N6uvZqFDy8MhCblnEG8aAKF1ES NPHQ== X-Gm-Message-State: AAQBX9f/+Fq+/mtLgJ4NbvcnyzdGtZVFZY+8785+94PWpYMrEMrJkcSQ W6736p6mDWWPISgP8pbD+CHHsn0mxqg= X-Google-Smtp-Source: AKy350aOt0q9nQpPN+pPNs2dPFxnD0dR6AKs8Khwi990qm40dGz+sbD9kNMl4adlkazXWCQRF8e63A== X-Received: by 2002:a05:6a20:d806:b0:ef:c4f6:9122 with SMTP id iv6-20020a056a20d80600b000efc4f69122mr21060832pzb.24.1682455652244; Tue, 25 Apr 2023 13:47:32 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:30 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/7] media: Fix not storing Preferred Delay properly Date: Tue, 25 Apr 2023 13:47:23 -0700 Message-Id: <20230425204729.3943583-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 540e91bc6706..23c63f4172dd 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1477,11 +1477,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 Tue Apr 25 20:47:24 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: 13223794 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 5B999C6FD18 for ; Tue, 25 Apr 2023 20:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236246AbjDYUrh (ORCPT ); Tue, 25 Apr 2023 16:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjDYUrg (ORCPT ); Tue, 25 Apr 2023 16:47:36 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AC9313F99 for ; Tue, 25 Apr 2023 13:47:35 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-63b87d23729so5047360b3a.0 for ; Tue, 25 Apr 2023 13:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455654; x=1685047654; 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=aeNWUrnsQjLkKml+5ZPf2RhE3u/DteHD5gSzqGFneVg=; b=MqQcz5ATVJc0+JzCNpNH7hzOnPhlKMpHaz3xSsoK19eEwN1AApdc9uWXyQ4DsEXvOB oTtnXbS8D2O13MFyd70xhQiJDNGmq7ZgsBYVymgy1LrzNxpPGKwgUaEza3Z9zakYLgam Cyev4T0pm9/GIMXO0ELKgXujHr8BAVMM4eCH6K1nmPFsvgET6cM1YzDKcDwrlNw+ukUU suqN7lIcALJ6hqy/XAU6RI71z1obEo4y5ZBiseWzxgKWvugv06pA6ZJ3kArhj/+qVVzK ypDSRmUsL1/MyEwLvp8o3eIfi7Zal1wi8B0G4gIhR8v/FFYf1uEC/lRmFiyGN36MBm3v +Hzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455654; x=1685047654; 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=aeNWUrnsQjLkKml+5ZPf2RhE3u/DteHD5gSzqGFneVg=; b=afrfMP0tUtdV36QhJIWyPYgsVZrGOkzdHLwfMEOjFkO8I2IPP/FEBbiRi8r+BWd+7c ao4TaJu9iGGSAFagBNirCcW7uiWVOF2ZTRs60p/JbZTXUlCfT3GbAqDD549BG1AOukuR WBRaoeerTgRw3pKphwdY6DsSnjsU9L14xxulhOWnMrez01bg/5w96nXTaoND3+B7VYbB DdG1l06qrqGfUGavV0x1Ta4p8/Qn90Dm4nYblsMBR43JN7v0gXkz4Xo2LGtBKr7R+/13 WF5AOp+nw53fVr41cRpbc97JFw1/nzbIkoAzKggCiwA/DDE39N3H9xGa4ZfiwOQoGyG6 wSBA== X-Gm-Message-State: AAQBX9f1rVIpRlMPGzYOtrQnGdcK7FVAWKDa/+v+2XpOzuC3svUuSfqH 8Vrreeqdo+Dw3PeURs4KLVp5UwcGVVE= X-Google-Smtp-Source: AKy350YnF8JEByW0K6n2/CJ1GKlxuTnvopXta+lyYjT+9iqnq63MC+heBg+74aucinGHvMjFo8uWVw== X-Received: by 2002:a05:6a20:4410:b0:f3:4da0:a25d with SMTP id ce16-20020a056a20441000b000f34da0a25dmr14615859pzb.13.1682455654044; Tue, 25 Apr 2023 13:47:34 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:32 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/7] shared/bap: Fix crash detaching streams Date: Tue, 25 Apr 2023 13:47:24 -0700 Message-Id: <20230425204729.3943583-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425204729.3943583-1-luiz.dentz@gmail.com> References: <20230425204729.3943583-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 1fff7e0fd21f..f48cbdf5d6f9 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) { @@ -2716,14 +2731,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 Tue Apr 25 20:47:25 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: 13223795 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 DEBC3C77B71 for ; Tue, 25 Apr 2023 20:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236261AbjDYUrj (ORCPT ); Tue, 25 Apr 2023 16:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjDYUri (ORCPT ); Tue, 25 Apr 2023 16:47:38 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B963216188 for ; Tue, 25 Apr 2023 13:47:37 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2478485fd76so4351740a91.2 for ; Tue, 25 Apr 2023 13:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455656; x=1685047656; 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=/5N5EZhTa5djmxCSRk6kJoormzDIMuBsUEtyg0bX7eo=; b=QznwZI/aQbUHeH6zy3xWjd8w1q9U6jHOb11HEEkkNq5+46NdbK9pA3ll3MUFeGOZu5 a+NK0HHwNxWpo3sV9b8dRypLGTJNdWP7Gf7J8r6LDl1vTK5tRe7Hi0OooEnboaGUnhOw lQNpAa2dWC15R4VfnfsYx2akzd+94x3kXZ9NA0DPaClm3z7mLsfR0aZIgL+0vKHYBoC3 2hVfqqY/jt6VvFc/kkzs1CiASUUefmJtwU6rEsh1pjx4MBCt9jOumuigKmGsNUNlgtBN zuOO19PcfNPDiR5E5ColX6GWPU15DUgzKPbYaKp4rTbHleuKYYZGs9VnslcMf2pZLKrn 19uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455656; x=1685047656; 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=/5N5EZhTa5djmxCSRk6kJoormzDIMuBsUEtyg0bX7eo=; b=Dy3Bb2t+WW/BdaNu2DTgnatlQSuli85/Ay1StBU1epQI7PcP8ngB0c3DRtEzATbbbX Toe/RvQcR0Iu2OfTVlEI+x3J8+xB4tvy+f5S8qdtGW4z/xNTq38Y2hyZYHIJlRYJcCVS A2y6oLuBz4pma56I/5QjVcT4G78CFNAdvDeb3tJy7gDp/hq4iKW9gcy5gSfyGqQONhY8 yz8cGNs+4+lBzOTSZPwlsmBBkye75qDW3svdOxBg0T+aEtPBO9he0reN+9e2po8IC/I+ U7qGdkzy/HzyRjyD3vY7NLNbUKjmR8sPGpITUuD1g6YKvUB9JX5HsiNkZocY50uc3Wjd vUqg== X-Gm-Message-State: AAQBX9f8pm5CrfN5OiSDKYaTmS/fTwN2G1c1MrNAxJnrzsxeBfvJv4Jp 7b1WgXMpj5q3M22V8YYmo0YgT8pMxG8= X-Google-Smtp-Source: AKy350aTh93YE8BYCV4kFaf+M5tZ3g+R3FeBVlguE7oZM3NZKxbxs1XDqk6yS39PFwYbROwx0zqHjA== X-Received: by 2002:a17:90a:cf8f:b0:23d:e0e8:f453 with SMTP id i15-20020a17090acf8f00b0023de0e8f453mr17569854pju.38.1682455656419; Tue, 25 Apr 2023 13:47:36 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:35 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 3/7] share/bap: Fix not removing timeout on bap_free Date: Tue, 25 Apr 2023 13:47:25 -0700 Message-Id: <20230425204729.3943583-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425204729.3943583-1-luiz.dentz@gmail.com> References: <20230425204729.3943583-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 f48cbdf5d6f9..52878fcf0368 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2586,6 +2586,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 Tue Apr 25 20:47:26 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: 13223796 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 0BFA8C77B61 for ; Tue, 25 Apr 2023 20:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236263AbjDYUrl (ORCPT ); Tue, 25 Apr 2023 16:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjDYUrk (ORCPT ); Tue, 25 Apr 2023 16:47:40 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1B5616F29 for ; Tue, 25 Apr 2023 13:47:39 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-51f6461af24so4856479a12.2 for ; Tue, 25 Apr 2023 13:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455658; x=1685047658; 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=M1fVH05UK+25cK1gYaFdT+totsraj+m5CPd6Q6+pgQI0D471Q08HJxhq2hTj2p+EUl d2STdrmKPJOltqZ5yJwoCGbhUJdV+J2Adzc5QNeLpyQ+2e+GGQ0BzTfPc5D1OZsimvsa q/rU83NI0Om9hga/FS3m1tQP+7v6Ejx7C9cfiu0XaVwavW02m+CZluGk95i3a0+biOBu xBAMKChD4HTClxZRKOlKrLV8CBOaISRn6BVt9HQs99Vv9pkAKyZUXeYdOLkECjhjpsz3 SPPMHvmRU9xmUSbqs07Jhz/UjPSGj5DSIyJoEK6eY7LVTV8CFRdv+9fppTdNrZUQodMx bHHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455658; x=1685047658; 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=kx2TzRTCgnobGVXx9q5czpppl0nR/UqZGFsNM6NeGKKg4S3Q3ufMSPVFUWy62hkQVK VsCuKy88VWrIFD+AcwP7DAeZecYGLcTUbLj08+Yd8J8XEA0Dzx8sxBDK2CO7L1ZXeRXp rW4fILh7Z1bdpwuGLUQ46KApcXyR4HGigxNbD/OCDM1rGPc2wysriPhAaq6MM+iYw1QC Quj5wGP4b8YsG9iqttJfaLe2yI7IpIxiNrLJUSZiD4ds7XJG1BIdNm8iEfFIwKxxPH05 yULhpo1ArL/1kKleN3DK9Fmq6dFl6rUnBvmjw/tvwQeZFj54MUmAFl9FpPRhjThhGgor X5Kw== X-Gm-Message-State: AAQBX9ceuH9kkNgi26KMxX2vcpN76TyD7J8NDE8gQqRAlfHZKHvaMpvb e8PHUaI/i2Ubcrh7quW1m4ytqRiZdMM= X-Google-Smtp-Source: AKy350ZADk5WdAgd0l5ofvIg56w48GLQmJ3iSeLnQdhrz/reYt1JlovikQWYJk7QFToO50fzwWJLKQ== X-Received: by 2002:a17:90b:4d8a:b0:246:ac0b:9d45 with SMTP id oj10-20020a17090b4d8a00b00246ac0b9d45mr17733034pjb.18.1682455658384; Tue, 25 Apr 2023 13:47:38 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:37 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 4/7] shared/tester: Add support for NULL PDUs Date: Tue, 25 Apr 2023 13:47:26 -0700 Message-Id: <20230425204729.3943583-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425204729.3943583-1-luiz.dentz@gmail.com> References: <20230425204729.3943583-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 Tue Apr 25 20:47:27 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: 13223797 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 0AAB8C6FD18 for ; Tue, 25 Apr 2023 20:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236264AbjDYUrp (ORCPT ); Tue, 25 Apr 2023 16:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236279AbjDYUrm (ORCPT ); Tue, 25 Apr 2023 16:47:42 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD2D3146D3 for ; Tue, 25 Apr 2023 13:47:41 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-24762b39b0dso4543560a91.1 for ; Tue, 25 Apr 2023 13:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455661; x=1685047661; 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=PyJuAfdd0PCphtlEtD2kGWX3K6vfEm8PSzDy/C8YZhE=; b=Pyr8CkceIoWNPUdAVZMqDtETVbTta4q2PkQ1OtxQ1VSL+A8o74JA9dYWZYdighOvdZ MWgzPYabDmCbmmvOOFHpCApobz9MQgg0VENe1RcWMUTAd0ER8wY0rjPAZt9nykerN23v XFDiC95fzEJwTXlTygHkeA4n5qjkGUeyPVZSGoKe7MBb4aSuHTwKzjtGGh7R4K6AUBD9 Ag0bFqPctgcxI28X9yaEDmkU1AcVSMDFw1p3RBWLeEq9Tv5p29kL5w8KG8oBiyGq2tlt cDyFmQNyZA8WHtnoj/37UmGurABw92WzN1LkWPIX/qzLO4w9+Ju26U0+kCnJrMO9cJTA D0MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455661; x=1685047661; 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=PyJuAfdd0PCphtlEtD2kGWX3K6vfEm8PSzDy/C8YZhE=; b=U3xr4OPZTXyv9OsfJaP2lchzkqCZGAie1G/yy4XKQnDfExtQvP98qYxN14nBK8EQRu spa+teEzQxEVyJtuprpINulftY8Gf8iIgawtu46+tnHpzfNWSThOn4pf33VtWiNZbx9T LtvX9ZpdKCQpNoBVPwoJmKSGXVRauU5wfZOBw3zd7d/h4ZdfwoEbAAzI4Iuxczkm7MdS A/lKTIkRbYinEK7u253z1kNZWBfpzbnyCrCr87WSJOtYMlkXqAUU7hnmT+8J8C2RFtd3 JI4epJsGwE5istVSchnGlsiEU49nLAUwxOY3GgJXy6bN4nwCa/0LknMw3AxWY8Che/QN swSQ== X-Gm-Message-State: AAQBX9f29dBrp9Jt5wFs+4ZXYeh9Bz3/0OjLL5Kd5gNWPJOU/YLzi38x pEcUR/xjCNieNJsZwleXU52Fvouim2g= X-Google-Smtp-Source: AKy350ZFB/HFQyRXh3yBWHocvP/xgwLFh5Awl3eQw/Fnd/YV3Hcx2Kg8R/+2axUfFBUOvQ8r/j+6IQ== X-Received: by 2002:a17:90a:a904:b0:246:896a:408d with SMTP id i4-20020a17090aa90400b00246896a408dmr18444780pjq.14.1682455660664; Tue, 25 Apr 2023 13:47:40 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:39 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 5/7] shared/bap: Fix typo Date: Tue, 25 Apr 2023 13:47:27 -0700 Message-Id: <20230425204729.3943583-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425204729.3943583-1-luiz.dentz@gmail.com> References: <20230425204729.3943583-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 bd13abef9ce5..b080324f9525 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 Tue Apr 25 20:47:28 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: 13223798 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 2E754C6FD18 for ; Tue, 25 Apr 2023 20:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236270AbjDYUrs (ORCPT ); Tue, 25 Apr 2023 16:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236282AbjDYUrr (ORCPT ); Tue, 25 Apr 2023 16:47:47 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A64F16181 for ; Tue, 25 Apr 2023 13:47:44 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-517bdd9957dso4547659a12.1 for ; Tue, 25 Apr 2023 13:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455663; x=1685047663; 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=QX8TJDU1DWTuz8RSCsQLDCuChEO2cUW7waDO23eWvb3KGlsqVKsAoMILz+nqdV04kK qmBkOhxD/pmIT9AXOZ4rPmHSgJqxeR1rBJKiUoNrCrP5oHp2EsV3eV2FgkchAcGrsrtC N40ZXaC7SXEh83Vu8IVs3zjQVWDY6wf+zzYrKrk/fRVmLH4N4SOVIzEf+0htisONP6Uf bxMQuwfPZCzwYMhdmg+nkZAwAbptz+hLq+ROLLGx+OJCAZkZ/Vtbyog8FfuSohXb9ict Ni5oLyd9JJFIpDBza485/Y45PEy/JXQnpgcAkqgcJFoDUqEuqCvOX0+ubjIf/FV88rp7 RAUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455663; x=1685047663; 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=SHySLUnEIK7nbk5xRDUDsign19S3O0umItHxumQ05QNqfLxvfrJIRUHyE9x0rFQZ+k d4mpt65wKsNPcGp5fYCre+6ZHkjC32Dsmndfde2m+EzdLHRyGp0Sc0VBuEHJlIOj1BDk +6siNKmNf3tVzoC7Ccfv1GEeqEqR1frr+o5we0mlkcVgSCfyrkoE1LXR1SEcAWQEkMJh 3th+PzGmEBagnAxJVNF9qayMywHRraewoNIOOGCU4T/ueoVfiFIOWOWEFV5/uWECYi6A FgMAKalSmIKzRTFyI+m1xvjG1MylozLdKDR4Zr5e5B6ijtBa9lnaYnohYYGKObY2lLGH +sXg== X-Gm-Message-State: AAQBX9fG20YPqpIKsOzd6N5Gu5OOleB8e9Dk+kAi5h3o6Km45LKGlmyD Kq38UdylXtXupwmGkrKhhrcgmOGEwQk= X-Google-Smtp-Source: AKy350Z9dVIQUf17+rbfiVJ2H5G9gl1TISngH2xMogefScT0UIo3PVKf8baEDVdvU5gTitrnmG08Eg== X-Received: by 2002:a17:90a:d90e:b0:247:8b5f:59ce with SMTP id c14-20020a17090ad90e00b002478b5f59cemr18312642pjv.20.1682455662666; Tue, 25 Apr 2023 13:47:42 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:41 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 6/7] shared/lc3: Update configuration to use iovec Date: Tue, 25 Apr 2023 13:47:28 -0700 Message-Id: <20230425204729.3943583-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425204729.3943583-1-luiz.dentz@gmail.com> References: <20230425204729.3943583-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 Tue Apr 25 20:47:29 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: 13223799 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 456BAC6FD18 for ; Tue, 25 Apr 2023 20:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236287AbjDYUrv (ORCPT ); Tue, 25 Apr 2023 16:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236282AbjDYUrt (ORCPT ); Tue, 25 Apr 2023 16:47:49 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72F2317A28 for ; Tue, 25 Apr 2023 13:47:46 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1a52667955dso66809725ad.1 for ; Tue, 25 Apr 2023 13:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682455665; x=1685047665; 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=i/P8Ww+5kii9UXz87FPmtWjFzXs7cwSRzQQumK1FaM8=; b=F4gsMnK1X9bAscC7yME4Eot5ks8tBMefeTPpYvpVsm+9Mwgm2prPs6ba7jcY2cQJgl wdMFt0qC8ORYusFh1IIavgJzEELFhL9CV+p+6AWS/eysdHmgDdQAYHSWekz2t3SQ6rGk 19B39Of8sTPAeN8ntEmUIxAl0vnHLE3HkS09sOiJX93gIhrLnKkky9rHRm5vZKFDqIgK Yk6ddTSqzS6pXfpoRW/M5xXyz7f8AXNpSTL0OY12YJisIDx6qzTcu6LbIomVeB2Nb2+4 +pkivlXbKzIbEnDnZWs55HtdwiYEdgyZXIl0E4BS9eibuT1lXsPXuWPecgDkCXYZwxjw iX1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682455665; x=1685047665; 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=i/P8Ww+5kii9UXz87FPmtWjFzXs7cwSRzQQumK1FaM8=; b=kFv2Umx5RdVsMLDqvgj29iz11WGB4rWD9y0v8NbkVTOUVs+UQPwdTWQaRSXzManz5Q sklHMLAiCC6+Fj7a9C2aoZ5ubdkRqwWTOqfNs9DqgupdCQkyhSiDLQjYezZru+NFp3yP j1JSpU7GyXYgB3ou2e8lTNYSXR92qoywdTI/JU6gmr3z/SOB+G75K8PDpxJkbrITvB9t dAaeRHqFUenRnJ3PwZKtaSFYQY8apF82c/trrS6FHmI1+ztbPmPUmt/iQWIbQKN/tu+T lIpIlQPaN0+p/ix5Jo4ub9IvPpSsU5sRaL7GjRrSUNLFprM4Deg2tITdSwvrPtS2ATjE soTQ== X-Gm-Message-State: AAQBX9enW6ZlEwFJ8zMfV4Aj5rX98oG3ejdg9AmqPCm2gBmvBsJFv2dN yZwXfbAmidrYolPU+Ap6uSMeIZER6Is= X-Google-Smtp-Source: AKy350YDaPbRdjA3nw+e60pZtXWepksvZDCIbh8vJxr9Q5GGCAtTSMZpuappLvKpWmovCMeQ3HXqtA== X-Received: by 2002:a17:903:40cd:b0:1a8:1436:c892 with SMTP id t13-20020a17090340cd00b001a81436c892mr16762828pld.14.1682455664442; Tue, 25 Apr 2023 13:47:44 -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 o5-20020a17090aac0500b0024677263e36sm8247454pjq.43.2023.04.25.13.47.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 13:47:43 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 7/7] test-bap: Introduce SCC tests Date: Tue, 25 Apr 2023 13:47:29 -0700 Message-Id: <20230425204729.3943583-7-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425204729.3943583-1-luiz.dentz@gmail.com> References: <20230425204729.3943583-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 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 | 533 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 526 insertions(+), 7 deletions(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index afeefac84091..e4b1dcafd527 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,451 @@ 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) +{ + /* 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 +1081,7 @@ int main(int argc, char *argv[]) tester_init(&argc, &argv); test_disc(); + test_scc(); return tester_run(); }