From patchwork Fri Dec 1 22:38:54 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: 749224 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jcn+A2cr" Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D2BAD for ; Fri, 1 Dec 2023 14:39:05 -0800 (PST) Received: by mail-vs1-xe32.google.com with SMTP id ada2fe7eead31-464403cde83so920978137.1 for ; Fri, 01 Dec 2023 14:39:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470343; x=1702075143; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=4h6ikY50jNdfv+t4SGoqzVG8MtRln2TReTJFy2w9zG8=; b=jcn+A2cr0XmenQ9C8nfdjXyoGDT3om1VZUFuoKuAz+M5wm9QO/sbdfHzID+aO3rWIS gySkHGqkHPQfxrwnu5S/+itY2463yYWJYVBauygitvOu4v/dIs6rJNPy6NjQZd+/lkrv zecf2OEUbcxn6X2TjB/WUaeDkutOeqFTZzpBhOf3oQu6QwBTimw9Va7Ly+hN9taO0QIx jxEuvDj9M6A4ARNTugHrpdLuX5LGfhd6lC84hrCIUfOd36tiikjZCjKw7eHSg4TjYLLa Iuf2mwDIYpOIe2MoWFltTWAzEvQN+QLES96vM0kbjCRrjOVWNWGoxuBLlhmzyZaUUsnd a9CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470343; x=1702075143; 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=4h6ikY50jNdfv+t4SGoqzVG8MtRln2TReTJFy2w9zG8=; b=Z5JaYxHTKvT/5aoE/76hoPkTe0gaS1P87L9EYGWai2b6yAf/7wN+zxNAAa7HXnRePR SldD3GcdYb+vazyPtl4mxyosKtNPe0Uocm10lA9fmC5jcrx862FKONU+HeS7K4VN3yxj 8/Xyk2JERrjySpXBMzma5K4v427v3L7EUqjVALvfzJ8WkRrAVpLibrD656EEr5+HwUTB 68fIjz7m63B6saZRpreNfDqXhEW7YNjUoHVS+3JSYOHXl0TESy+IUGft3McUdVYkgBY3 opU0x7kYTDFRFPRREv3rdd2I+BPH4QG7pqIu3q9tKGsW6zAdWSnXcRFKvzwTmRLZmCE/ 9Ryg== X-Gm-Message-State: AOJu0Yz7VkVwwv1wieFmMYDhpl2oaAfVNuUeR0ROy7RPse1zEmo1Lza4 WMKpf5L5+EiDae9ywKfBTgd1d195ZmKWYA== X-Google-Smtp-Source: AGHT+IErs4W5QMHp0v1EUqySI6feVhRGtv7Js6Q+MLNQ0mjQJgV8Tn6o6jajHzMyeWV14eMIp8TDlg== X-Received: by 2002:a67:ce06:0:b0:464:41b9:f800 with SMTP id s6-20020a67ce06000000b0046441b9f800mr240393vsl.34.1701470343046; Fri, 01 Dec 2023 14:39:03 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:01 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 1/7] shared/lc3: Add QoS definitions Date: Fri, 1 Dec 2023 17:38:54 -0500 Message-ID: <20231201223900.2498565-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz This adds the QoS preset definitions as per BAP specification. --- src/shared/lc3.h | 153 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/src/shared/lc3.h b/src/shared/lc3.h index ae193f9e2fa7..e6b043699bc1 100644 --- a/src/shared/lc3.h +++ b/src/shared/lc3.h @@ -155,3 +155,156 @@ #define LC3_CONFIG_48_6 \ LC3_CONFIG_48(LC3_CONFIG_DURATION_10, 155u) + +#define LC3_QOS_UNFRAMED 0x00 +#define LC3_QOS_FRAMED 0x01 + +#define LC3_QOS_UCAST(_frame, _pd, _t_lat, _interval, _lat, _sdu, _rtn) \ +{ \ + .ucast.cig_id = 0x00, \ + .ucast.cis_id = 0x00, \ + .ucast.delay = _pd, \ + .ucast.target_latency = _t_lat, \ + .ucast.io_qos.interval = _interval, \ + .ucast.io_qos.latency = _lat, \ + .ucast.io_qos.sdu = _sdu, \ + .ucast.io_qos.phy = BT_BAP_CONFIG_PHY_2M, \ + .ucast.io_qos.rtn = _rtn, \ +} + +#define LC3_QOS_UCAST_7_5_UNFRAMED(_pd, _t_lat, _lat, _sdu, _rtn) \ + LC3_QOS_UCAST(LC3_QOS_UNFRAMED, _pd, _t_lat, 7500u, _lat, _sdu, _rtn) + +#define LC3_QOS_UCAST_10_UNFRAMED(_pd, _t_lat, _lat, _sdu, _rtn) \ + LC3_QOS_UCAST(LC3_QOS_UNFRAMED, _pd, _t_lat, 10000u, _lat, _sdu, _rtn) + +#define LC3_QOS_UCAST_FRAMED(_pd, _t_lat, _interval, _lat, _sdu, _rtn) \ + LC3_QOS_UCAST(LC3_QOS_FRAMED, _pd, _t_lat, _interval, _lat, _sdu, _rtn) + +#define LC3_QOS_8_1_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 8u, 26u, 2u) + +#define LC3_QOS_8_1_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 26u, 13u) + +#define LC3_QOS_8_2_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 10u, 30u, 2u) + +#define LC3_QOS_8_2_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 95u, 30u, 13u) + +#define LC3_QOS_16_1_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 8u, 30u, 2u) + +#define LC3_QOS_16_1_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 30u, 13u) + +#define LC3_QOS_16_2_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 10u, 40u, 2u) + +#define LC3_QOS_16_2_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 95u, 40u, 13u) + +#define LC3_QOS_24_1_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 8u, 45u, 2u) + +#define LC3_QOS_24_1_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 45u, 13u) + +#define LC3_QOS_24_2_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 10u, 60u, 2u) + +#define LC3_QOS_24_2_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 95u, 60u, 13u) + +#define LC3_QOS_32_1_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 8u, 60u, 2u) + +#define LC3_QOS_32_1_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 60u, 13u) + +#define LC3_QOS_32_2_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 10u, 80u, 2u) + +#define LC3_QOS_32_2_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 95u, 80u, 13u) + +#define LC3_QOS_44_1_1 \ + LC3_QOS_UCAST_FRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 8163u, 24u, 98u, 5u) + +#define LC3_QOS_44_1_2 \ + LC3_QOS_UCAST_FRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 8163u, 80u, 98u, 13u) + +#define LC3_QOS_44_2_1 \ + LC3_QOS_UCAST_FRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 10884u, 31u, 130u, 5u) + +#define LC3_QOS_44_2_2 \ + LC3_QOS_UCAST_FRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 10884u, 85u, 130u, 13u) + +#define LC3_QOS_48_1_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 15u, 75u, 5u) + +#define LC3_QOS_48_1_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 75u, 13u) + +#define LC3_QOS_48_2_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 20u, 100u, 5u) + +#define LC3_QOS_48_2_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 95u, 100u, 13u) + +#define LC3_QOS_48_3_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 15u, 90u, 5u) + +#define LC3_QOS_48_3_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 90u, 13u) + +#define LC3_QOS_48_4_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 20u, 120u, 5u) + +#define LC3_QOS_48_4_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 100u, 120u, 13u) + +#define LC3_QOS_48_5_1 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 15u, 117u, 5u) + +#define LC3_QOS_48_5_2 \ + LC3_QOS_UCAST_7_5_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 75u, 117u, 13u) + +#define LC3_QOS_48_6_1 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 20u, 155u, 5u) + +#define LC3_QOS_48_6_2 \ + LC3_QOS_UCAST_10_UNFRAMED(40000u, BT_BAP_CONFIG_LATENCY_BALANCED, \ + 100u, 155u, 13u) From patchwork Fri Dec 1 22:38:55 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: 749889 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZHhU3w/4" Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FCC2AD for ; Fri, 1 Dec 2023 14:39:08 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-423c28db22eso31307921cf.1 for ; Fri, 01 Dec 2023 14:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470346; x=1702075146; darn=vger.kernel.org; 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=t38I7isXqv/ES50wHXw9PxvfK4JUo5+b4s5BEI76vRc=; b=ZHhU3w/4OG6wXajQlTkykV9i9N9kQ8ZoU0SQ0TS/whxT/dub3NfRpcLRIhWMY0JqYy xIu/IBnphkexLeBZb+YLVFp/Eh8RnxMPTDATt5h1y81vyioy7+p9GJYMfcgUoOfZkM4e n8tSvi+HOjBa09Kt3hIogtT7p/o3FdOntn3NTHGkR+t2o3z3KR9guLixFMJxubyNNE3Y RG4l5rNEGI4NlqL40EZk91xN6d1qkWJwrZxNOli1IjZkBS60mkBoQw6t7oyGWF/1ACgL qXwxjo6cQjnzKoGoOLwdIQBPPmHjObZ0kNuhsKG0lKFVpRAEjJv58iqcW7MyZrDUbvct nY2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470346; x=1702075146; 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=t38I7isXqv/ES50wHXw9PxvfK4JUo5+b4s5BEI76vRc=; b=sZULZ50AgJwaKA2/jdXfSNl9JBh/k9WbnVZgFp285B4+LYNvo9oEyA+Om9DufGtcff BnV4k3zIovsNTTu/8Eu6dSMNBEdCIR1fwlHjooJzfi9exgcqJDaW64UiGeVYS6fwKC1e BHWa5h1wdww2aiShYosKfa1+B9DaY1f0X9ODfhzPgEK3oUOj9pvaPZyH5WtnTdFTOLqB NZZDj5Cts5ULDmQSDUUGHp/RM8XLlb6BszQgb927O2nZyZDPMVI1DeIyg8R58dXouSxl qIhDDSc+Mi3335mkhYq4/nNCqtPNlLL6v5/8Ud/OmC+MAoJNZSmM9l9ljhu2fdGZZEI2 BMVQ== X-Gm-Message-State: AOJu0YzN0kU+j8uMym9kabejbV3E8X2MQ64H7FgEnDnnBIRUH8xz2LAb 1+QGAIPvmlPV4ANT8Yj6sfF4VZX4YCQvwA== X-Google-Smtp-Source: AGHT+IGzQ4HwrxtnxTyYNupWQUTgYsP2q1P4Fq3R1nYhHLppSKRm6wdjVk/7NBfje+yZFEixFpE89Q== X-Received: by 2002:a05:6214:2b50:b0:67a:a814:969a with SMTP id jy16-20020a0562142b5000b0067aa814969amr123129qvb.51.1701470345608; Fri, 01 Dec 2023 14:39:05 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:03 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 2/7] test-bap: Introduce QoS tests for LC3 Date: Fri, 1 Dec 2023 17:38:55 -0500 Message-ID: <20231201223900.2498565-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201223900.2498565-1-luiz.dentz@gmail.com> References: <20231201223900.2498565-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 4.8.3 Unicast Client Initiates Config QoS – LC3 (Page 43) Test Purpose: Verify that a Unicast Client IUT can initiate a Config QoS operation for the LC3 codec. Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x02 (Config QoS) and the specified parameters. Test Summary ------------ BAP/UCL/SCC/BV-035-C [UCL SRC Config QoS, LC3 8_1_1] Passed BAP/UCL/SCC/BV-036-C [UCL SRC Config QoS, LC3 8_2_1] Passed BAP/UCL/SCC/BV-037-C [UCL SRC Config QoS, LC3 16_1_1] Passed BAP/UCL/SCC/BV-038-C [UCL SRC Config QoS, LC3 16_2_1] Passed BAP/UCL/SCC/BV-039-C [UCL SRC Config QoS, LC3 24_1_1] Passed BAP/UCL/SCC/BV-040-C [UCL SRC Config QoS, LC3 24_2_1] Passed BAP/UCL/SCC/BV-041-C [UCL SRC Config QoS, LC3 32_1_1] Passed BAP/UCL/SCC/BV-042-C [UCL SRC Config QoS, LC3 32_2_1] Passed BAP/UCL/SCC/BV-043-C [UCL SRC Config QoS, LC3 44.1_1_1] Passed BAP/UCL/SCC/BV-044-C [UCL SRC Config QoS, LC3 44.1_2_1] Passed BAP/UCL/SCC/BV-045-C [UCL SRC Config QoS, LC3 48_1_1] Passed BAP/UCL/SCC/BV-046-C [UCL SRC Config QoS, LC3 48_2_1] Passed BAP/UCL/SCC/BV-047-C [UCL SRC Config QoS, LC3 48_3_1] Passed BAP/UCL/SCC/BV-048-C [UCL SRC Config QoS, LC3 48_4_1] Passed BAP/UCL/SCC/BV-049-C [UCL SRC Config QoS, LC3 48_5_1] Passed BAP/UCL/SCC/BV-050-C [UCL SRC Config QoS, LC3 48_6_1] Passed BAP/UCL/SCC/BV-051-C [UCL SNK Config QoS, LC3 8_1_1] Passed BAP/UCL/SCC/BV-052-C [UCL SNK Config QoS, LC3 8_2_1] Passed BAP/UCL/SCC/BV-053-C [UCL SNK Config QoS, LC3 16_1_1] Passed BAP/UCL/SCC/BV-054-C [UCL SNK Config QoS, LC3 16_2_1] Passed BAP/UCL/SCC/BV-055-C [UCL SNK Config QoS, LC3 24_1_1] Passed BAP/UCL/SCC/BV-056-C [UCL SNK Config QoS, LC3 24_2_1] Passed BAP/UCL/SCC/BV-057-C [UCL SNK Config QoS, LC3 32_1_1] Passed BAP/UCL/SCC/BV-058-C [UCL SNK Config QoS, LC3 32_2_1] Passed BAP/UCL/SCC/BV-059-C [UCL SNK Config QoS, LC3 44.1_1_1] Passed BAP/UCL/SCC/BV-060-C [UCL SNK Config QoS, LC3 44.1_2_1] Passed BAP/UCL/SCC/BV-061-C [UCL SNK Config QoS, LC3 48_1_1] Passed BAP/UCL/SCC/BV-062-C [UCL SNK Config QoS, LC3 48_2_1] Passed BAP/UCL/SCC/BV-063-C [UCL SNK Config QoS, LC3 48_3_1] Passed BAP/UCL/SCC/BV-064-C [UCL SNK Config QoS, LC3 48_4_1] Passed BAP/UCL/SCC/BV-065-C [UCL SNK Config QoS, LC3 48_5_1] Passed BAP/UCL/SCC/BV-066-C [UCL SNK Config QoS, LC3 48_6_1] Passed BAP/UCL/SCC/BV-067-C [UCL SRC Config QoS, LC3 8_1_2] Passed BAP/UCL/SCC/BV-068-C [UCL SRC Config QoS, LC3 8_2_2] Passed BAP/UCL/SCC/BV-069-C [UCL SRC Config QoS, LC3 16_1_2] Passed BAP/UCL/SCC/BV-070-C [UCL SRC Config QoS, LC3 16_2_2] Passed BAP/UCL/SCC/BV-071-C [UCL SRC Config QoS, LC3 24_1_2] Passed BAP/UCL/SCC/BV-072-C [UCL SRC Config QoS, LC3 24_2_2] Passed BAP/UCL/SCC/BV-073-C [UCL SRC Config QoS, LC3 32_1_2] Passed BAP/UCL/SCC/BV-074-C [UCL SRC Config QoS, LC3 32_2_2] Passed BAP/UCL/SCC/BV-075-C [UCL SRC Config QoS, LC3 44.1_1_2] Passed BAP/UCL/SCC/BV-076-C [UCL SRC Config QoS, LC3 44.1_2_2] Passed BAP/UCL/SCC/BV-077-C [UCL SRC Config QoS, LC3 48_1_2] Passed BAP/UCL/SCC/BV-078-C [UCL SRC Config QoS, LC3 48_2_2] Passed BAP/UCL/SCC/BV-079-C [UCL SRC Config QoS, LC3 48_3_2] Passed BAP/UCL/SCC/BV-080-C [UCL SRC Config QoS, LC3 48_4_2] Passed BAP/UCL/SCC/BV-081-C [UCL SRC Config QoS, LC3 48_5_2] Passed BAP/UCL/SCC/BV-082-C [UCL SRC Config QoS, LC3 48_6_2] Passed BAP/UCL/SCC/BV-083-C [UCL SNK Config QoS, LC3 8_1_2] Passed BAP/UCL/SCC/BV-084-C [UCL SNK Config QoS, LC3 8_2_2] Passed BAP/UCL/SCC/BV-085-C [UCL SNK Config QoS, LC3 16_1_2] Passed BAP/UCL/SCC/BV-086-C [UCL SNK Config QoS, LC3 16_2_2] Passed BAP/UCL/SCC/BV-087-C [UCL SNK Config QoS, LC3 24_1_2] Passed BAP/UCL/SCC/BV-088-C [UCL SNK Config QoS, LC3 24_2_2] Passed BAP/UCL/SCC/BV-089-C [UCL SNK Config QoS, LC3 32_1_2] Passed BAP/UCL/SCC/BV-090-C [UCL SNK Config QoS, LC3 32_2_2] Passed BAP/UCL/SCC/BV-091-C [UCL SNK Config QoS, LC3 44.1_1_2] Passed BAP/UCL/SCC/BV-092-C [UCL SNK Config QoS, LC3 44.1_2_2] Passed BAP/UCL/SCC/BV-093-C [UCL SNK Config QoS, LC3 48_1_2] Passed BAP/UCL/SCC/BV-094-C [UCL SNK Config QoS, LC3 48_2_2] Passed BAP/UCL/SCC/BV-095-C [UCL SNK Config QoS, LC3 48_3_2] Passed BAP/UCL/SCC/BV-096-C [UCL SNK Config QoS, LC3 48_4_2] Passed BAP/UCL/SCC/BV-097-C [UCL SNK Config QoS, LC3 48_5_2] Passed BAP/UCL/SCC/BV-098-C [UCL SNK Config QoS, LC3 48_6_2] Passed Total: 64, Passed: 64 (100.0%), Failed: 0, Not Run: 0 --- unit/test-bap.c | 964 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 963 insertions(+), 1 deletion(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index adade07dbe9e..303388e35c14 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -39,6 +39,7 @@ struct test_config { bool snk; bool src; bool vs; + uint8_t state; }; struct test_data { @@ -334,7 +335,7 @@ static void test_complete_cb(const void *user_data) tester_test_passed(); } -static void bap_config(struct bt_bap_stream *stream, +static void bap_qos(struct bt_bap_stream *stream, uint8_t code, uint8_t reason, void *user_data) { @@ -342,6 +343,26 @@ static void bap_config(struct bt_bap_stream *stream, tester_test_failed(); } +static void bap_config(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + struct test_data *data = user_data; + + if (code) { + tester_test_failed(); + return; + } + + if (data->cfg->state > BT_BAP_STREAM_STATE_CONFIG) { + unsigned int qos_id; + + qos_id = bt_bap_stream_qos(data->stream, &data->cfg->qos, + bap_qos, data); + g_assert(qos_id); + } +} + static bool pac_found(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac, void *user_data) { @@ -1185,10 +1206,951 @@ static void test_scc_cc_vs(void) test_client, &cfg_src_vs, SCC_SRC_VS); } +static struct test_config cfg_snk_8_1_1 = { + .cc = LC3_CONFIG_8_1, + .qos = LC3_QOS_8_1_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_8_2_1 = { + .cc = LC3_CONFIG_8_2, + .qos = LC3_QOS_8_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_16_1_1 = { + .cc = LC3_CONFIG_16_1, + .qos = LC3_QOS_16_1_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_16_2_1 = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_24_1_1 = { + .cc = LC3_CONFIG_24_1, + .qos = LC3_QOS_24_1_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_24_2_1 = { + .cc = LC3_CONFIG_24_2, + .qos = LC3_QOS_24_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_32_1_1 = { + .cc = LC3_CONFIG_32_1, + .qos = LC3_QOS_32_1_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_32_2_1 = { + .cc = LC3_CONFIG_32_2, + .qos = LC3_QOS_32_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_44_1_1 = { + .cc = LC3_CONFIG_44_1, + .qos = LC3_QOS_44_1_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_44_2_1 = { + .cc = LC3_CONFIG_44_2, + .qos = LC3_QOS_44_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_1_1 = { + .cc = LC3_CONFIG_48_1, + .qos = LC3_QOS_48_1_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_2_1 = { + .cc = LC3_CONFIG_48_2, + .qos = LC3_QOS_48_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_3_1 = { + .cc = LC3_CONFIG_48_3, + .qos = LC3_QOS_48_3_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_4_1 = { + .cc = LC3_CONFIG_48_4, + .qos = LC3_QOS_48_4_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_5_1 = { + .cc = LC3_CONFIG_48_5, + .qos = LC3_QOS_48_5_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_6_1 = { + .cc = LC3_CONFIG_48_6, + .qos = LC3_QOS_48_6_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 02010000_qos + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0201010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 01010102010a00204e00409c00204e00409c00_qos + */ +#define QOS_SNK(_qos...) \ + IOV_DATA(0x52, 0x22, 0x00, 0x02, 0x01, 0x01, 0x00, 0x00, _qos), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x02, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x02, 0x00, 0x00, _qos) + +#define SCC_SNK_8_1_1 \ + SCC_SNK_8_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1a, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_8_2_1 \ + SCC_SNK_8_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_16_1_1 \ + SCC_SNK_16_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_16_2_1 \ + SCC_SNK_16_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x28, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_24_1_1 \ + SCC_SNK_24_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x2d, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_24_2_1 \ + SCC_SNK_24_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_32_1_1 \ + SCC_SNK_32_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_32_2_1 \ + SCC_SNK_32_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x50, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_44_1_1 \ + SCC_SNK_44_1, \ + QOS_SNK(0xe3, 0x1f, 0x00, 0x00, 0x02, 0x62, 0x00, 0x05, 0x18, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_44_2_1 \ + SCC_SNK_44_2, \ + QOS_SNK(0x84, 0x2a, 0x00, 0x00, 0x02, 0x82, 0x00, 0x05, 0x1f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_1_1 \ + SCC_SNK_48_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x4b, 0x00, 0x05, 0x0f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_2_1 \ + SCC_SNK_48_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x64, 0x00, 0x05, 0x14, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_3_1 \ + SCC_SNK_48_3, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x5a, 0x00, 0x05, 0x0f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_4_1 \ + SCC_SNK_48_4, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x78, 0x00, 0x05, 0x14, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_5_1 \ + SCC_SNK_48_5, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x75, 0x00, 0x05, 0x0f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_6_1 \ + SCC_SNK_48_6, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x9b, 0x00, 0x05, 0x14, 0x00, \ + 0x40, 0x9c, 0x00) + +static struct test_config cfg_src_8_1_1 = { + .cc = LC3_CONFIG_8_1, + .qos = LC3_QOS_8_1_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_8_2_1 = { + .cc = LC3_CONFIG_8_2, + .qos = LC3_QOS_8_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_16_1_1 = { + .cc = LC3_CONFIG_16_1, + .qos = LC3_QOS_16_1_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_16_2_1 = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_24_1_1 = { + .cc = LC3_CONFIG_24_1, + .qos = LC3_QOS_24_1_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_24_2_1 = { + .cc = LC3_CONFIG_24_2, + .qos = LC3_QOS_24_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_32_1_1 = { + .cc = LC3_CONFIG_32_1, + .qos = LC3_QOS_32_1_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_32_2_1 = { + .cc = LC3_CONFIG_32_2, + .qos = LC3_QOS_32_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_44_1_1 = { + .cc = LC3_CONFIG_44_1, + .qos = LC3_QOS_44_1_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_44_2_1 = { + .cc = LC3_CONFIG_44_2, + .qos = LC3_QOS_44_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_1_1 = { + .cc = LC3_CONFIG_48_1, + .qos = LC3_QOS_48_1_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_2_1 = { + .cc = LC3_CONFIG_48_2, + .qos = LC3_QOS_48_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_3_1 = { + .cc = LC3_CONFIG_48_3, + .qos = LC3_QOS_48_3_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_4_1 = { + .cc = LC3_CONFIG_48_4, + .qos = LC3_QOS_48_4_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_5_1 = { + .cc = LC3_CONFIG_48_5, + .qos = LC3_QOS_48_5_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_6_1 = { + .cc = LC3_CONFIG_48_6, + .qos = LC3_QOS_48_6_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 02030000_qos + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0201030000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x001c + * Data: 03010102010a00204e00409c00204e00409c00_qos + */ +#define QOS_SRC(_qos...) \ + IOV_DATA(0x52, 0x22, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, _qos), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x02, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x02, 0x00, 0x00, _qos) + +#define SCC_SRC_8_1_1 \ + SCC_SRC_8_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1a, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_8_2_1 \ + SCC_SRC_8_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_16_1_1 \ + SCC_SRC_16_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_16_2_1 \ + SCC_SRC_16_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x28, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_24_1_1 \ + SCC_SRC_24_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x2d, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_24_2_1 \ + SCC_SRC_24_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_32_1_1 \ + SCC_SRC_32_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x02, 0x08, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_32_2_1 \ + SCC_SRC_32_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x50, 0x00, 0x02, 0x0a, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_44_1_1 \ + SCC_SRC_44_1, \ + QOS_SRC(0xe3, 0x1f, 0x00, 0x00, 0x02, 0x62, 0x00, 0x05, 0x18, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_44_2_1 \ + SCC_SRC_44_2, \ + QOS_SRC(0x84, 0x2a, 0x00, 0x00, 0x02, 0x82, 0x00, 0x05, 0x1f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_1_1 \ + SCC_SRC_48_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x4b, 0x00, 0x05, 0x0f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_2_1 \ + SCC_SRC_48_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x64, 0x00, 0x05, 0x14, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_3_1 \ + SCC_SRC_48_3, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x5a, 0x00, 0x05, 0x0f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_4_1 \ + SCC_SRC_48_4, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x78, 0x00, 0x05, 0x14, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_5_1 \ + SCC_SRC_48_5, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x75, 0x00, 0x05, 0x0f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_6_1 \ + SCC_SRC_48_6, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x9b, 0x00, 0x05, 0x14, 0x00, \ + 0x40, 0x9c, 0x00) + +static struct test_config cfg_snk_8_1_2 = { + .cc = LC3_CONFIG_8_1, + .qos = LC3_QOS_8_1_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_8_2_2 = { + .cc = LC3_CONFIG_8_2, + .qos = LC3_QOS_8_2_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_16_1_2 = { + .cc = LC3_CONFIG_16_1, + .qos = LC3_QOS_16_1_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_16_2_2 = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_24_1_2 = { + .cc = LC3_CONFIG_24_1, + .qos = LC3_QOS_24_1_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_24_2_2 = { + .cc = LC3_CONFIG_24_2, + .qos = LC3_QOS_24_2_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_32_1_2 = { + .cc = LC3_CONFIG_32_1, + .qos = LC3_QOS_32_1_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_32_2_2 = { + .cc = LC3_CONFIG_32_2, + .qos = LC3_QOS_32_2_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_44_1_2 = { + .cc = LC3_CONFIG_44_1, + .qos = LC3_QOS_44_1_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_44_2_2 = { + .cc = LC3_CONFIG_44_2, + .qos = LC3_QOS_44_2_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_1_2 = { + .cc = LC3_CONFIG_48_1, + .qos = LC3_QOS_48_1_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_2_2 = { + .cc = LC3_CONFIG_48_2, + .qos = LC3_QOS_48_2_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_3_2 = { + .cc = LC3_CONFIG_48_3, + .qos = LC3_QOS_48_3_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_4_2 = { + .cc = LC3_CONFIG_48_4, + .qos = LC3_QOS_48_4_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_5_2 = { + .cc = LC3_CONFIG_48_5, + .qos = LC3_QOS_48_5_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_snk_48_6_2 = { + .cc = LC3_CONFIG_48_6, + .qos = LC3_QOS_48_6_2, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +#define SCC_SNK_8_1_2 \ + SCC_SNK_8_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1a, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_8_2_2 \ + SCC_SNK_8_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_16_1_2 \ + SCC_SNK_16_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_16_2_2 \ + SCC_SNK_16_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x28, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_24_1_2 \ + SCC_SNK_24_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x2d, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_24_2_2 \ + SCC_SNK_24_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_32_1_2 \ + SCC_SNK_32_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_32_2_2 \ + SCC_SNK_32_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x50, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_44_1_2 \ + SCC_SNK_44_1, \ + QOS_SNK(0xe3, 0x1f, 0x00, 0x00, 0x02, 0x62, 0x00, 0x0d, 0x50, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_44_2_2 \ + SCC_SNK_44_2, \ + QOS_SNK(0x84, 0x2a, 0x00, 0x00, 0x02, 0x82, 0x00, 0x0d, 0x55, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_1_2 \ + SCC_SNK_48_1, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x4b, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_2_2 \ + SCC_SNK_48_2, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x64, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_3_2 \ + SCC_SNK_48_3, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x5a, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_4_2 \ + SCC_SNK_48_4, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x78, 0x00, 0x0d, 0x64, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_5_2 \ + SCC_SNK_48_5, \ + QOS_SNK(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x75, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SNK_48_6_2 \ + SCC_SNK_48_6, \ + QOS_SNK(0x10, 0x27, 0x00, 0x00, 0x02, 0x9b, 0x00, 0x0d, 0x64, 0x00, \ + 0x40, 0x9c, 0x00) + +static struct test_config cfg_src_8_1_2 = { + .cc = LC3_CONFIG_8_1, + .qos = LC3_QOS_8_1_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_8_2_2 = { + .cc = LC3_CONFIG_8_2, + .qos = LC3_QOS_8_2_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_16_1_2 = { + .cc = LC3_CONFIG_16_1, + .qos = LC3_QOS_16_1_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_16_2_2 = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_24_1_2 = { + .cc = LC3_CONFIG_24_1, + .qos = LC3_QOS_24_1_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_24_2_2 = { + .cc = LC3_CONFIG_24_2, + .qos = LC3_QOS_24_2_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_32_1_2 = { + .cc = LC3_CONFIG_32_1, + .qos = LC3_QOS_32_1_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_32_2_2 = { + .cc = LC3_CONFIG_32_2, + .qos = LC3_QOS_32_2_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_44_1_2 = { + .cc = LC3_CONFIG_44_1, + .qos = LC3_QOS_44_1_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_44_2_2 = { + .cc = LC3_CONFIG_44_2, + .qos = LC3_QOS_44_2_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_1_2 = { + .cc = LC3_CONFIG_48_1, + .qos = LC3_QOS_48_1_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_2_2 = { + .cc = LC3_CONFIG_48_2, + .qos = LC3_QOS_48_2_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_3_2 = { + .cc = LC3_CONFIG_48_3, + .qos = LC3_QOS_48_3_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_4_2 = { + .cc = LC3_CONFIG_48_4, + .qos = LC3_QOS_48_4_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_5_2 = { + .cc = LC3_CONFIG_48_5, + .qos = LC3_QOS_48_5_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +static struct test_config cfg_src_48_6_2 = { + .cc = LC3_CONFIG_48_6, + .qos = LC3_QOS_48_6_2, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, +}; + +#define SCC_SRC_8_1_2 \ + SCC_SRC_8_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1a, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_8_2_2 \ + SCC_SRC_8_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_16_1_2 \ + SCC_SRC_16_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x1e, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_16_2_2 \ + SCC_SRC_16_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x28, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_24_1_2 \ + SCC_SRC_24_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x2d, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_24_2_2 \ + SCC_SRC_24_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_32_1_2 \ + SCC_SRC_32_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x3c, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_32_2_2 \ + SCC_SRC_32_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x50, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_44_1_2 \ + SCC_SRC_44_1, \ + QOS_SRC(0xe3, 0x1f, 0x00, 0x00, 0x02, 0x62, 0x00, 0x0d, 0x50, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_44_2_2 \ + SCC_SRC_44_2, \ + QOS_SRC(0x84, 0x2a, 0x00, 0x00, 0x02, 0x82, 0x00, 0x0d, 0x55, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_1_2 \ + SCC_SRC_48_1, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x4b, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_2_2 \ + SCC_SRC_48_2, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x64, 0x00, 0x0d, 0x5f, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_3_2 \ + SCC_SRC_48_3, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x5a, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_4_2 \ + SCC_SRC_48_4, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x78, 0x00, 0x0d, 0x64, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_5_2 \ + SCC_SRC_48_5, \ + QOS_SRC(0x4c, 0x1d, 0x00, 0x00, 0x02, 0x75, 0x00, 0x0d, 0x4b, 0x00, \ + 0x40, 0x9c, 0x00) + +#define SCC_SRC_48_6_2 \ + SCC_SRC_48_6, \ + QOS_SRC(0x10, 0x27, 0x00, 0x00, 0x02, 0x9b, 0x00, 0x0d, 0x64, 0x00, \ + 0x40, 0x9c, 0x00) + +/* Test Purpose: + * Verify that a Unicast Client IUT can initiate a Config QoS operation for the + * LC3 codec. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic with the + * opcode set to 0x02 (Config QoS) and the specified parameters. + */ +static void test_scc_qos_lc3(void) +{ + define_test("BAP/UCL/SCC/BV-035-C [UCL SRC Config QoS, LC3 8_1_1]", + test_client, &cfg_snk_8_1_1, SCC_SNK_8_1_1); + define_test("BAP/UCL/SCC/BV-036-C [UCL SRC Config QoS, LC3 8_2_1]", + test_client, &cfg_snk_8_2_1, SCC_SNK_8_2_1); + define_test("BAP/UCL/SCC/BV-037-C [UCL SRC Config QoS, LC3 16_1_1]", + test_client, &cfg_snk_16_1_1, SCC_SNK_16_1_1); + define_test("BAP/UCL/SCC/BV-038-C [UCL SRC Config QoS, LC3 16_2_1]", + test_client, &cfg_snk_16_2_1, SCC_SNK_16_2_1); + define_test("BAP/UCL/SCC/BV-039-C [UCL SRC Config QoS, LC3 24_1_1]", + test_client, &cfg_snk_24_1_1, SCC_SNK_24_1_1); + define_test("BAP/UCL/SCC/BV-040-C [UCL SRC Config QoS, LC3 24_2_1]", + test_client, &cfg_snk_24_2_1, SCC_SNK_24_2_1); + define_test("BAP/UCL/SCC/BV-041-C [UCL SRC Config QoS, LC3 32_1_1]", + test_client, &cfg_snk_32_1_1, SCC_SNK_32_1_1); + define_test("BAP/UCL/SCC/BV-042-C [UCL SRC Config QoS, LC3 32_2_1]", + test_client, &cfg_snk_32_2_1, SCC_SNK_32_2_1); + define_test("BAP/UCL/SCC/BV-043-C [UCL SRC Config QoS, LC3 44.1_1_1]", + test_client, &cfg_snk_44_1_1, SCC_SNK_44_1_1); + define_test("BAP/UCL/SCC/BV-044-C [UCL SRC Config QoS, LC3 44.1_2_1]", + test_client, &cfg_snk_44_2_1, SCC_SNK_44_2_1); + define_test("BAP/UCL/SCC/BV-045-C [UCL SRC Config QoS, LC3 48_1_1]", + test_client, &cfg_snk_48_1_1, SCC_SNK_48_1_1); + define_test("BAP/UCL/SCC/BV-046-C [UCL SRC Config QoS, LC3 48_2_1]", + test_client, &cfg_snk_48_2_1, SCC_SNK_48_2_1); + define_test("BAP/UCL/SCC/BV-047-C [UCL SRC Config QoS, LC3 48_3_1]", + test_client, &cfg_snk_48_3_1, SCC_SNK_48_3_1); + define_test("BAP/UCL/SCC/BV-048-C [UCL SRC Config QoS, LC3 48_4_1]", + test_client, &cfg_snk_48_4_1, SCC_SNK_48_4_1); + define_test("BAP/UCL/SCC/BV-049-C [UCL SRC Config QoS, LC3 48_5_1]", + test_client, &cfg_snk_48_5_1, SCC_SNK_48_5_1); + define_test("BAP/UCL/SCC/BV-050-C [UCL SRC Config QoS, LC3 48_6_1]", + test_client, &cfg_snk_48_6_1, SCC_SNK_48_6_1); + define_test("BAP/UCL/SCC/BV-051-C [UCL SNK Config QoS, LC3 8_1_1]", + test_client, &cfg_src_8_1_1, SCC_SRC_8_1_1); + define_test("BAP/UCL/SCC/BV-052-C [UCL SNK Config QoS, LC3 8_2_1]", + test_client, &cfg_src_8_2_1, SCC_SRC_8_2_1); + define_test("BAP/UCL/SCC/BV-053-C [UCL SNK Config QoS, LC3 16_1_1]", + test_client, &cfg_src_16_1_1, SCC_SRC_16_1_1); + define_test("BAP/UCL/SCC/BV-054-C [UCL SNK Config QoS, LC3 16_2_1]", + test_client, &cfg_src_16_2_1, SCC_SRC_16_2_1); + define_test("BAP/UCL/SCC/BV-055-C [UCL SNK Config QoS, LC3 24_1_1]", + test_client, &cfg_src_24_1_1, SCC_SRC_24_1_1); + define_test("BAP/UCL/SCC/BV-056-C [UCL SNK Config QoS, LC3 24_2_1]", + test_client, &cfg_src_24_2_1, SCC_SRC_24_2_1); + define_test("BAP/UCL/SCC/BV-057-C [UCL SNK Config QoS, LC3 32_1_1]", + test_client, &cfg_src_32_1_1, SCC_SRC_32_1_1); + define_test("BAP/UCL/SCC/BV-058-C [UCL SNK Config QoS, LC3 32_2_1]", + test_client, &cfg_src_32_2_1, SCC_SRC_32_2_1); + define_test("BAP/UCL/SCC/BV-059-C [UCL SNK Config QoS, LC3 44.1_1_1]", + test_client, &cfg_src_44_1_1, SCC_SRC_44_1_1); + define_test("BAP/UCL/SCC/BV-060-C [UCL SNK Config QoS, LC3 44.1_2_1]", + test_client, &cfg_src_44_2_1, SCC_SRC_44_2_1); + define_test("BAP/UCL/SCC/BV-061-C [UCL SNK Config QoS, LC3 48_1_1]", + test_client, &cfg_src_48_1_1, SCC_SRC_48_1_1); + define_test("BAP/UCL/SCC/BV-062-C [UCL SNK Config QoS, LC3 48_2_1]", + test_client, &cfg_src_48_2_1, SCC_SRC_48_2_1); + define_test("BAP/UCL/SCC/BV-063-C [UCL SNK Config QoS, LC3 48_3_1]", + test_client, &cfg_src_48_3_1, SCC_SRC_48_3_1); + define_test("BAP/UCL/SCC/BV-064-C [UCL SNK Config QoS, LC3 48_4_1]", + test_client, &cfg_src_48_4_1, SCC_SRC_48_4_1); + define_test("BAP/UCL/SCC/BV-065-C [UCL SNK Config QoS, LC3 48_5_1]", + test_client, &cfg_src_48_5_1, SCC_SRC_48_5_1); + define_test("BAP/UCL/SCC/BV-066-C [UCL SNK Config QoS, LC3 48_6_1]", + test_client, &cfg_src_48_6_1, SCC_SRC_48_6_1); + define_test("BAP/UCL/SCC/BV-067-C [UCL SRC Config QoS, LC3 8_1_2]", + test_client, &cfg_snk_8_1_2, SCC_SNK_8_1_2); + define_test("BAP/UCL/SCC/BV-068-C [UCL SRC Config QoS, LC3 8_2_2]", + test_client, &cfg_snk_8_2_2, SCC_SNK_8_2_2); + define_test("BAP/UCL/SCC/BV-069-C [UCL SRC Config QoS, LC3 16_1_2]", + test_client, &cfg_snk_16_1_2, SCC_SNK_16_1_2); + define_test("BAP/UCL/SCC/BV-070-C [UCL SRC Config QoS, LC3 16_2_2]", + test_client, &cfg_snk_16_2_2, SCC_SNK_16_2_2); + define_test("BAP/UCL/SCC/BV-071-C [UCL SRC Config QoS, LC3 24_1_2]", + test_client, &cfg_snk_24_1_2, SCC_SNK_24_1_2); + define_test("BAP/UCL/SCC/BV-072-C [UCL SRC Config QoS, LC3 24_2_2]", + test_client, &cfg_snk_24_2_2, SCC_SNK_24_2_2); + define_test("BAP/UCL/SCC/BV-073-C [UCL SRC Config QoS, LC3 32_1_2]", + test_client, &cfg_snk_32_1_2, SCC_SNK_32_1_2); + define_test("BAP/UCL/SCC/BV-074-C [UCL SRC Config QoS, LC3 32_2_2]", + test_client, &cfg_snk_32_2_2, SCC_SNK_32_2_2); + define_test("BAP/UCL/SCC/BV-075-C [UCL SRC Config QoS, LC3 44.1_1_2]", + test_client, &cfg_snk_44_1_2, SCC_SNK_44_1_2); + define_test("BAP/UCL/SCC/BV-076-C [UCL SRC Config QoS, LC3 44.1_2_2]", + test_client, &cfg_snk_44_2_2, SCC_SNK_44_2_2); + define_test("BAP/UCL/SCC/BV-077-C [UCL SRC Config QoS, LC3 48_1_2]", + test_client, &cfg_snk_48_1_2, SCC_SNK_48_1_2); + define_test("BAP/UCL/SCC/BV-078-C [UCL SRC Config QoS, LC3 48_2_2]", + test_client, &cfg_snk_48_2_2, SCC_SNK_48_2_2); + define_test("BAP/UCL/SCC/BV-079-C [UCL SRC Config QoS, LC3 48_3_2]", + test_client, &cfg_snk_48_3_2, SCC_SNK_48_3_2); + define_test("BAP/UCL/SCC/BV-080-C [UCL SRC Config QoS, LC3 48_4_2]", + test_client, &cfg_snk_48_4_2, SCC_SNK_48_4_2); + define_test("BAP/UCL/SCC/BV-081-C [UCL SRC Config QoS, LC3 48_5_2]", + test_client, &cfg_snk_48_5_2, SCC_SNK_48_5_2); + define_test("BAP/UCL/SCC/BV-082-C [UCL SRC Config QoS, LC3 48_6_2]", + test_client, &cfg_snk_48_6_2, SCC_SNK_48_6_2); + define_test("BAP/UCL/SCC/BV-083-C [UCL SNK Config QoS, LC3 8_1_2]", + test_client, &cfg_src_8_1_2, SCC_SRC_8_1_2); + define_test("BAP/UCL/SCC/BV-084-C [UCL SNK Config QoS, LC3 8_2_2]", + test_client, &cfg_src_8_2_2, SCC_SRC_8_2_2); + define_test("BAP/UCL/SCC/BV-085-C [UCL SNK Config QoS, LC3 16_1_2]", + test_client, &cfg_src_16_1_2, SCC_SRC_16_1_2); + define_test("BAP/UCL/SCC/BV-086-C [UCL SNK Config QoS, LC3 16_2_2]", + test_client, &cfg_src_16_2_2, SCC_SRC_16_2_2); + define_test("BAP/UCL/SCC/BV-087-C [UCL SNK Config QoS, LC3 24_1_2]", + test_client, &cfg_src_24_1_2, SCC_SRC_24_1_2); + define_test("BAP/UCL/SCC/BV-088-C [UCL SNK Config QoS, LC3 24_2_2]", + test_client, &cfg_src_24_2_2, SCC_SRC_24_2_2); + define_test("BAP/UCL/SCC/BV-089-C [UCL SNK Config QoS, LC3 32_1_2]", + test_client, &cfg_src_32_1_2, SCC_SRC_32_1_2); + define_test("BAP/UCL/SCC/BV-090-C [UCL SNK Config QoS, LC3 32_2_2]", + test_client, &cfg_src_32_2_2, SCC_SRC_32_2_2); + define_test("BAP/UCL/SCC/BV-091-C [UCL SNK Config QoS, LC3 44.1_1_2]", + test_client, &cfg_src_44_1_2, SCC_SRC_44_1_2); + define_test("BAP/UCL/SCC/BV-092-C [UCL SNK Config QoS, LC3 44.1_2_2]", + test_client, &cfg_src_44_2_2, SCC_SRC_44_2_2); + define_test("BAP/UCL/SCC/BV-093-C [UCL SNK Config QoS, LC3 48_1_2]", + test_client, &cfg_src_48_1_2, SCC_SRC_48_1_2); + define_test("BAP/UCL/SCC/BV-094-C [UCL SNK Config QoS, LC3 48_2_2]", + test_client, &cfg_src_48_2_2, SCC_SRC_48_2_2); + define_test("BAP/UCL/SCC/BV-095-C [UCL SNK Config QoS, LC3 48_3_2]", + test_client, &cfg_src_48_3_2, SCC_SRC_48_3_2); + define_test("BAP/UCL/SCC/BV-096-C [UCL SNK Config QoS, LC3 48_4_2]", + test_client, &cfg_src_48_4_2, SCC_SRC_48_4_2); + define_test("BAP/UCL/SCC/BV-097-C [UCL SNK Config QoS, LC3 48_5_2]", + test_client, &cfg_src_48_5_2, SCC_SRC_48_5_2); + define_test("BAP/UCL/SCC/BV-098-C [UCL SNK Config QoS, LC3 48_6_2]", + test_client, &cfg_src_48_6_2, SCC_SRC_48_6_2); +} + static void test_scc(void) { test_scc_cc_lc3(); test_scc_cc_vs(); + test_scc_qos_lc3(); } int main(int argc, char *argv[]) From patchwork Fri Dec 1 22:38:56 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: 749890 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="frUDt8FD" Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A99D63 for ; Fri, 1 Dec 2023 14:39:09 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-da077db5145so1055053276.0 for ; Fri, 01 Dec 2023 14:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470347; x=1702075147; darn=vger.kernel.org; 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=nilNZRtTQifRr2NjZFoVre08KbRTer2dFroHFKuf5O4=; b=frUDt8FDXmDs+DVg6LCb8ds8XgD3KCTWoRs+8tce534dC3IC7WgEpfb3PE1u5W67CF 2wKq0Qf9WSqpOmhiFQPn7LI04LOL35SUDgZ/oodRPEl2S7XWcLQZujeWgCjoCp0vP64g Q60BtUpjuQlCgUOYPtgbATtGF+Qt136yrn2tujgL8ujZ/79rkxyKH89/StMdZJhcjoLx v1Acpri0Vybui6wgBz9zziLS+1MSuKkUR9hpSN3R7PqueOQr47WZEPqqyzI3IVemHuP5 h2MDZkctN0WJy5noV3BaDHjAbaGuDGHRiYWS5glSt/W9EGY7xqaZtbHKLs58U5Vh8BGV HNOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470347; x=1702075147; 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=nilNZRtTQifRr2NjZFoVre08KbRTer2dFroHFKuf5O4=; b=LFBJ7iLoZAJ8dY87RBVZhawG4J4x+seIcXbtdJRxXmUMvTkwEe4EuauPas/mLOjw9u 8viVo/ttPQo1/cWZKCB65bcw5BAa98B1Sqt0kdyCP75nSRMLZtQ759ZHBLM8uVXHV+jX rqjRa1V6jFi26fBNVezFIpT8UPtf5wDq02A+V1A7dU7Hv3rW6JmQr/1jfXXbZshaNFzC GRJiMjC+Q2AnEDvG+/Vfo3ETIsFWb22CuJ2cRO+glvE0K1hQDS6ll0LYBMdEY4BQG2St z9bEuKOMtedu6oszUZwbWMLcgRzkScZLKLR/YF5GGOqb/ZfshG1UJZGosjSJM6wS483Z /6Gw== X-Gm-Message-State: AOJu0Yyb3TtZoddM7VzFTC4t4fd5jQ3DmeE8TzXMTMzcYM4b/Z6v4DF4 uvSMEK5uJIEdgnMmaKrhUDEbwmLFbtSU8g== X-Google-Smtp-Source: AGHT+IHuKPWDP7fX3e5Vqrmh3i3uW7/2EBPD7A/QX38i9O6gNeo0qOd6aL6u9ICVenf2FcyoLHp4zg== X-Received: by 2002:a25:c44:0:b0:db7:dad0:76ac with SMTP id 65-20020a250c44000000b00db7dad076acmr178050ybm.72.1701470346950; Fri, 01 Dec 2023 14:39:06 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:06 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 3/7] test-bap: Add SCC Config QoS, VS tests Date: Fri, 1 Dec 2023 17:38:56 -0500 Message-ID: <20231201223900.2498565-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201223900.2498565-1-luiz.dentz@gmail.com> References: <20231201223900.2498565-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 4.8.4 Unicast Client Initiates Config QoS – Vendor-Specific (Page 46) Test Purpose: Verify that a Unicast Client IUT can initiate a Config QoS operation for a vendor-specific codec. Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x02 (Config QoS) and the specified parameters. Test Summary ------------ BAP/UCL/SCC/BV-099-C [UCL SNK Config QoS, VS] Passed BAP/UCL/SCC/BV-100-C [UCL SRC Config QoS, VS] Passed Total: 2, Passed: 2 (100.0%), Failed: 0, Not Run: 0 --- unit/test-bap.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/unit/test-bap.c b/unit/test-bap.c index 303388e35c14..fdfedde6b965 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -2146,11 +2146,54 @@ static void test_scc_qos_lc3(void) test_client, &cfg_src_48_6_2, SCC_SRC_48_6_2); } +static struct test_config cfg_snk_qos_vs = { + .cc = IOV_NULL, + .qos = QOS_UCAST, + .snk = true, + .vs = true, + .state = BT_BAP_STREAM_STATE_QOS +}; + +#define SCC_SNK_QOS_VS \ + SCC_SNK_VS, \ + QOS_SNK(0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00) + +static struct test_config cfg_src_qos_vs = { + .cc = IOV_NULL, + .qos = QOS_UCAST, + .src = true, + .vs = true, + .state = BT_BAP_STREAM_STATE_QOS +}; + +#define SCC_SRC_QOS_VS \ + SCC_SRC_VS, \ + QOS_SRC(0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00) + +/* Test Purpose: + * Verify that a Unicast Client IUT can initiate a Config QoS operation for a + * vendor-specific codec. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic with the + * opcode set to 0x02 (Config QoS) and the specified parameters. + */ +static void test_scc_qos_vs(void) +{ + define_test("BAP/UCL/SCC/BV-099-C [UCL SNK Config QoS, VS]", + test_client, &cfg_src_qos_vs, SCC_SRC_QOS_VS); + define_test("BAP/UCL/SCC/BV-100-C [UCL SRC QoS Codec, VS]", + test_client, &cfg_snk_qos_vs, SCC_SNK_QOS_VS); +} + static void test_scc(void) { test_scc_cc_lc3(); test_scc_cc_vs(); test_scc_qos_lc3(); + test_scc_qos_vs(); } int main(int argc, char *argv[]) From patchwork Fri Dec 1 22:38:57 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: 749223 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TWvS0SUe" Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E799D54 for ; Fri, 1 Dec 2023 14:39:12 -0800 (PST) Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-67a35b68c34so15323256d6.3 for ; Fri, 01 Dec 2023 14:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470350; x=1702075150; darn=vger.kernel.org; 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=Jzu0Gbgf988x22ji0B5m/8VKcTqn+nCtaQs42XgrVkw=; b=TWvS0SUeJnFu4oxe9IpsSJtPx6rXlKsFW8eJb1Y5rQX+RWZp8nKQjcwnjpkzK9+/k8 jR97RWZHyH3rSy55j/UmmWFhFanBkZV5sblJspTkRCwIDRPUWUy8cjORkkqI0oCmDZgu fsyHSU919G8zrc2Zr5VpKHv0DNPMuYBszyqoUD4Bs9r1rCL5nUIae5kqLcZyP1MU7H56 JdfD8z2Mca2VbePgCbr5unQTfHI6iNOuIDw3Sq71nny3TfhZwBw05RADzCIclObl1ev0 V1kykW7tSyfKOnmEPv2MoJDD5McpOJTOiYdDC9pIXuYL9LDHkD6BxbjeoADiBxyk43yG eenA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470350; x=1702075150; 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=Jzu0Gbgf988x22ji0B5m/8VKcTqn+nCtaQs42XgrVkw=; b=JXdwjLOvMmv3Itk7FSPV1PJ4KqS+8v9swkBVEJzoxC+QGn3tG5gkC9oMOtY5sYJ3Vj +OwWyOG5dts+nibnLqLHrBB+y30WUdEnkjgoMU+Ti0ydukyAsPzhuncsdcUt5dT1ljEJ uCZmP3yP3D/AmkaDf5bZhYwupChmBReB8hXdXgAanzzMdFzlEYkIQyG2gE7mkidofmnT fBNewyvc6pnI6F9cyH/60vbIC9pxOJs6/8qyiHvIif3OnX/6rIfRkJOWw6bQ7W5rZRqi dOhv3le7mLo4iuh3wJbbLJIwyieGmvKrYwrK+1Z1sGxz87OYOLK93zuZq8VIfRRJzGBc 7v+Q== X-Gm-Message-State: AOJu0YzJu8oJTh/YpOYRyUddsIE5boTAj1IIVLQH9p1vjOt2T6KRql8b B2evPEztqiQT66ei2BuUFoqJ5x9bLu2S2g== X-Google-Smtp-Source: AGHT+IFInz7l3z76r2TT2Qic3LZUATlXudAEgXrjBThcq83S9XATDlQzVwAYHHbP/yQhcteVL0CohA== X-Received: by 2002:a05:6214:170a:b0:67a:a721:b188 with SMTP id db10-20020a056214170a00b0067aa721b188mr215965qvb.67.1701470349913; Fri, 01 Dec 2023 14:39:09 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:07 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 4/7] test-bap: Add SCC Enable tests Date: Fri, 1 Dec 2023 17:38:57 -0500 Message-ID: <20231201223900.2498565-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201223900.2498565-1-luiz.dentz@gmail.com> References: <20231201223900.2498565-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 4.8.5 Unicast Client Initiates Enable Operation (Page 48) Test Purpose: Verify that a Unicast Client IUT can initiate an Enable operation for an ASE with a Unicast Server that is either in the Audio Sink role or the Audio Source role. Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x03 (Enable) and the specified parameters. Test Summary ------------ BAP/UCL/SCC/BV-101-C [UCL SRC Enable] Passed BAP/UCL/SCC/BV-102-C [UCL SNK Enable] Passed Total: 2, Passed: 2 (100.0%), Failed: 0, Not Run: 0 --- unit/test-bap.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index fdfedde6b965..9369983ba97d 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -335,7 +335,7 @@ static void test_complete_cb(const void *user_data) tester_test_passed(); } -static void bap_qos(struct bt_bap_stream *stream, +static void bap_enable(struct bt_bap_stream *stream, uint8_t code, uint8_t reason, void *user_data) { @@ -343,6 +343,26 @@ static void bap_qos(struct bt_bap_stream *stream, tester_test_failed(); } +static void bap_qos(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + struct test_data *data = user_data; + + if (code) { + tester_test_failed(); + return; + } + + if (data->cfg->state > BT_BAP_STREAM_STATE_QOS) { + unsigned int qos_id; + + qos_id = bt_bap_stream_enable(data->stream, true, NULL, + bap_enable, data); + g_assert(qos_id); + } +} + static void bap_config(struct bt_bap_stream *stream, uint8_t code, uint8_t reason, void *user_data) @@ -2188,12 +2208,82 @@ static void test_scc_qos_vs(void) test_client, &cfg_snk_qos_vs, SCC_SNK_QOS_VS); } +static struct test_config cfg_snk_enable = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_ENABLING +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 03010104030201 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0301010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 0101010300403020100 + */ +#define SCC_SNK_ENABLE \ + SCC_SNK_16_2_1, \ + IOV_DATA(0x52, 0x22, 0x00, 0x03, 0x01, 0x01, 0x04, 0x03, 0x02, 0x01, \ + 00), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x03, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x03, 0x00, 0x00, 0x04, 0x03, 0x02, \ + 0x01, 0x00) + +static struct test_config cfg_src_enable = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_ENABLING +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 0301030403020100 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0301030000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x001c + * Data: 030300000403020100 + */ +#define SCC_SRC_ENABLE \ + SCC_SRC_16_2_1, \ + IOV_DATA(0x52, 0x22, 0x00, 0x03, 0x01, 0x03, 0x04, 0x03, 0x02, 0x01, \ + 00), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x03, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x03, 0x00, 0x00, 0x04, 0x03, 0x02, \ + 0x01, 0x00) + +/* Test Purpose: + * Verify that a Unicast Client IUT can initiate an Enable operation for an ASE + * with a Unicast Server that is either in the Audio Sink role or the Audio + * Source role. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic with the + * opcode set to 0x03 (Enable) and the specified parameters. + */ +static void test_scc_enable(void) +{ + define_test("BAP/UCL/SCC/BV-101-C [UCL SRC Enable]", + test_client, &cfg_snk_enable, SCC_SNK_ENABLE); + define_test("BAP/UCL/SCC/BV-102-C [UCL SNK Enable]", + test_client, &cfg_src_enable, SCC_SRC_ENABLE); +} + static void test_scc(void) { test_scc_cc_lc3(); test_scc_cc_vs(); test_scc_qos_lc3(); test_scc_qos_vs(); + test_scc_enable(); } int main(int argc, char *argv[]) From patchwork Fri Dec 1 22:38:58 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: 749222 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fZopfpzw" Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E741D6C for ; Fri, 1 Dec 2023 14:39:14 -0800 (PST) Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-67a948922aaso7401796d6.3 for ; Fri, 01 Dec 2023 14:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470353; x=1702075153; darn=vger.kernel.org; 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=K3b7r1p1Ur3sHOjYjWNF6OJfv/yxkBqTEAW1r1VZz9c=; b=fZopfpzw64cO8fL/GFMtVuCjE64Pln5wItzYxhI6+JDhYqAWz3i3ASt71FE7dpKxHP FsPC8Sii+yHjwOX3QylMkLdVGtdKvNCWfO7DPsMfqgsvN8336qfjXhD+a1LzoVDrIE10 BEIgoJUXrAI5CCjJ23lEB2tKga6+dPzJj9WwGLpofdy1lSydu6dl8dGLBUscVbAXEa/C 60esAxhj1leUEel79awBIFBq7C3ZUzfPWg57AUGC54uCVdtJfqpTLCJ3zmxVbJnK99H9 tjlON0mGv1icPXxvjv0A+pJNhw153vVpm+d8vU33XcNXRGAL1cE9IK+a99TPIdaWZcAx qA5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470353; x=1702075153; 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=K3b7r1p1Ur3sHOjYjWNF6OJfv/yxkBqTEAW1r1VZz9c=; b=nI52/dTImpK1fisFjLGuc7wWqH7uIopKt1LGBSmL5fbR76NYT2C/23GAGvxCYI/gjo /hLMdB+qhhGR2kDNTnlwWlFPCHj6SOPJVtxc9JPM35S/tj4N609B22Za4bOTrDrg+FK0 4RPWiRF9IIFH/+qbZxhxhw1QsFPbgDT663Z+hRyKLM97F7CSV+ufW3dySPlP4iekJ1C+ dQnQqercb/uc9d1Q5vqcm8FovKtX8xoWQYYIixWaY2JSEqW9mTGEJvXlkRMut49QYKhU 12VpPSMRP3tvVe4J+DyUDm9BWa5ltG7SMVO4S8bPGNeZ3tuW66vi4aO6a82/kWpZP7Fr EqnQ== X-Gm-Message-State: AOJu0YwS7p91NpB98ZkpEy4/tL9tb0fZoWYJrLgPGpBLeOQ1E3/A1oKx LOiyqIFsShmpKu0/DYow2M0UlPFGKw8bGQ== X-Google-Smtp-Source: AGHT+IGXsZ82oqUJym/ZuNuDHEx8w6Nkl3MhgCLlKoe71Bvg+Y2a+bmwhe8H3/78cvWcfHGRxxXnsg== X-Received: by 2002:a0c:f78e:0:b0:67a:a721:e135 with SMTP id s14-20020a0cf78e000000b0067aa721e135mr260631qvn.98.1701470352737; Fri, 01 Dec 2023 14:39:12 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:10 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 5/7] test-bap: Add SCC Disable tests Date: Fri, 1 Dec 2023 17:38:58 -0500 Message-ID: <20231201223900.2498565-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201223900.2498565-1-luiz.dentz@gmail.com> References: <20231201223900.2498565-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 4.8.6 Unicast Client Initiates Disable Operation (Page 50): Test Purpose: Verify that a Unicast Client IUT can initiate a Disable operation for an ASE in the Enabling or Streaming state. Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x05 (Disable) and the specified parameters. Test Summary ------------ BAP/UCL/SCC/BV-103-C [UCL SNK Disable in Enabling State] Passed BAP/UCL/SCC/BV-104-C [UCL SRC Disable in Enabling or Streaming state] Passed BAP/UCL/SCC/BV-105-C [UCL SNK Disable in Streaming State] Passed Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0 --- unit/test-bap.c | 153 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 152 insertions(+), 1 deletion(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index 9369983ba97d..4e518b010def 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -335,7 +335,7 @@ static void test_complete_cb(const void *user_data) tester_test_passed(); } -static void bap_enable(struct bt_bap_stream *stream, +static void bap_disable(struct bt_bap_stream *stream, uint8_t code, uint8_t reason, void *user_data) { @@ -343,6 +343,50 @@ static void bap_enable(struct bt_bap_stream *stream, tester_test_failed(); } +static void bap_start(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + struct test_data *data = user_data; + unsigned int id; + + if (code) { + tester_test_failed(); + return; + } + + id = bt_bap_stream_disable(data->stream, true, bap_disable, data); + + g_assert(id); +} + +static void bap_enable(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + struct test_data *data = user_data; + unsigned int id = 0; + + if (code) { + tester_test_failed(); + return; + } + + switch (data->cfg->state) { + case BT_BAP_STREAM_STATE_ENABLING: + return; + case BT_BAP_STREAM_STATE_DISABLING: + id = bt_bap_stream_disable(data->stream, true, bap_disable, + data); + break; + case BT_BAP_STREAM_STATE_STREAMING: + id = bt_bap_stream_start(data->stream, bap_start, data); + break; + } + + g_assert(id); +} + static void bap_qos(struct bt_bap_stream *stream, uint8_t code, uint8_t reason, void *user_data) @@ -2277,6 +2321,112 @@ static void test_scc_enable(void) test_client, &cfg_src_enable, SCC_SRC_ENABLE); } +static struct test_config cfg_snk_disable = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_DISABLING +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 050101 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0501010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 01010102010a00204e00409c00204e00409c00_qos + */ +#define ASE_SNK_DISABLE \ + IOV_DATA(0x52, 0x22, 0x00, 0x05, 0x01, 0x01), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x05, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x02, 0x00, 0x00, 0x4c, 0x1d, 0x00, \ + 0x00, 0x02, 0x1a, 0x00, 0x02, 0x08, 0x00, 0x40, 0x9c, \ + 0x00) + +#define SCC_SNK_DISABLE \ + SCC_SNK_ENABLE, \ + ASE_SNK_DISABLE + +static struct test_config cfg_src_disable = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_DISABLING +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 050103 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0301030000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x001c + * Data: 030300000403020100 + */ +#define ASE_SRC_DISABLE \ + IOV_DATA(0x52, 0x22, 0x00, 0x05, 0x01, 0x03), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x05, 0x01, 0x03, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x02, 0x00, 0x00, 0x4c, 0x1d, 0x00, \ + 0x00, 0x02, 0x1a, 0x00, 0x02, 0x08, 0x00, 0x40, 0x9c, \ + 0x00) +#define SCC_SRC_DISABLE \ + SCC_SRC_ENABLE, \ + ASE_SRC_DISABLE + +static struct test_config cfg_src_disable_streaming = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_STREAMING +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 040101 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0401010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 0101010400403020100 + */ +#define ASE_SRC_START \ + IOV_DATA(0x52, 0x22, 0x00, 0x04, 0x01, 0x03), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x04, 0x01, 0x03, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x04, 0x00, 0x00, 0x04, 0x03, 0x02, \ + 0x01, 0x00) + +#define SCC_SRC_DISABLE_STREAMING \ + SCC_SRC_ENABLE, \ + ASE_SRC_START, \ + ASE_SRC_DISABLE + +/* Test Purpose: + * Verify that a Unicast Client IUT can initiate a Disable operation for an ASE + * in the Enabling or Streaming state. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic with the + * opcode set to 0x05 (Disable) and the specified parameters. + */ +static void test_scc_disable(void) +{ + define_test("BAP/UCL/SCC/BV-103-C [UCL SNK Disable in Enabling State]", + test_client, &cfg_src_disable, SCC_SRC_DISABLE); + define_test("BAP/UCL/SCC/BV-104-C [UCL SRC Disable in Enabling or " + "Streaming state]", + test_client, &cfg_snk_disable, SCC_SNK_DISABLE); + define_test("BAP/UCL/SCC/BV-105-C [UCL SNK Disable in Streaming State]", + test_client, &cfg_src_disable_streaming, + SCC_SRC_DISABLE_STREAMING); +} + static void test_scc(void) { test_scc_cc_lc3(); @@ -2284,6 +2434,7 @@ static void test_scc(void) test_scc_qos_lc3(); test_scc_qos_vs(); test_scc_enable(); + test_scc_disable(); } int main(int argc, char *argv[]) From patchwork Fri Dec 1 22:38:59 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: 749888 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h3PFpnqn" Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 799D7AD for ; Fri, 1 Dec 2023 14:39:16 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-db53f8cf4afso1044799276.3 for ; Fri, 01 Dec 2023 14:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470354; x=1702075154; darn=vger.kernel.org; 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=3ksYSdxZhMuwVUzXhKZUFZKDWNfR+dei+bwpsAXb7yI=; b=h3PFpnqnAcQAFwtt4WeApkeM+MBUFQWPmZoqIOiRhlS8taCSVFCzx41FKRCUHH8RKA vD2TWyCwyHVtCbeIeaC6XTEl6Zl7lrOvro8/X6uct5PaZrUsoFF9JDcRc0Jr6IByb8FL tCK1gSwSc+s3oplEHAQfP6+sPMv5tn+4F0z1Bu7ZmRCGBXs9dWtUDIQbmc5T4bBnL3Sx /yoACxWLm3CsWHoMaYLrYYlgucDtOCU20fYkFCk87nlTCJLiLtsz9hbhz+aGexXyhOmQ dqJTdp9s5MJNDaOa987fegJD3LcjNmvpiJ/uZ4AMAPPFW2wsnabb1b/pcPgAIeakA8BC c7sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470354; x=1702075154; 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=3ksYSdxZhMuwVUzXhKZUFZKDWNfR+dei+bwpsAXb7yI=; b=NU/J2PXM616hxWduEGv4o6c/GQs3tLHxz4+okgCnQvBrUKlzoYB6UZEYtPirpOMkEc CgNY4Dfx4OYu+kzBhewXhF1aGtEjzxJVeFj68Uj/ib/jetTkh/NdLoWlT+ukylcYMTjM HM1fSlIDG1hovDhhWOMZ8+T3qFlmSz7eBZ4ZH6cle8d7hsBzWETlWsWEHE9ESYujHS6Y AmLfTGi8qSX8MNSh33y64iMbYr9LvoV+546gOBtPmc32n2aH+uNMmqAmcONcvx3c1zOZ 33ZiX3JqW7t99OLCvrlVwHn7lOjzekOM/v44kylXdl9H8R9/Cc7ayh+yuku1lw2nfJva Ojfw== X-Gm-Message-State: AOJu0YzQAZaQy+DBUBABKmKZTyKQPfkwv/VyD/lKggx5m1v/obdw8Pi0 yxlwBGBVKcCpNCZ3iIYVgAR5LzDWCmem8g== X-Google-Smtp-Source: AGHT+IER3h1bGlFiAiFqIsvk5Qy1U/LufICKS6xv0tb4bF+fs7g2EL9fjEH5sxUpgiDqJz0+/QWptQ== X-Received: by 2002:a25:f904:0:b0:da0:48df:cafa with SMTP id q4-20020a25f904000000b00da048dfcafamr23314918ybe.16.1701470354481; Fri, 01 Dec 2023 14:39:14 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:13 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 6/7] shared/bap: Fix possible crash when freeing requests Date: Fri, 1 Dec 2023 17:38:59 -0500 Message-ID: <20231201223900.2498565-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201223900.2498565-1-luiz.dentz@gmail.com> References: <20231201223900.2498565-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz Requests maybe queued using a stream so when detaching it needs to be canceled otherwise they can lead crashes like bellow: Invalid read of size 8 at 0x1C3247: stream_stop_complete (bap.c:1230) by 0x1BB2A3: bap_req_complete (bap.c:3863) by 0x1C7BB3: bap_req_detach (bap.c:4219) by 0x1C7BB3: bt_bap_detach (bap.c:4231) by 0x1C7BB3: bt_bap_detach (bap.c:4222) by 0x1C7E67: bap_free (bap.c:2937) by 0x1C7E67: bt_bap_unref (bap.c:3090) by 0x1C7E67: bt_bap_unref (bap.c:3082) by 0x18CCC2: test_teardown (test-bap.c:513) by 0x1D826A: teardown_callback (tester.c:434) by 0x491E4FC: g_idle_dispatch (gmain.c:6163) by 0x49224FB: UnknownInlinedFun (gmain.c:3460) by 0x49224FB: g_main_context_dispatch (gmain.c:4200) by 0x49806B7: g_main_context_iterate.isra.0 (gmain.c:4276) by 0x4921AFE: g_main_loop_run (gmain.c:4479) by 0x1E8EF4: mainloop_run (mainloop-glib.c:66) by 0x1E93F7: mainloop_run_with_signal (mainloop-notify.c:188) Address 0x57b9ad0 is 0 bytes inside a block of size 120 free'd at 0x4845B2C: free (vg_replace_malloc.c:985) by 0x1CBAB7: bap_stream_state_changed (bap.c:1290) by 0x1D3104: bap_ep_set_status (bap.c:3673) by 0x1DC746: queue_foreach (queue.c:207) by 0x1A5320: notify_cb (gatt-client.c:2271) by 0x19A1EF: handle_notify (att.c:1012) by 0x19A1EF: can_read_data (att.c:1096) by 0x1D68CF: watch_callback (io-glib.c:157) by 0x49224FB: UnknownInlinedFun (gmain.c:3460) by 0x49224FB: g_main_context_dispatch (gmain.c:4200) by 0x49806B7: g_main_context_iterate.isra.0 (gmain.c:4276) by 0x4921AFE: g_main_loop_run (gmain.c:4479) by 0x1E8EF4: mainloop_run (mainloop-glib.c:66) by 0x1E93F7: mainloop_run_with_signal (mainloop-notify.c:188) --- src/shared/bap.c | 91 ++++++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index d8a3adde60ca..a1495ca84bcc 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1232,6 +1232,47 @@ static void stream_stop_complete(struct bt_bap_stream *stream, uint8_t code, bap_stream_io_detach(stream); } +static void bap_req_free(void *data) +{ + struct bt_bap_req *req = data; + size_t i; + + queue_destroy(req->group, bap_req_free); + + for (i = 0; i < req->len; i++) + free(req->iov[i].iov_base); + + free(req->iov); + free(req); +} + +static void bap_req_complete(struct bt_bap_req *req, + const struct bt_ascs_ase_rsp *rsp) +{ + struct queue *group; + + if (!req->func) + goto done; + + if (rsp) + req->func(req->stream, rsp->code, rsp->reason, req->user_data); + else + req->func(req->stream, BT_ASCS_RSP_UNSPECIFIED, 0x00, + req->user_data); + +done: + /* Detach from request so it can be freed separately */ + group = req->group; + req->group = NULL; + + queue_foreach(group, (queue_foreach_func_t)bap_req_complete, + (void *)rsp); + + queue_destroy(group, NULL); + + bap_req_free(req); +} + static void bap_stream_state_changed(struct bt_bap_stream *stream) { struct bt_bap *bap = stream->bap; @@ -1286,6 +1327,10 @@ static void bap_stream_state_changed(struct bt_bap_stream *stream) /* Post notification updates */ switch (stream->ep->state) { case BT_ASCS_ASE_STATE_IDLE: + if (bap->req && bap->req->stream == stream) { + bap_req_complete(bap->req, NULL); + bap->req = NULL; + } bap_stream_detach(stream); break; case BT_ASCS_ASE_STATE_QOS: @@ -2905,20 +2950,6 @@ static void bap_state_free(void *data) free(state); } -static void bap_req_free(void *data) -{ - struct bt_bap_req *req = data; - size_t i; - - queue_destroy(req->group, bap_req_free); - - for (i = 0; i < req->len; i++) - free(req->iov[i].iov_base); - - free(req->iov); - free(req); -} - static void bap_detached(void *data, void *user_data) { struct bt_bap_cb *cb = data; @@ -3809,6 +3840,11 @@ static bool bap_send(struct bt_bap *bap, struct bt_bap_req *req) DBG(bap, "req %p len %u", req, iov.iov_len); + if (req->stream && !queue_find(bap->streams, NULL, req->stream)) { + DBG(bap, "stream %p detached, aborting op 0x%02x", req->op); + return false; + } + if (!gatt_db_attribute_get_char_data(ascs->ase_cp, NULL, &handle, NULL, NULL, NULL)) { DBG(bap, "Unable to find Control Point"); @@ -3843,33 +3879,6 @@ static bool bap_send(struct bt_bap *bap, struct bt_bap_req *req) return true; } -static void bap_req_complete(struct bt_bap_req *req, - const struct bt_ascs_ase_rsp *rsp) -{ - struct queue *group; - - if (!req->func) - goto done; - - if (rsp) - req->func(req->stream, rsp->code, rsp->reason, req->user_data); - else - req->func(req->stream, BT_ASCS_RSP_UNSPECIFIED, 0x00, - req->user_data); - -done: - /* Detach from request so it can be freed separately */ - group = req->group; - req->group = NULL; - - queue_foreach(group, (queue_foreach_func_t)bap_req_complete, - (void *)rsp); - - queue_destroy(group, NULL); - - bap_req_free(req); -} - static bool bap_process_queue(void *data) { struct bt_bap *bap = data; From patchwork Fri Dec 1 22:39:00 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: 749221 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gI+Z3pVC" Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63E0ED54 for ; Fri, 1 Dec 2023 14:39:18 -0800 (PST) Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-67a91751ba8so8452106d6.3 for ; Fri, 01 Dec 2023 14:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701470357; x=1702075157; darn=vger.kernel.org; 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=KtIEJOo0bH7uN3S+paD2i9Xj09nYjIM1rX/qwhOf5xE=; b=gI+Z3pVC/EMm+sbW0SfRMrNjrVMW8+XN+t1k8E9n55e1+/ErN/rjANmmUzwbkro1yf IvvMXb3IgNUCv/56eA0piflt0DBUnBzm46C4La7auHXUbPZunAaD/llLyKJZHhANogzP hF97C2x0lR+zPKs+Ei8WMhOm0Ngc5lN5DrYuXE9tu4xg5OzZXUoiE0CcosXbFUw2YVrG RbC4x1VbKHwf2WsqS/jQtHhLP56Fm+HYOeYTg38UBRNkjPs0RxHCwSd9TKryqi0sQK8J uxW/zsfYLoUj1VasZhvDZbKY5my2dtIFLeAtzBWqCRAiZolurXqkWZKIIAOFNElzoXcd oAZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701470357; x=1702075157; 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=KtIEJOo0bH7uN3S+paD2i9Xj09nYjIM1rX/qwhOf5xE=; b=rvpYZPytCxXNk3+a8BqkUL2h6HaVEzSBKrVTuvKw53IJpjSs4/KB8lGhZpAw/LGmzI rwV5yiiIJsbjcupWEOK41XDPhxhk6LuRKytIEOaHCgGxKrN7VI1G0z+BHPoO8qp6P11a bQ9tc85ZzxrpVLTuQHU/0nYHH7N64ZuyHpEMjx+BUvVUjPPznRz008kcjLEGQgEYsrgB EYAvvWgEmTMoVcnKlIX582VJ7pKET/z8rWAXZBMPmHIebNxypD331n3HV9VZW8eQicPc +ejTWTeUZSz1LBNmcLOdZVe8oAz7MWbkjY1sNxkHpXRlwuEWriSTkxrnBPvq0MemONVs kqoA== X-Gm-Message-State: AOJu0YzixTTVTPDguwrhjMk3LMRQWXq8TIlKDv4DFCMGGiWHNDqKO3ID W8FzxLRWHZzt3+vCmEomgtUV2GHVd2yw7A== X-Google-Smtp-Source: AGHT+IGP8gLloRzoA1ndIuCV+vyqkWd8ZR/OSKalLB2I1LjHHFWxvNeyR8CUR6YL0mp7v4WcdiRvzw== X-Received: by 2002:a0c:f8c5:0:b0:67a:a793:b379 with SMTP id h5-20020a0cf8c5000000b0067aa793b379mr134965qvo.30.1701470356772; Fri, 01 Dec 2023 14:39:16 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id b18-20020a0c9b12000000b0065b13180892sm1915411qve.16.2023.12.01.14.39.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:39:14 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v2 7/7] test-bap: Add SCC Release tests Date: Fri, 1 Dec 2023 17:39:00 -0500 Message-ID: <20231201223900.2498565-7-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201223900.2498565-1-luiz.dentz@gmail.com> References: <20231201223900.2498565-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luiz Augusto von Dentz 4.8.7 Unicast Client Initiates Release Operation (Page 51): Test Purpose: Verify that a Unicast Client IUT can release an ASE by initiating a Release operation. Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x08 (Release) and the specified parameters. Test Summary ------------ BAP/UCL/SCC/BV-106-C [UCL SNK Release in Codec Configured state] Passed BAP/UCL/SCC/BV-107-C [UCL SRC Release in Codec Configured state] Passed BAP/UCL/SCC/BV-108-C [UCL SNK Release in QoS Configured state] Passed BAP/UCL/SCC/BV-109-C [UCL SRC Release in QoS Configured state] Passed BAP/UCL/SCC/BV-110-C [UCL SNK Release in Enabling state] Passed BAP/UCL/SCC/BV-111-C [UCL SRC Release in Enabling or Streaming state] Passed BAP/UCL/SCC/BV-112-C [UCL SNK Release in Streaming state] Passed BAP/UCL/SCC/BV-113-C [UCL SNK Release in Disabling state] Passed Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0 --- unit/test-bap.c | 287 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 274 insertions(+), 13 deletions(-) diff --git a/unit/test-bap.c b/unit/test-bap.c index 4e518b010def..fa6e65219beb 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -40,6 +40,7 @@ struct test_config { bool src; bool vs; uint8_t state; + bt_bap_state_func_t state_func; }; struct test_data { @@ -347,17 +348,8 @@ static void bap_start(struct bt_bap_stream *stream, uint8_t code, uint8_t reason, void *user_data) { - struct test_data *data = user_data; - unsigned int id; - - if (code) { + if (code) tester_test_failed(); - return; - } - - id = bt_bap_stream_disable(data->stream, true, bap_disable, data); - - g_assert(id); } static void bap_enable(struct bt_bap_stream *stream, @@ -507,6 +499,10 @@ static void test_client(const void *user_data) bt_bap_ready_register(data->bap, bap_ready, data, NULL); + if (data->cfg && data->cfg->state_func) + bt_bap_state_register(data->bap, data->cfg->state_func, NULL, + data, NULL); + bt_bap_attach(data->bap, data->client); } @@ -2371,18 +2367,35 @@ static struct test_config cfg_src_disable = { IOV_DATA(0x52, 0x22, 0x00, 0x05, 0x01, 0x03), \ IOV_DATA(0x1b, 0x22, 0x00, 0x05, 0x01, 0x03, 0x00, 0x00), \ IOV_NULL, \ - IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x02, 0x00, 0x00, 0x4c, 0x1d, 0x00, \ - 0x00, 0x02, 0x1a, 0x00, 0x02, 0x08, 0x00, 0x40, 0x9c, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x05, 0x00, 0x00, 0x4c, 0x1d, 0x00, \ + 0x00, 0x02, 0x1a, 0x00, 0x04, 0x08, 0x00, 0x40, 0x9c, \ 0x00) #define SCC_SRC_DISABLE \ SCC_SRC_ENABLE, \ ASE_SRC_DISABLE +static void state_start_disable(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_STREAMING: + id = bt_bap_stream_disable(data->stream, true, bap_disable, + data); + g_assert(id); + break; + } +} + static struct test_config cfg_src_disable_streaming = { .cc = LC3_CONFIG_16_2, .qos = LC3_QOS_16_2_1, .src = true, - .state = BT_BAP_STREAM_STATE_STREAMING + .state = BT_BAP_STREAM_STATE_STREAMING, + .state_func = state_start_disable }; /* ATT: Write Command (0x52) len 23 @@ -2427,6 +2440,253 @@ static void test_scc_disable(void) SCC_SRC_DISABLE_STREAMING); } +static void bap_release(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + if (code) + tester_test_failed(); +} + +static void state_cc_release(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_CONFIG: + id = bt_bap_stream_release(data->stream, bap_release, data); + g_assert(id); + break; + } +} + +static struct test_config cfg_src_cc_release = { + .cc = LC3_CONFIG_16_2, + .qos = QOS_UCAST, + .src = true, + .state_func = state_cc_release, +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 080103 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0801030000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x001c + * Data: 0300 + */ +#define ASE_SRC_RELEASE \ + IOV_DATA(0x52, 0x22, 0x00, 0x08, 0x01, 0x03), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x08, 0x01, 0x03, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x1c, 0x00, 0x03, 0x00) + +#define SCC_SRC_CC_RELEASE \ + SCC_SRC_16_2, \ + ASE_SRC_RELEASE + +static struct test_config cfg_snk_cc_release = { + .cc = LC3_CONFIG_16_2, + .qos = QOS_UCAST, + .snk = true, + .state_func = state_cc_release, +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 080101 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0801010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 0300 + */ +#define ASE_SNK_RELEASE \ + IOV_DATA(0x52, 0x22, 0x00, 0x08, 0x01, 0x01), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x16, 0x00, 0x03, 0x00) + +#define SCC_SNK_CC_RELEASE \ + SCC_SNK_16_2, \ + ASE_SNK_RELEASE + +static void state_qos_release(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_QOS: + id = bt_bap_stream_release(data->stream, bap_release, data); + g_assert(id); + break; + } +} + +static struct test_config cfg_src_qos_release = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_QOS, + .state_func = state_qos_release, +}; + +#define SCC_SRC_QOS_RELEASE \ + SCC_SRC_16_2_1, \ + ASE_SRC_RELEASE + +static struct test_config cfg_snk_qos_release = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_QOS, + .state_func = state_qos_release, +}; + +#define SCC_SNK_QOS_RELEASE \ + SCC_SNK_16_2_1, \ + ASE_SNK_RELEASE + +static void state_enable_release(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_ENABLING: + id = bt_bap_stream_release(data->stream, bap_release, data); + g_assert(id); + break; + } +} + +static struct test_config cfg_src_enable_release = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_ENABLING, + .state_func = state_enable_release, +}; + +#define SCC_SRC_ENABLE_RELEASE \ + SCC_SRC_ENABLE, \ + ASE_SRC_RELEASE + +static struct test_config cfg_snk_enable_release = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_ENABLING, + .state_func = state_enable_release, +}; + +#define SCC_SNK_ENABLE_RELEASE \ + SCC_SNK_ENABLE, \ + ASE_SNK_RELEASE + +static void state_start_release(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_STREAMING: + id = bt_bap_stream_release(data->stream, bap_release, data); + g_assert(id); + break; + } +} + +static struct test_config cfg_src_start_release = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_STREAMING, + .state_func = state_start_release, +}; + +#define SCC_SRC_START_RELEASE \ + SCC_SRC_ENABLE, \ + ASE_SRC_START, \ + ASE_SRC_RELEASE + +static void state_disable_release(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_DISABLING: + id = bt_bap_stream_release(data->stream, bap_release, data); + g_assert(id); + break; + } +} + +static struct test_config cfg_src_disable_release = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_DISABLING, + .state_func = state_disable_release, +}; + +#define SCC_SRC_DISABLE_RELEASE \ + SCC_SRC_DISABLE, \ + ASE_SRC_RELEASE + +/* Test Purpose: + * Verify that a Unicast Client IUT can release an ASE by initiating a Release + * operation. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic with the + * opcode set to 0x08 (Release) and the specified parameters. + */ +static void test_scc_release(void) +{ + define_test("BAP/UCL/SCC/BV-106-C [UCL SNK Release in Codec Configured" + " state]", + test_client, &cfg_src_cc_release, SCC_SRC_CC_RELEASE); + define_test("BAP/UCL/SCC/BV-107-C [UCL SRC Release in Codec Configured" + " state]", + test_client, &cfg_snk_cc_release, SCC_SNK_CC_RELEASE); + define_test("BAP/UCL/SCC/BV-108-C [UCL SNK Release in QoS Configured" + " state]", + test_client, &cfg_src_qos_release, SCC_SRC_QOS_RELEASE); + define_test("BAP/UCL/SCC/BV-109-C [UCL SRC Release in QoS Configured" + " state]", + test_client, &cfg_snk_qos_release, SCC_SNK_QOS_RELEASE); + define_test("BAP/UCL/SCC/BV-110-C [UCL SNK Release in Enabling state]", + test_client, &cfg_src_enable_release, + SCC_SRC_ENABLE_RELEASE); + define_test("BAP/UCL/SCC/BV-111-C [UCL SRC Release in Enabling or" + " Streaming state]", + test_client, &cfg_snk_enable_release, + SCC_SNK_ENABLE_RELEASE); + define_test("BAP/UCL/SCC/BV-112-C [UCL SNK Release in Streaming state]", + test_client, &cfg_src_start_release, + SCC_SRC_START_RELEASE); + define_test("BAP/UCL/SCC/BV-113-C [UCL SNK Release in Disabling state]", + test_client, &cfg_src_disable_release, + SCC_SRC_DISABLE_RELEASE); +} + static void test_scc(void) { test_scc_cc_lc3(); @@ -2435,6 +2695,7 @@ static void test_scc(void) test_scc_qos_vs(); test_scc_enable(); test_scc_disable(); + test_scc_release(); } int main(int argc, char *argv[])