From patchwork Mon Dec 4 22:15:20 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: 750480 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZPyCoU59" Received: from mail-vs1-xe2d.google.com (mail-vs1-xe2d.google.com [IPv6:2607:f8b0:4864:20::e2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0C1A11F for ; Mon, 4 Dec 2023 14:15:31 -0800 (PST) Received: by mail-vs1-xe2d.google.com with SMTP id ada2fe7eead31-4649299d0a0so452118137.2 for ; Mon, 04 Dec 2023 14:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728130; x=1702332930; 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=ZPyCoU59VEW5jOte+AxyorIl9PMtBjZZfKd5Bh+epsWsKJ39/u4j7EHF4EEZEZ3J4J XUElAtJVJ7PvHtIkqxLHzU9tsVBJMf+A/HE7TzJ51+OiXxHf0kTsr95zV078z1oecPu8 fnhDv1NhEZvVcrfpiTu8BtH5UxJMD5oUAoh/skMMQDSVs5eg0o3n3YNn4wwEOFlp3Blj 3QvzzjIipYw5/fb+O5jI4kI4mTaYoxCcRFfDihXpyFvYAQL2nOpvw09X60b7TAo/NDIo Pr7ItjrzUGrcliATAfkR8hJ8TQxrC+kMKs23bfo928ckcmxJkIGUGy/i2hZkS+tnXlxR uGzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728130; x=1702332930; 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=EU15Y2G29hOPdZflAxziNl43FTumlOUWCe/HqB6pP4591nIyC088Pg6met2jGRXmwZ u7CLfzVzCqPQCUQxOueCrA6xKApoY5I/TsehfrVMaV5g4QT12WKCBbgTYzhQ8muO3gCi GHu3AKNXIH5DrLUiDYQniw8PI2Dk6r9jjYpe9xvcS4c+hVL0bjjnqUtSw6UNNF4sFRFF w4tUZHJhOdB4T9JfoA18e3kokru1JrrRvFgcRF31pPaEcJW+GDQWisCCGvc7wAq26SVi qnFHG5fuPAhZQkQnoz6f9IknucCgTWepax4vg8SwA1kYVse+zZTGeR9VgT0HOVuXpNNa g0PQ== X-Gm-Message-State: AOJu0YxUwiG0z66ALsYlT68H7LRZGoRNRi4+q1BMb1Bsrpx8Wyckv/GK Zd+zbBhn+oGLgJIVi/SKvNY+JoBL8W4= X-Google-Smtp-Source: AGHT+IGG8FrrOFXGqqTrEIp1WDdxwIEtN+fcfde3uBta4J+eLnUOv9FM3olngFtdVO0LkRJPHzX3Bg== X-Received: by 2002:a05:6102:302e:b0:464:6793:7fd1 with SMTP id v14-20020a056102302e00b0046467937fd1mr2476464vsa.33.1701728129929; Mon, 04 Dec 2023 14:15:29 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:29 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 1/8] shared/lc3: Add QoS definitions Date: Mon, 4 Dec 2023 17:15:20 -0500 Message-ID: <20231204221527.2990674-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 Mon Dec 4 22:15:21 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: 750079 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bzkanYFC" Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3004311F for ; Mon, 4 Dec 2023 14:15:35 -0800 (PST) Received: by mail-ua1-x92c.google.com with SMTP id a1e0cc1a2514c-7c5cb5eeab1so381903241.3 for ; Mon, 04 Dec 2023 14:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728132; x=1702332932; 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=bzkanYFC3vtCgnJ/7xiQ5xGA9WzNexttJ+J8p9+j/oRRS999NSGSC45VwrXMdAgTU5 RLkfxMlgOUUJfoyt98Z1VPmbbA62BpYxkudcSzK2t4zBqaVDEX8H62IvmQ5OkXroN/Iv KzHmNW06kXjSeA9ykiOcCPqFIBYDX4x8ZB+R6N4YwwU4mtmfkk8xKX2UTrlJ51cXCS9O HZZoP3lzj+3e2eOV+MZmV+kJyrpCcdwdZU9r85HQ9ySZkoaTq0C3e3gVKfld/03bkFvH gc4FetEhhb2Q0B7lH5Md1KdEzRKPP/lubbb3wR14hhlIIaAS06MA8KkTJaWUYcLo4dyo oqog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728133; x=1702332933; 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=u5GVFoa0NxFeAmw32Grw5pv2LmhdGEra884IWmx64GeGXb5xXgc9F82nY7RBR156aI JvM5vXvB5lLTs6vrXajHGuxYty7Ka2GQnMm8N77+v2ERUrvTATBsi2/yhPnoD3Q0uquQ T0nnM7Lv2G9F1JpcQwlSaD2N352mDbPvGza1aYXG+lYJ+lAi0OEj4N08HTzyoTOEd4Xj GNx/clicr4LlSYA+4fzbfAE9yPdjz7Y5d228lsaTX2n6HecEomaorxBmCWIYUBLYnO89 FtKhvZmZLvEJcRCoeGl3wgcIXOBLPi1aN3aQfIQ84HpyWj91/ZuGpnhaxXioSUEhmsar LNoQ== X-Gm-Message-State: AOJu0YywmxMaEPNT/Y1z+T23SbT256uv9q+udwilFJZi/llx3/7u49Wn ruHb0Gh1/1CvaHNtgIAowW+lBwvwSSw= X-Google-Smtp-Source: AGHT+IEVJBmO7YoBTJHyRbvzmbZiM83YugQMbNQ96r7pTEvi6Gw35n1BLl4tjewdAP/UAmEaIElkeA== X-Received: by 2002:a67:e347:0:b0:462:8ca2:1bb0 with SMTP id s7-20020a67e347000000b004628ca21bb0mr2782184vsm.20.1701728132213; Mon, 04 Dec 2023 14:15:32 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:30 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 2/8] test-bap: Introduce QoS tests for LC3 Date: Mon, 4 Dec 2023 17:15:21 -0500 Message-ID: <20231204221527.2990674-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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 Mon Dec 4 22:15:22 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: 750080 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TPLJV6xW" Received: from mail-vk1-xa2d.google.com (mail-vk1-xa2d.google.com [IPv6:2607:f8b0:4864:20::a2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6456134 for ; Mon, 4 Dec 2023 14:15:35 -0800 (PST) Received: by mail-vk1-xa2d.google.com with SMTP id 71dfb90a1353d-4b2dc44d54aso437195e0c.3 for ; Mon, 04 Dec 2023 14:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728133; x=1702332933; 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=TPLJV6xWWxhQATdsynfAiJW8XZGzqCSJNb6z8E1+zp61rqS9DiZOpHqGFEYE2B8nB7 EOabWFPwM/jV506RWKa8RgYjXfwYAoKy0WwSHP1GoMrD5vi/A6joYV12WTzG1a5xt8iU fMys55HwY/vV4sG9vdUza6F590YNnoHaxb9Cc6dnx1EvZpJhDzpLAHLZd0qxAzJyWFtn GnMg6YVYEO5jBBxBE/YE7xSTjNbCbibcu9CkZkaFSZzFcO3EK4XhWfapT7pYbfdgP7kv 9jQBfhcL4UzFPXJ5Jp5HfXTv3OcfKIw6J7AWrLP63y3vLDJ2OAEfItXCzL8KXD7v+P/c wRsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728133; x=1702332933; 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=ddFfqCcgBymZ8/I48+A0aAftL6d4cluk68JXlObNHwjewabdeiyw2GDNIMrDE2BD3Z bvpzrVfjoWi7RU3iP5hOVjdvPGRyhqX00ND99+5cjFj6czuRtIZBjWD0JHxAy4+4cb4u ut6JyOQnFVXK4ZfsXeeYkeDkLdDJ9dJwssMVSDnqs0yMNds+gh6Onbgqkw9BHYUhIoFg pkT/UrrdhOBAvFPKIkJABE7yQMgKQ7tBhieHEHPE0Mxh44bOO3yvT76fl5ZJa/p6rsc7 Vi9Vy8BWw/2E17bphjeOdBhFW1kjLDFqc3CklJ1o/4WeVHCkavaM6LveKtuR1yaW+Iqz OqSw== X-Gm-Message-State: AOJu0Yx0GIHv+e2MTH/cTqM/5cRQnAXbnZm3Tb9tnwGwUU62bECXLo79 Vmgf2nO6hfcKOEuP0iogysUSK5AYW7U= X-Google-Smtp-Source: AGHT+IEi2ONZrbxPxfbrSjURjouv4lco3XPthQuxzipgk9LcYbLxcv9lJUeIRpgxcG5s8QbaX/f5Qg== X-Received: by 2002:a67:e9d7:0:b0:464:8402:70e5 with SMTP id q23-20020a67e9d7000000b00464840270e5mr1839940vso.54.1701728133480; Mon, 04 Dec 2023 14:15:33 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:32 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 3/8] test-bap: Add SCC Config QoS, VS tests Date: Mon, 4 Dec 2023 17:15:22 -0500 Message-ID: <20231204221527.2990674-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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 Mon Dec 4 22:15: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: 750479 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XOAWTFpy" Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BB51183 for ; Mon, 4 Dec 2023 14:15:37 -0800 (PST) Received: by mail-vs1-xe29.google.com with SMTP id ada2fe7eead31-464811e5b3cso1406204137.1 for ; Mon, 04 Dec 2023 14:15:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728136; x=1702332936; 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=XOAWTFpyajHscvNBUJNflcu1YELR9cyYI9oJxZGdumlIrOh/4OZM6VWCu1tMaxiY4F VvKd44SNf8mn0OhdcPINO/7J6RyofGkm+PaB6nqPOGXL6yZOBkK8rFhngwMKh9UzRUhL /wdrFNKXkkzNtuD6PCp/oqyu8hH3Ct5M3q8gGNZHuMu/4FtImS3gTap3ffxzyXWXpSXj aqQYicWAUuoL/votVKs/OxHlzRvHFZ8rx7KZst6aDSKf+IdqR6IG25C4WWGC+vNzCpGA 01YmpMxpjmkidxzgxTJdjjR4NHPT35ItymE4IBNewvmRHOZluIkT2Iv6qTnHxSwLM9QW rvhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728136; x=1702332936; 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=V4CGftM6NV7EBoFVt+r4X3d0ZRK3Ht+Z9cfgNCbbKL1AkK6VBbGNY3SgX1rtDeELC4 a0nFEOd9r20qrheoRZgte7WU0m2Bcuqa13FVe/JrWjVIe13Xq0LHM/SmAX9gLXNo2bQ/ XqphzbFpX/DLTqdC0d/pw/dSX6kCJkKg0u2ozwJoOh2R7X6Z1AIV4AsMmvq+pyttj4ET nLdLkNqzdVNdu1IOdFyPzstSjoSuuHv5JHZ8rAPtzlfguaivipWGnShEFwGyR5KU8dPG TXc+EYB8jsJ/gGGFaxOhmYTpOw/9kuJYtLj6hWD2USPXQSI9eb4Cu6knw+ykeNMwKXTu Pnmw== X-Gm-Message-State: AOJu0Ywg7pourUucl7uwOLSUQJeT++tdP+NSMTSCU8dYu4m8su1/1RiF Ri2GJ3x5IzDYsGr+m9WpRPjkn55RsJ8= X-Google-Smtp-Source: AGHT+IFLsX6tkqAtUjB+vJaQLUx4T2hbT4PdCTFoi8HFx4y2uizQ4WhGbDPsk13HVkCnAHP34Kf8zw== X-Received: by 2002:a05:6102:390d:b0:464:9159:ba8e with SMTP id e13-20020a056102390d00b004649159ba8emr715773vsu.31.1701728135823; Mon, 04 Dec 2023 14:15:35 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:34 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 4/8] test-bap: Add SCC Enable tests Date: Mon, 4 Dec 2023 17:15:23 -0500 Message-ID: <20231204221527.2990674-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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 Mon Dec 4 22:15: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: 750478 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TY+fsEjr" Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C8D18A for ; Mon, 4 Dec 2023 14:15:39 -0800 (PST) Received: by mail-ua1-x932.google.com with SMTP id a1e0cc1a2514c-7c51dd41046so1000547241.2 for ; Mon, 04 Dec 2023 14:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728137; x=1702332937; 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=TY+fsEjrij7+R/9Uvf1WlDhAy75AtJwLKf7Lp9xVPshgHCp5AtNc+OUlJRVuWQNFtm bnJZ8BFKTKeUqRERofFjk7lA3C8r5dPbULwEttcMd3Z5xAxerqeAGjYGqrqbfTIV5z+N pYbn363g5r9JmxcrWXyq8qDWwHhOHKfXjDKauT9MThu0G+CQk1TMQ7/qThcX/Q/un3UN tJo6DPVKK0xEHhj3Hq8Z5lWcuJ7AzwHzVn942IEDKCpogMNODVgO+AU4ogALDLq5FVDz iOKrQnoLSw3faPOEkUl4caaJHYpXXJ30k8XUPaRV8jwhGvOQnmGsaxDPdi+j2iBEeKUb N5MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728137; x=1702332937; 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=shjrgSyHI4y1qZBXMsa22tagZmOTUBF6RBeX4XhHiyhVYi9SwANWxBa0QG7G1CZGxN SDw1XJkWwu4iddSZgYmmCDyTn2EguxYFkhDugKm6ktnyiPSjqMvLKmTlBcC/RUtabFjv bnM3/YCyHK+2h40C+4lHQHifIxOoXRWFKeoJ7eCONjK+lJ/J6PUAiT5KZDByh1AgqhGc MVL1of6IbMeuvrZdND9hGiJaoTIxn11K7s17sW49UQ4lToRnYMK04xG8P99sCLAysdJZ 6fPRIoeP6/LYRSSKuuztbUhwrwUxb76+5KALNMyzhATl8szGk2a3xlUGmBwJyfFtCx/T NUdw== X-Gm-Message-State: AOJu0YwX/tlYYMPoOWs9j1oOhe3iq7+kXYzgHEgMd3tNAAvqhBII6G4S xKpAz+Q2pzqmpoJDsUOZn1uALbYPPqI= X-Google-Smtp-Source: AGHT+IHdrJb7dApSKeu0WwkhokbtkJFv+hV366Cv8e3k3tS9MRXWYrf+7WDhPQd1cQpBYuvmFnNZLg== X-Received: by 2002:a67:fc14:0:b0:465:390b:3c96 with SMTP id o20-20020a67fc14000000b00465390b3c96mr10325vsq.2.1701728137340; Mon, 04 Dec 2023 14:15:37 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:36 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 5/8] test-bap: Add SCC Disable tests Date: Mon, 4 Dec 2023 17:15:24 -0500 Message-ID: <20231204221527.2990674-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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 Mon Dec 4 22:15: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: 750078 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="buXqQ5Yw" Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32BB518C for ; Mon, 4 Dec 2023 14:15:41 -0800 (PST) Received: by mail-ua1-x92b.google.com with SMTP id a1e0cc1a2514c-7c57aa2cce8so743804241.2 for ; Mon, 04 Dec 2023 14:15:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728139; x=1702332939; 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=buXqQ5Yw1LiITCujUGOtYJWfY6c5jPqcd5vyRNrWb13Gyg7Z+2DqZCSG9kF3bZkLcZ SKwETgtDMhJ7ObymE2mhM0bcbCRhUNNFKc4KTn5ai2iRwTvtD2ws+G++q82M2hC0LHsD XaDVgvo6lwe2Tqjc/8QlbTGh9/rtTl+2ce8PhEAQa2AkC9UIVnOh2EhcKAW3/K0oRWcy QfQFWprKSgF2eapEmhuDGMl7Pzw3hUdK8l700UtVReRyduKZ7BFxkHgpIBwFm5U3PBK5 jrweK/nw4GGUJGEVv1In9eDCTcIFrcCfTF9uFNm4SpeTGLToG3/ewfzEKNenMDyC/SMw tBng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728139; x=1702332939; 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=d3wX4DHrNLKWokscfJTVeZkjPVXgoMg4+kQoas9dSB7TO9/uAFy+AgjpXK0CY8xU3S 58aKnfiGo5hOLSzZpxSAjTBKoZyR/zX4J1YD/s1Obvjpi7h8SLBPYdXeJy6XGzQxxF0L EsCQ1BMG/+bXpna+vCVpnXlI/wEBixu5Ruj9XIOtC/neKjwUlv0+ueinpN1w5NA57XRS GYZ+KUbEFV/Zdupf7NXZoPBU2GN0BVZVLBQ+fseJ3PYRasrTImR7XMTBzJI+DeU7+PqP 7Ltwp7pbPqlQ5A9ZxlJKx4o1OLgptTCqP6hHn1D6LVrn9PGtkf6Et8XpIvvTw4+ZEF16 r20A== X-Gm-Message-State: AOJu0Ywy4KWSAk3oBRc9LMgbUHsRS+55ETBB3QVLu8WSWAZPrFsbHRQH HgxzQ/9mGGRYlMGekO+w8ZA3+BmPBRM= X-Google-Smtp-Source: AGHT+IEXBODAY9Gah9g+01wXQlVhE7TM6cQps4YupraO479w3sP4aDbNC7ftFpq1j/u/ozo39SG4Ug== X-Received: by 2002:a05:6102:292b:b0:464:4c9d:6f1d with SMTP id cz43-20020a056102292b00b004644c9d6f1dmr2017833vsb.23.1701728139616; Mon, 04 Dec 2023 14:15:39 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:37 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 6/8] shared/bap: Fix possible crash when freeing requests Date: Mon, 4 Dec 2023 17:15:25 -0500 Message-ID: <20231204221527.2990674-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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 Mon Dec 4 22:15: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: 750477 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NHAvW/Ra" Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0402D199 for ; Mon, 4 Dec 2023 14:15:42 -0800 (PST) Received: by mail-ua1-x92c.google.com with SMTP id a1e0cc1a2514c-7c57aa2cce8so743809241.2 for ; Mon, 04 Dec 2023 14:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728141; x=1702332941; 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=NHAvW/Ray7QSKq7tGInEUDJKChcp14ILTf76EV5EomKUowyWwb9apDbariPHXNmvUu 0z+nhnPb4evUxHTWz1vMjfZ9WNT8BLp51uVOcgU2D+p4ykQKU6wARsKJdPMmwaan78lX MKBz5QqNiC49qtTmfteN6UxreVrNyp8DdduKecxJEp4NFLhnHjDN6fTFRrudQRpbscv0 KHaGDhP5JxzIcIHAWUvQdLtZdTYDiuxVxeYp9O+0HDefy2yj87VZwPnBgxCgoRQA1XXd U2OeRjMd1I7DbJygph1bsrLOq2ZTCQ/3BBiKoTV6uOd/Gai616bJlqOxTPGZFvMlLWmI 7TJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728141; x=1702332941; 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=Y2AnpR0b2YM9dz9XdUE/KOYJTeqQ6ok8TSPWPNvermLqZ08EoFcKbx/OfrFqzY1MHk vhzFGnzyuhvLhOChGtOMxLjScnnZbXy9BMNIgH7A4BRSDmW1Wt/JvWQvzPB4SbLkyoYM ShLSEXtEkYWTt+SRpL62aOG6nLN6K/fHOSKL4A4JTRH73/sSPpdeaAY1q36KTPK6+GZm SHUU+Mbqt8UcoGoVZCHkVnYw9klrCvW4WEQ/ltOs/rV79ZItF2gG9RTmH63d3jwCmAb4 CYzoRqeI74+9tXPIz0CpXyG64rtXk4NTJ5uHpfV220Dlk4a1PyhNKEYNYNkn8iIkPwB4 EWQQ== X-Gm-Message-State: AOJu0YxZcayOROuQjDae+LdZfgBl1rt+D1coJeKGVI3F2+AY9j8Ki9ZU JxtPgJrSTcQlYiEyYEW0v73mpoLxHsA= X-Google-Smtp-Source: AGHT+IFtaxLla+xZ6YRzWBFP3uDmscugb7hwAPTOQvEpJgbhGnIGPbzoNVfe0Aicop6dM+Cc7K9+pA== X-Received: by 2002:a67:e8d5:0:b0:461:fb:1d6c with SMTP id y21-20020a67e8d5000000b0046100fb1d6cmr1995283vsn.5.1701728141334; Mon, 04 Dec 2023 14:15:41 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:40 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 7/8] test-bap: Add SCC Release tests Date: Mon, 4 Dec 2023 17:15:26 -0500 Message-ID: <20231204221527.2990674-7-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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[]) From patchwork Mon Dec 4 22:15: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: 750077 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hEieu81S" Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F46D138 for ; Mon, 4 Dec 2023 14:15:45 -0800 (PST) Received: by mail-vs1-xe31.google.com with SMTP id ada2fe7eead31-464752da340so629461137.3 for ; Mon, 04 Dec 2023 14:15:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701728143; x=1702332943; 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=R6VARjn0CWiByFx2DKSnsDI32pinxmI34vf9VNZr5tg=; b=hEieu81S17cNSnuTBcAweFOPO7d03L+dlGXFMYlGrn6oZyDe6oRoqWaeBGJOXJx3p9 /c4tyCbwHtxfiEGiEL99mcDrK3dWSvKzhqsU05qAs5rsPMK4ntgxxx4cYGxBiHdh5F9y cqJTVELlSQCAI93hGAdGPHBW6sjeXk4rhEUyIVcPgSHxU8YWWl74tyncNumkM2MnE98h Du0ULXSupsjOKKPt3VfEIuiQKGrgZ+ifi7UKBb8O4EPF4zkI+dE/XgeIaa1rzb3y0e/A h4Vwv7nJXeeNXQ9Quws0KXLUFPj83kOmEDqXsYXaQ5wMj8HgbXN153/jSqSTsQY5vTKp ibVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728143; x=1702332943; 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=R6VARjn0CWiByFx2DKSnsDI32pinxmI34vf9VNZr5tg=; b=gT6vTfOL5BG6dZ2WyLZH/GEMe7fbRD2YrcBVJkLMFtu4qiRqTXV1R1hHIMQd690gv1 CvDaXEDEBJ4B6HT14AluK7DkTTfuMk9NFtdlYlR7pmw1IRIvPnLrdRlrIkejyffiy+Nj 1ct82ZDiLvPIfOZprpLiE8qUulsRckdJjHmHHL/D0h4PKG4eVho+DBjZuEGbZlGig8RP nhu93WcrzRO1rCB2lfJZQtqpKbwpjg1TrqPRDy4zo3DnYNz/AFd6UjTogKUgK9Ggzjb4 MmrfS98dwtQm5xTF9vmh8uMBP86kzkUS5dSL/lcmQLL+YjhzZNKy6g1A9NFpPNG9M9eN ItGA== X-Gm-Message-State: AOJu0YwFEKVTM2OVVBc0Q7xaKKdHVexQX8IeLG6SqN9I9oCSiGL9n2lG 3vavrA1Oxbwb92q8S4EL4mXsard/G3o= X-Google-Smtp-Source: AGHT+IEUzrKwi4k7zWU+HJ3tCKyycGZCqwceofo30FVhb96x/iZS1rfWEPlyijL9bwdt0lfrzHaTSw== X-Received: by 2002:a67:f308:0:b0:464:5a0e:b62e with SMTP id p8-20020a67f308000000b004645a0eb62emr2907095vsf.14.1701728143008; Mon, 04 Dec 2023 14:15:43 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bl13-20020a056102508d00b0044d4e63aa03sm1136612vsb.25.2023.12.04.14.15.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:15:42 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v3 8/8] test-bap: Add SCC Update Metadata tests Date: Mon, 4 Dec 2023 17:15:27 -0500 Message-ID: <20231204221527.2990674-8-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231204221527.2990674-1-luiz.dentz@gmail.com> References: <20231204221527.2990674-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.8 Unicast Client Initiates Update Metadata Operation (Page 53): Test Purpose: Verify that a Unicast Client IUT can update the Metadata of an ASE by initiating an Update Metadata operation. Pass verdict: The IUT successfully writes to the ASE Control Point characteristic with the opcode set to 0x07 (Update Metadata) and the specified parameters. Test Summary ------------ BAP/UCL/SCC/BV-115-C [UCL SNK Update Metadata in Enabling State] Passed BAP/UCL/SCC/BV-116-C [UCL SRC Update Metadata in Enabling or Streaming state] Passed BAP/UCL/SCC/BV-117-C [UCL SNK Update Metadata in Streaming State] Passed Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0 --- unit/test-bap.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/unit/test-bap.c b/unit/test-bap.c index fa6e65219beb..ecd5e2897093 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -2687,6 +2687,144 @@ static void test_scc_release(void) SCC_SRC_DISABLE_RELEASE); } +static void bap_metadata(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + if (code) + tester_test_failed(); +} + +static void state_enable_metadata(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + struct iovec iov = {}; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_ENABLING: + id = bt_bap_stream_metadata(data->stream, &iov, bap_metadata, + data); + g_assert(id); + break; + } +} + +static struct test_config cfg_snk_metadata = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .snk = true, + .state = BT_BAP_STREAM_STATE_ENABLING, + .state_func = state_enable_metadata +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 07010100 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0701010000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x0016 + * Data: 01010102010a00204e00409c00204e00409c00_qos + */ +#define ASE_SNK_METADATA \ + IOV_DATA(0x52, 0x22, 0x00, 0x07, 0x01, 0x01, 0x00), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x07, 0x01, 0x01, 0x00, 0x00), \ + IOV_NULL, \ + IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x05, 0x00, 0x00, 0x4c, 0x1d, 0x00, \ + 0x00, 0x02, 0x1a, 0x00, 0x02, 0x08, 0x00, 0x40, 0x9c, \ + 0x00) + +#define SCC_SNK_METADATA \ + SCC_SNK_ENABLE, \ + ASE_SNK_METADATA + +static struct test_config cfg_src_metadata = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_ENABLING, + .state_func = state_enable_metadata +}; + +/* ATT: Write Command (0x52) len 23 + * Handle: 0x0022 + * Data: 07010300 + * ATT: Handle Value Notification (0x1b) len 7 + * Handle: 0x0022 + * Data: 0701030000 + * ATT: Handle Value Notification (0x1b) len 37 + * Handle: 0x001c + * Data: 030300000403020100 + */ +#define ASE_SRC_METADATA \ + IOV_DATA(0x52, 0x22, 0x00, 0x07, 0x01, 0x03, 0x00), \ + IOV_DATA(0x1b, 0x22, 0x00, 0x07, 0x01, 0x03, 0x00, 0x00), \ + IOV_NULL, \ + 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_METADATA \ + SCC_SRC_ENABLE, \ + ASE_SRC_METADATA + +static void state_start_metadata(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct test_data *data = user_data; + struct iovec iov = {}; + uint8_t id; + + switch (new_state) { + case BT_BAP_STREAM_STATE_STREAMING: + id = bt_bap_stream_metadata(data->stream, &iov, bap_metadata, + data); + g_assert(id); + break; + } +} + +static struct test_config cfg_src_metadata_streaming = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_STREAMING, + .state_func = state_start_metadata +}; + +#define SCC_SRC_METADATA_STREAMING \ + SCC_SRC_ENABLE, \ + ASE_SRC_START, \ + ASE_SRC_METADATA + +/* Unicast Client Initiates Update Metadata Operation + * + * Test Purpose: + * Verify that a Unicast Client IUT can update the Metadata of an ASE by + * initiating an Update Metadata operation. + * + * Pass verdict: + * The IUT successfully writes to the ASE Control Point characteristic with the + * opcode set to 0x07 (Update Metadata) and the specified parameters. + */ +static void test_scc_metadata(void) +{ + define_test("BAP/UCL/SCC/BV-115-C [UCL SNK Update Metadata in Enabling " + "State]", + test_client, &cfg_src_metadata, SCC_SRC_METADATA); + define_test("BAP/UCL/SCC/BV-116-C [UCL SRC Update Metadata in Enabling " + "or Streaming state]", + test_client, &cfg_snk_metadata, SCC_SNK_METADATA); + define_test("BAP/UCL/SCC/BV-117-C [UCL SNK Update Metadata in Streaming" + " State]", + test_client, &cfg_src_metadata_streaming, + SCC_SRC_METADATA_STREAMING); +} + static void test_scc(void) { test_scc_cc_lc3(); @@ -2696,6 +2834,7 @@ static void test_scc(void) test_scc_enable(); test_scc_disable(); test_scc_release(); + test_scc_metadata(); } int main(int argc, char *argv[])