Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3017093rdb; Mon, 4 Dec 2023 14:16:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLia4OwPzZ3N/C3NoSs0sOMNywilmdL6xEO4sAx1aVjfZBbxpNd6jI7kWYPxeyACEzlxbX X-Received: by 2002:a17:902:b183:b0:1d0:8cc1:8d66 with SMTP id s3-20020a170902b18300b001d08cc18d66mr1804493plr.84.1701728161184; Mon, 04 Dec 2023 14:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701728161; cv=none; d=google.com; s=arc-20160816; b=O7KlVOi4KTsMLC9ZG1XRpRvuMWDKhnXFaxhjxf7tS9OVlNtyVWTd24QpmoK3WYc1Kl OXwKctiSy9h5EsTC5MgF1hmm2a9iC0CiwVNFtVijbv1ig1fUcquWSTYlFhYy7Lb8iCxV EsJcqZrGu6shxTx/MGUC1nZJ0FWoB6XFYRRkmiT8jjiuHHBW6eDZVuOKMPeHgSj7FWO1 MgpHga+XSXubazDp3AXgqi3x2X3H0OHMznDJm1UEHU1LKg31Jh1FiBNmQ2dcUL3Mkhy1 R7slalLYnn4buT5Dt8unITt9V9ZObA/Rv9PpCPIoOa5IQCNFqqO0p1MSMJbOQ1G2Dewj Aoig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=K3b7r1p1Ur3sHOjYjWNF6OJfv/yxkBqTEAW1r1VZz9c=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=Wjv7tXt7zAK9WJBt5G1l/JHCV4FHovQUYsncBYo/iWrSCSI68GRKjqG+0YvljhLE8F eUe2wqj8qX03P8M5F0f7WdbgUMpqVK8149lz/mW0OvP7ZIWV18MwpAlYcR8k1q44fP0a obEfA3ls+TUFmPvrVJB7tATmHi5lW/s9qzWcth2hD969+aK4WzAALITGnp9JTijz8L5c kIs1gg+yW8Oc05run2ONgWN1bJlxk0zvxK4VtzitUkag8j923QWxIW5v6HTUkuY6iN+u Ytq1hmiQXtJzXLYbwJdknbDoS1HQQvWyoIfG44ulIVyv188uSF30Yo9wdhXGI5NGFJsT ZgJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TY+fsEjr; spf=pass (google.com: domain of linux-bluetooth+bounces-380-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q8-20020a17090311c800b001c62139b164si261676plh.38.2023.12.04.14.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:16:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-380-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TY+fsEjr; spf=pass (google.com: domain of linux-bluetooth+bounces-380-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E1F5EB20AF0 for ; Mon, 4 Dec 2023 22:15:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9321A3A8E1; Mon, 4 Dec 2023 22:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TY+fsEjr" X-Original-To: linux-bluetooth@vger.kernel.org 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-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 Content-Transfer-Encoding: 8bit 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[]) -- 2.43.0