From patchwork Fri Oct 8 19:36:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tedd Ho-Jeong An X-Patchwork-Id: 12546247 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 110B1C433EF for ; Fri, 8 Oct 2021 19:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAF2060F9E for ; Fri, 8 Oct 2021 19:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241371AbhJHTi1 (ORCPT ); Fri, 8 Oct 2021 15:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhJHTi1 (ORCPT ); Fri, 8 Oct 2021 15:38:27 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B413C061570 for ; Fri, 8 Oct 2021 12:36:31 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id g184so4050252pgc.6 for ; Fri, 08 Oct 2021 12:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tb8KnJ3skiflfLlObqVQY/XrKpSYGl1Yg0t7YexW514=; b=TcjUi+lovGvlow/R/ZF85WDOODVEn3ApxdYgOHReMhqDw+x8v1u8C62mhvw8ykzTET cW1LMjE5IbpI9xIQENWh3MwwSbeQ2JE3W3fyNf9DCpe6ABO3EkxNq7Js4QubKJcGYZ69 zYufI410ur8Fr0BTWcvpigUUMw4mLV8ELv+lI/7CQfkSpz1vHl53mvd6LLVbSPCkvQap NTgLjEwngKvqC0pBtcGoBE9eU9CFmOfKKL80ubwyGk3OcZ2fDEeNTJ+ZOzgk55v/fDAc AbV4vuqpEfR1Q5eYCZqid/neF+R/AXIUOawcxUKURvgZaJJgyFWyo/Juz5kdZsddCEIg YiDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tb8KnJ3skiflfLlObqVQY/XrKpSYGl1Yg0t7YexW514=; b=hWuL2cF10zT9w9LTrRRfQgET3cYCGBrnWZSCEKnZqfut8vQeFbUaX7pR62LT3BOgmQ ZLJGldoLiK3SGgs4lFAj1lD601DW061cjLD3cwwmK3FjSo1Xcr49hFDs2K7J8I1PQNW4 kBboHQGCvaRa0mDGF8iTLekmMxGygMB828zuGYhcP5OAvAswyU0d4YhVjI6CALM0GA7a x1zNJBmJKM2uWghfzkV+xS8Op1WtvUD7AigDPguexQZAchPcPfbc5O+3WunomsQBed92 5a27jNLNv21zgFePIMg4pRZ8VYe3rvUc7kxF8GkgQ3LxtUDL6xBnpG58ooL7rEmaeTsd V93g== X-Gm-Message-State: AOAM532Ot3b/66jhPzEQhAtuNWY61zXOhaGJ/58SJHegz0fcAWbWdeIf 2ghB8yjuw3b7mey/gG2u3Lf9hE7ZH7f89w== X-Google-Smtp-Source: ABdhPJycEoi38+fSjrVtTPjp5G5y67NYC7ruPKEDPH5jydOoL4cXDb8QSGFWttBStshLgmmlLTn5NA== X-Received: by 2002:a63:5b1d:: with SMTP id p29mr6202350pgb.301.1633721790801; Fri, 08 Oct 2021 12:36:30 -0700 (PDT) Received: from han1-NUC8i7BEH.hsd1.or.comcast.net ([2601:1c0:6a01:d830:3e91:8dc3:f28b:c60b]) by smtp.gmail.com with ESMTPSA id g23sm137616pfu.71.2021.10.08.12.36.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 12:36:29 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 1/3] doc/tester-config: Enable Runtime Debugging Feature Date: Fri, 8 Oct 2021 12:36:26 -0700 Message-Id: <20211008193628.39347-1-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An This patch adds CONFIG_BT_FEATURE_DEBUG=y in tester config to enable the runtime debug option. --- doc/tester.config | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/tester.config b/doc/tester.config index 892fd5eb3..011475661 100644 --- a/doc/tester.config +++ b/doc/tester.config @@ -32,6 +32,7 @@ CONFIG_BT_LE=y CONFIG_BT_HS=y CONFIG_BT_MSFTEXT=y CONFIG_BT_AOSPEXT=y +CONFIG_BT_FEATURE_DEBUG=y CONFIG_BT_HCIVHCI=y From patchwork Fri Oct 8 19:36:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tedd Ho-Jeong An X-Patchwork-Id: 12546249 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F33DC433F5 for ; Fri, 8 Oct 2021 19:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80E1660FF2 for ; Fri, 8 Oct 2021 19:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241460AbhJHTi2 (ORCPT ); Fri, 8 Oct 2021 15:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhJHTi1 (ORCPT ); Fri, 8 Oct 2021 15:38:27 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BE4C061570 for ; Fri, 8 Oct 2021 12:36:32 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id oa6-20020a17090b1bc600b0019ffc4b9c51so10032406pjb.2 for ; Fri, 08 Oct 2021 12:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+XKnD4GJOUG4ZpJH3cxocRx3+YDLNLBV8VWzd6UmmAI=; b=nlnFT/fDhSDkW/+0Gk4tk1Tsyi/8OPRN0W0jqGPi2VNvfH+ZNSDMFTqsoD4E/lVCMC EU/s1vitdgd27OozkNn3cfmXIVILYm/n9G/SXx3F+cEZqybdzHHyhpA2YMHXkZ2dD83s HKLZkoPZb14STYPVfgrIC3EzoZcfJdXkkeKndUzoPm1Bm+sbSeUznypA0btgeCTtSEw7 n4hUDGZ6pzfQb0ZiWou93iNjskKlG7BIWNR/4kJAPlWsJuhqy7cTqDEYvHj7mMjxMXV/ iExGb3l0sKpTuHbWY5AqpxGBdRfDHinmn6Qm/j0q9w6sgboMR+HVKlrFEbEDNMZu/mnv hjiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+XKnD4GJOUG4ZpJH3cxocRx3+YDLNLBV8VWzd6UmmAI=; b=zd4a5NrGht2dhGlqTgZiHpqNpM7LDToqn/MYBvz0zUnciLcXDcKeQNgDloXnkKFpzt lBS52ODFHOoCP4z6vzAsQ7DuIyiksjiIZtLZjKjl2Pf5BKYtTZPr749xvHyRsyBGjiQl 4kVn1vQl24SWD+Mh6FuDl3MDNOZm0UutWYYvuecOrRV4AB9AeCx3esgSOt6Vz26hGj+Y v1w2B9D3qlEhDvH1j4Y+HPkykixHyzGe2+C9C2p6X1toOOihmKzd7SCefnJ/S7C/yQ8W rr3JclZ40lrlikulKPVFMfeMRvDAVMyCMikdX3B1pteKfNYGSAtIJJZxXvni3jrdDjWj ofvA== X-Gm-Message-State: AOAM531D/zGOSvDqe+VGcesuTkX8063QNOn80W4F2TNPkRFMOk/QolBn sBGiXACRM93DN9jGYvOTwKenDWlDaRpybA== X-Google-Smtp-Source: ABdhPJxYrVx6faneX/PSTUhMm4F+1zWtbUglLE34PEgwH+OzemVOO0x3cYIczuaJ0l5IowJKHIvPiA== X-Received: by 2002:a17:90a:b78d:: with SMTP id m13mr14331322pjr.17.1633721791531; Fri, 08 Oct 2021 12:36:31 -0700 (PDT) Received: from han1-NUC8i7BEH.hsd1.or.comcast.net ([2601:1c0:6a01:d830:3e91:8dc3:f28b:c60b]) by smtp.gmail.com with ESMTPSA id g23sm137616pfu.71.2021.10.08.12.36.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 12:36:31 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 2/3] tools/mgmt-tester: Updates Experimental Feature test cases Date: Fri, 8 Oct 2021 12:36:27 -0700 Message-Id: <20211008193628.39347-2-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211008193628.39347-1-hj.tedd.an@gmail.com> References: <20211008193628.39347-1-hj.tedd.an@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An This patch updates/adds test cases for Read and Set Experimental Feature commands. --- tools/mgmt-tester.c | 92 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 1a2aba7fd..84d81c8ca 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -390,8 +390,8 @@ static void debug_exp_feature(struct test_data *data) tester_print("Enabling Debug feature"); mgmt_send(data->mgmt, MGMT_OP_SET_EXP_FEATURE, MGMT_INDEX_NONE, - sizeof(set_exp_feat_param_debug), set_exp_feat_param_debug, - debug_exp_callback, NULL, NULL); + sizeof(set_exp_feat_param_debug), set_exp_feat_param_debug, + debug_exp_callback, NULL, NULL); } static void read_index_list_callback(uint8_t status, uint16_t length, @@ -9702,6 +9702,23 @@ static const struct generic_data read_exp_feat_success = { .expect_len = sizeof(read_exp_feat_param_success), }; + +static const uint8_t read_exp_feat_param_success_index_none[] = { + 0x01, 0x00, /* Feature Count */ + 0x1c, 0xda, 0x47, 0x1c, 0x48, 0x6c, /* UUID - Debug */ + 0x01, 0xab, 0x9f, 0x46, 0xec, 0xb9, + 0x30, 0x25, 0x99, 0xd4, + 0x00, 0x00, 0x00, 0x00, /* Flags */ +}; + +static const struct generic_data read_exp_feat_success_index_none = { + .send_index_none = true, + .send_opcode = MGMT_OP_READ_EXP_FEATURES_INFO, + .expect_status = MGMT_STATUS_SUCCESS, + .expect_param = read_exp_feat_param_success_index_none, + .expect_len = sizeof(read_exp_feat_param_success_index_none), +}; + static uint16_t settings_powered_le_privacy[] = { MGMT_OP_SET_LE, MGMT_OP_SET_PRIVACY, MGMT_OP_SET_POWERED, 0 }; @@ -9720,6 +9737,20 @@ static const uint8_t set_exp_feat_rsp_param_ll_privacy[] = { 0x03, 0x00, 0x00, 0x00, /* Action - enable */ }; +static const uint8_t set_exp_feat_param_offload_codec[] = { + 0xaf, 0x29, 0xc6, 0x66, 0xac, 0x5f, /* UUID - Codec Offload */ + 0x1a, 0x88, 0xb9, 0x4f, 0x7f, 0xee, + 0xce, 0x5a, 0x69, 0xa6, + 0x01, /* Action - enable */ +}; + +static const uint8_t set_exp_feat_rsp_param_offload_codec[] = { + 0xaf, 0x29, 0xc6, 0x66, 0xac, 0x5f, /* UUID - Codec Offload */ + 0x1a, 0x88, 0xb9, 0x4f, 0x7f, 0xee, + 0xce, 0x5a, 0x69, 0xa6, + 0x01, 0x00, 0x00, 0x00, /* Action - enable */ +}; + static const struct generic_data set_exp_feat_enable_ll_privacy = { .send_opcode = MGMT_OP_SET_EXP_FEATURE, .send_param = set_exp_feat_param_ll_privacy, @@ -9727,6 +9758,44 @@ static const struct generic_data set_exp_feat_enable_ll_privacy = { .expect_status = MGMT_STATUS_SUCCESS, .expect_param = set_exp_feat_rsp_param_ll_privacy, .expect_len = sizeof(set_exp_feat_rsp_param_ll_privacy), + .expect_alt_ev = MGMT_EV_EXP_FEATURE_CHANGE, + .expect_alt_ev_len = sizeof(struct mgmt_ev_exp_feature_changed), +}; + +static void read_exp_feature_callback(uint8_t status, uint16_t length, + const void *param, void *user_data) +{ + if (status != MGMT_STATUS_SUCCESS) { + tester_setup_failed(); + return; + } + + tester_print("Received Read Experimental Features Info"); + + tester_setup_complete(); +} + +static void setup_set_exp_feature_alt(const void *test_data) +{ + struct test_data *data = tester_get_data(); + + /* Send the Read Experiemental Features Information command to receive + * the Experiemental Feature Changed event + */ + mgmt_send(data->mgmt_alt, MGMT_OP_READ_EXP_FEATURES_INFO, + data->mgmt_index, 0, NULL, + read_exp_feature_callback, NULL, NULL); +} + +static const struct generic_data set_exp_feat_offload_codec = { + .send_opcode = MGMT_OP_SET_EXP_FEATURE, + .send_param = set_exp_feat_param_offload_codec, + .send_len = sizeof(set_exp_feat_param_offload_codec), + .expect_status = MGMT_STATUS_SUCCESS, + .expect_param = set_exp_feat_rsp_param_offload_codec, + .expect_len = sizeof(set_exp_feat_rsp_param_offload_codec), + .expect_alt_ev = MGMT_EV_EXP_FEATURE_CHANGE, + .expect_alt_ev_len = sizeof(struct mgmt_ev_exp_feature_changed), }; static const uint8_t set_exp_feat_param_disable[17] = { 0x00 }; @@ -12434,12 +12503,29 @@ int main(int argc, char *argv[]) test_bredrle50("Read Exp Feature - Success", &read_exp_feat_success, NULL, test_command_generic); + + /* MGMT_OP_READ_EXP_FEATURE + * Read Experimental features - success (Index None) + */ + test_bredrle50("Read Exp Feature - Success (Index None)", + &read_exp_feat_success_index_none, + NULL, test_command_generic); + /* MGMT_OP_SET_EXP_FEATURE * Enable LL Privacy */ test_bredrle50("Set Exp Feature - Enable LL Privacy", &set_exp_feat_enable_ll_privacy, - NULL, test_command_generic); + setup_set_exp_feature_alt, + test_command_generic); + + /* MGMT_OP_SET_EXP_FEATURE + * Offload Codec + */ + test_bredrle50("Set Exp Feature - Offload Codec", + &set_exp_feat_offload_codec, + setup_set_exp_feature_alt, + test_command_generic); /* MGMT_OP_SET_EXP_FEATURE * Disable all features by sending zero UUID From patchwork Fri Oct 8 19:36:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tedd Ho-Jeong An X-Patchwork-Id: 12546251 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B08C433FE for ; Fri, 8 Oct 2021 19:36:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29DC561038 for ; Fri, 8 Oct 2021 19:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241495AbhJHTi3 (ORCPT ); Fri, 8 Oct 2021 15:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241464AbhJHTi2 (ORCPT ); Fri, 8 Oct 2021 15:38:28 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C68C061570 for ; Fri, 8 Oct 2021 12:36:33 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id j15so6817075plh.7 for ; Fri, 08 Oct 2021 12:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=z8YYKCB+IfdGnekxiETO+sQfpHyNoywNe3xx1ruQExw=; b=fI6zWe1wcnOO5Me/YhGoX+mvEEldBND5nEOcFnuEifQtCnbRseiaFWslBW4wNfPT8N KquyHKmC9vkrrhAS5kzt2UN3wbcyKYuJL123lPgX/HTGlGwoQHx82nwQ7eVi522T3EMO +O93tSe2XM+dFc1SCz8C3cEURU/jVwMq+1sj26EDte5era81tzFYL/UYhC5rpxYa76hM IcdcAI75X+uLIA9lO9Q2vlNuMT9dUQP6aqjZdLAFfbsX98ilBSc80Q6C3deYwWLgZkV8 cQjhzL4ljx58OHGhdHtDxhB7QJEXHzDCiv9zATCzYPEDEPZMz6dVscOFAngd2CA6ouIl /X6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z8YYKCB+IfdGnekxiETO+sQfpHyNoywNe3xx1ruQExw=; b=hpHTU/M1ZsmFhZ6zIWYW6iA7U2dYk4TIeE26IR9PEt38PxMB2QFWKrhyOx3UftUmKD ksUoqJ26yO8sIwdrBMH7nwhVLt+Jnrjl9yG/GkFtXD71RxwM1sZexVTThx5SMT/DFdZS 5JrXIfz/i3e2NFvMYj/hvMAbRZJdv8cctUyjaMOblNraTaIyLzDawkZaFWDHSBwrjqoM 9ekOS33ApQFaBnxM58YsA6JiLDHFhNXa5q5paaoNoQSOsr1Zoq7GyZU9MwcSFcaM+Jrl Plh/wRL72ravcgg2dXdoSrqQFSyX1/PDywpDr/Emv8lyTapVMBzBsNnQioF2XJudU/+8 gGKQ== X-Gm-Message-State: AOAM532KJAss9kC4RmRAUz9afgy59NecIajJ+Ee6UyJHpz/GKEjP+IUJ n+nkynmWJwmparag3lVFzNj3kJfmSc4OlA== X-Google-Smtp-Source: ABdhPJx3j8OVDF5IB2j71YzOTvh1yrWW2ENZps/+zPwvBBhyw2lkclGGApNRMhq8cvNloviChfLkyg== X-Received: by 2002:a17:902:e544:b0:13e:e863:6cd2 with SMTP id n4-20020a170902e54400b0013ee8636cd2mr10990105plf.41.1633721792350; Fri, 08 Oct 2021 12:36:32 -0700 (PDT) Received: from han1-NUC8i7BEH.hsd1.or.comcast.net ([2601:1c0:6a01:d830:3e91:8dc3:f28b:c60b]) by smtp.gmail.com with ESMTPSA id g23sm137616pfu.71.2021.10.08.12.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 12:36:31 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v3 3/3] tools/mgmt-tester: Add more suspend/resume test cases Date: Fri, 8 Oct 2021 12:36:28 -0700 Message-Id: <20211008193628.39347-3-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211008193628.39347-1-hj.tedd.an@gmail.com> References: <20211008193628.39347-1-hj.tedd.an@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An This patch adds more suspend/resuem test cases like - Discover -> Suspend - Discover -> Suspend -> Resume - Suspend -> Resume -> Suspend -> Resume --- tools/mgmt-tester.c | 171 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 164 insertions(+), 7 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 84d81c8ca..8bddf6b03 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -267,6 +267,7 @@ struct generic_data { uint16_t setup_send_len; const struct setup_mgmt_cmd *setup_mgmt_cmd_arr; bool send_index_none; + const void *setup_discovery_param; uint16_t send_opcode; const void *send_param; uint16_t send_len; @@ -7299,6 +7300,11 @@ proceed: param = privacy_param; } + if (*cmd == MGMT_OP_START_DISCOVERY) { + if (test->setup_discovery_param) + memcpy(param, test->setup_discovery_param, 1); + } + if (*cmd == MGMT_OP_SET_LE && test->setup_nobredr) { unsigned char off[] = { 0x00 }; mgmt_send(data->mgmt, *cmd, data->mgmt_index, @@ -10671,6 +10677,21 @@ static void trigger_force_suspend(void *user_data) } } +static void trigger_force_resume(void *user_data) +{ + bool suspend; + int err; + + /* Triggers the suspend */ + suspend = false; + tester_print("Set the system into Resume via force_suspend"); + err = set_debugfs_force_suspend(0, suspend); + if (err) { + tester_warn("Unable to disable the force_suspend"); + return; + } +} + static void test_suspend_resume_success_5(const void *test_data) { test_pairing_acceptor(test_data); @@ -10722,6 +10743,113 @@ static void test_suspend_resume_success_7(const void *test_data) test_command_generic(test_data); } +static const struct generic_data suspend_resume_success_8 = { + .setup_settings = settings_powered_le, + .send_opcode = MGMT_OP_START_DISCOVERY, + .send_param = start_discovery_le_param, + .send_len = sizeof(start_discovery_le_param), + .expect_status = MGMT_STATUS_SUCCESS, + .expect_param = start_discovery_le_param, + .expect_len = sizeof(start_discovery_le_param), + .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE, + .expect_hci_param = start_discovery_valid_ext_scan_enable, + .expect_hci_len = sizeof(start_discovery_valid_ext_scan_enable), + .expect_alt_ev = MGMT_EV_CONTROLLER_SUSPEND, + .expect_alt_ev_param = suspend_state_param_disconnect, + .expect_alt_ev_len = sizeof(suspend_state_param_disconnect), +}; + +static void test_suspend_resume_success_8(const void *test_data) +{ + test_command_generic(test_data); + tester_wait(1, trigger_force_suspend, NULL); +} + +static uint16_t settings_powered_le_discovery[] = { MGMT_OP_SET_LE, + MGMT_OP_SET_POWERED, + MGMT_OP_START_DISCOVERY, + 0 }; + +static const struct generic_data suspend_resume_success_9 = { + .setup_settings = settings_powered_le_discovery, + .setup_discovery_param = start_discovery_bredrle_param, + .setup_expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE, + .setup_expect_hci_param = stop_discovery_valid_ext_scan_disable, + .setup_expect_hci_len = sizeof(stop_discovery_valid_ext_scan_disable), + .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE, + .expect_hci_param = start_discovery_valid_ext_scan_enable, + .expect_hci_len = sizeof(start_discovery_valid_ext_scan_enable), + .expect_alt_ev = MGMT_EV_CONTROLLER_RESUME, + .expect_alt_ev_param = resume_state_param_non_bt_wake, + .expect_alt_ev_len = sizeof(resume_state_param_non_bt_wake), +}; + +static void trigger_force_suspend_9(void *user_data) +{ + trigger_force_suspend(user_data); +} + +static void setup_suspend_resume_success_9(const void *test_data) +{ + setup_command_generic(test_data); + tester_wait(1, trigger_force_suspend_9, NULL); +} + +static void test_suspend_resume_success_9(const void *test_data) +{ + test_command_generic(test_data); + tester_wait(2, trigger_force_resume, NULL); +} + +static const struct generic_data suspend_resume_success_10 = { + .setup_settings = settings_powered_le, + .expect_alt_ev = MGMT_EV_CONTROLLER_RESUME, + .expect_alt_ev_param = resume_state_param_non_bt_wake, + .expect_alt_ev_len = sizeof(resume_state_param_non_bt_wake), +}; + +static void resume_event(uint16_t index, uint16_t length, + const void *param, void *user_data) +{ + struct test_data *data = tester_get_data(); + const struct mgmt_ev_controller_resume *ev = param; + + mgmt_unregister(data->mgmt, data->mgmt_discov_ev_id); + + if (length != sizeof(*ev)) { + tester_warn("Incorrect resume event length"); + tester_setup_failed(); + return; + } + + tester_print("New Controller Resume event received"); + test_condition_complete(data); + tester_setup_complete(); +} + + +static void setup_suspend_resume_success_10(const void *test_data) +{ + struct test_data *data = tester_get_data(); + unsigned int id; + + tester_print("Registering Controller Resume notification"); + id = mgmt_register(data->mgmt, MGMT_EV_CONTROLLER_RESUME, + data->mgmt_index, resume_event, NULL, NULL); + /* Reuse the variable */ + data->mgmt_discov_ev_id = id; + test_add_condition(data); + + tester_wait(1, trigger_force_suspend, NULL); + tester_wait(2, trigger_force_resume, NULL); +} + +static void test_suspend_resume_success_10(const void *test_data) +{ + test_command_generic(test_data); + tester_wait(1, trigger_force_suspend, NULL); + tester_wait(2, trigger_force_resume, NULL); +} int main(int argc, char *argv[]) { @@ -12436,7 +12564,7 @@ int main(int argc, char *argv[]) * Run: Enable suspend via force_suspend * Expect: Receive the Suspend Event */ - test_bredrle50("Suspend/Resume - Success 1 (Suspend)", + test_bredrle50("Suspend - Success 1", &suspend_resume_success_1, NULL, test_suspend_resume_success_1); @@ -12445,7 +12573,7 @@ int main(int argc, char *argv[]) * Run: Enable suspend, and then resume via force_suspend * Expect: Receive the Resume Event */ - test_bredrle50("Suspend/Resume - Success 2 (Resume)", + test_bredrle50("Resume - Success 2", &suspend_resume_success_2, NULL, test_suspend_resume_success_2); @@ -12454,7 +12582,7 @@ int main(int argc, char *argv[]) * Run: Add new device, and enable suspend. * Expect: Receive the Suspend Event */ - test_bredrle50("Suspend/Resume - Success 3 (Device in WL)", + test_bredrle50("Suspend - Success 3 (Device in WL)", &suspend_resume_success_3, setup_suspend_resume_success_3, test_suspend_resume_success_3); @@ -12464,7 +12592,7 @@ int main(int argc, char *argv[]) * Run: Enable suspend * Expect: Receive the Suspend Event */ - test_bredrle50("Suspend/Resume - Success 4 (Advertising)", + test_bredrle50("Suspend - Success 4 (Advertising)", &suspend_resume_success_4, setup_suspend_resume_success_4, test_suspend_resume_success_4); @@ -12474,7 +12602,7 @@ int main(int argc, char *argv[]) * Run: Enable suspend * Expect: Receive the Suspend Event */ - test_bredrle("Suspend/Resume - Success 5 (Pairing - Legacy)", + test_bredrle("Suspend - Success 5 (Pairing - Legacy)", &suspend_resume_success_5, NULL, test_suspend_resume_success_5); @@ -12483,7 +12611,7 @@ int main(int argc, char *argv[]) * Run: Enable suspend * Expect: Receive the Suspend Event */ - test_bredrle("Suspend/Resume - Success 6 (Pairing - SSP)", + test_bredrle("Suspend - Success 6 (Pairing - SSP)", &suspend_resume_success_6, setup_pairing_acceptor, test_suspend_resume_success_5); @@ -12493,10 +12621,39 @@ int main(int argc, char *argv[]) * Run: Enable suspend via force_suspend * Expect: Receive the Suspend Event */ - test_bredrle50("Suspend/Resume - Success 7 (Suspend/Force Wakeup)", + test_bredrle50("Suspend - Success 7 (Suspend/Force Wakeup)", &suspend_resume_success_7, NULL, test_suspend_resume_success_7); + /* Suspend/Resume + * Setup : Power on + * Run: Start discover and enable suspend + * Expect: Receive the Suspend Event + */ + test_bredrle50_full("Suspend - Success 8 (Discovery/Suspend)", + &suspend_resume_success_8, + NULL, test_suspend_resume_success_8, 4); + + /* Suspend/Resume + * Setup : Power on, start discovery + * Run: Start discover, enable suspend and resume. + * Expect: Receive the Resume Event + */ + test_bredrle50_full("Resume - Success 9 (Discovery/Suspend/Resume)", + &suspend_resume_success_9, + setup_suspend_resume_success_9, + test_suspend_resume_success_9, 4); + + /* Suspend/Resume + * Setup : Power on + * Run: Suspend, Resume, Suspend, and Resume + * Expect: + */ + test_bredrle50_full("Resume - Success 10 (Multiple Suspend/Resume)", + &suspend_resume_success_10, + setup_suspend_resume_success_10, + test_suspend_resume_success_10, 6); + /* MGMT_OP_READ_EXP_FEATURE * Read Experimental features - success */