Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp203464pxb; Fri, 9 Apr 2021 23:47:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcFzUZCCmcZf5y5vnHwLdgB1hRBSoQXboGCizlx17o13h95uLeA93EKuB7DvODJE44IB9i X-Received: by 2002:a17:90a:31c1:: with SMTP id j1mr18052103pjf.4.1618037271764; Fri, 09 Apr 2021 23:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618037271; cv=none; d=google.com; s=arc-20160816; b=PYZrTB5WoxWwW7KK/5cV7QIu+h+O909g1eFYBLvrn/6tKq4WlExBx8dl8XOtD8WlRf PeqdtOB35k3ke1ep3viPOgxmdGctc01Bpx2SmrSO/9EZGv7FuoO6toolvQ5U/aEy8VRi GAK1LiK+hA/vlqXVh8bHVwlXEV3aUCthWmYKvLoX5R9zYFEaan0FL3yGmXfibkoQXE9C ppQMjY/7YJSID/SkaRwzgO5YA6VVnnJvm3lZcH/FotsgrDNfoy4MBqBuVntuiNgjayni wFqxjYnVbY0yvH1acts1WEtQVrEbqc0AGbSpYK4k3JJqoP8zxP4Hn3HZd0DhUyNekhXY jV1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gz45JGs4mR9u24B1XODhzi38OZP4jIhRO+oFSa+kj1E=; b=XDQIHJl5abkMW5cWFQrLaCTaotlqSSgA1mUYBtZd87IhWXwISVBVjvZo7wAqvPJdhA lCwaMMZAq3ogoevaoB9t576eq1LLWGaUDC9880NRIq1zQED06k751YM3N4a9NeA6jjbl tUQhV8OQkc8NN2SHO/9bNFbKViTCvnf0vR38AK41fEXjmrC2iXQdMmzc0JK2oG5aEbb2 XxXoRKZ/bFtUbOgt5iexZRhaNs2F1kBzN4Ij/34yVUVOg5ubclt1OAOad48mYbgCVbQx 0AFGvn/lzdE49sevt5ipFVmvcIsTsZtCyMMSyevhdiOTAuLWNpALMnwvPUruL+a+xn63 sW0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sJdif7Ao; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si4708637plx.209.2021.04.09.23.47.19; Fri, 09 Apr 2021 23:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sJdif7Ao; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbhDJGqX (ORCPT + 99 others); Sat, 10 Apr 2021 02:46:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhDJGqW (ORCPT ); Sat, 10 Apr 2021 02:46:22 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EEB6C061762 for ; Fri, 9 Apr 2021 23:46:08 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id r13so183650pjf.2 for ; Fri, 09 Apr 2021 23:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gz45JGs4mR9u24B1XODhzi38OZP4jIhRO+oFSa+kj1E=; b=sJdif7AouksV9sq1IuPofppXJI5KJ6qO8b2JAIGsP6VEoPJlLuOP1C0mW6sTGUwZ6W PsvsSi02bLrjgV+TdNWDbFeCyCJGXLKmCTAt5XI44jpT2SXICCCPXRHiv3uS0Fb5Z4YT wieGRztEiLNFnDdBAbYpOt2RSOuHcEpPdpPl2q2hpaBezzZfroHXfXsfsHBM1Nq4lUfM 878fn7mHNTZ4MxdUcrbqhCRmTr01IbuWlv+mBLCVKZHTNrJo9MysLNrzCjK3trRrWmtV aYWrZbfnj8FtcMQaI0bFwzOHTchpAmyZnGa591s+NQrdBl9GC9hN4Tj8Ohple+mtjrPs wA1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gz45JGs4mR9u24B1XODhzi38OZP4jIhRO+oFSa+kj1E=; b=hfLBeN40Tve02I/IbxAhjE5OyBjo/ut8ZFaRfM8s5fadpo9LzDcERCqEfKJrf713Zx 8KRoYpQrAHbsuLGZmeNjWmT5Qwjp/j0UQMRAXZ0o29qTI3jiLMnmKTRzU4OyufEAC0Hd FbgeGaMdZ532gj/e4pQJle/wygeWTTVFX7nYt+kD92p67ebKYgizrlmxyaeCZo2M8uuI SKv+v9NhXfbs/S7ZlFQkcly3HUhh+MB//D4C279cAukZjIufe+qMRTz6dQoVelg3601Q 7F2Y4QKuPKQ9bM6Fcz6vtSL2tg3H+NMee/iFt6Zc03blx+DoxYVD5Xq98sqloLuKLpvK 1jEQ== X-Gm-Message-State: AOAM5302D8ATqSnvgGkIpL8boTZBBe0x1VvUS/tBbF1vhHqQMkeeF7f5 NXj3BlG+1gnz0Vxbkxiacxa2Dyt4xR0= X-Received: by 2002:a17:902:ea0c:b029:e9:8ae7:408f with SMTP id s12-20020a170902ea0cb02900e98ae7408fmr12404469plg.4.1618037167585; Fri, 09 Apr 2021 23:46:07 -0700 (PDT) Received: from han1-XPS-13-9350.hsd1.or.comcast.net ([2601:1c0:6a01:d830:991a:5330:6700:5cc6]) by smtp.gmail.com with ESMTPSA id i22sm1155929pfq.170.2021.04.09.23.46.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 23:46:07 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/2] tools/mgmt-tester: Add param check callback for LE Set Adv Params Date: Fri, 9 Apr 2021 23:46:05 -0700 Message-Id: <20210410064605.287884-2-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410064605.287884-1-hj.tedd.an@gmail.com> References: <20210410064605.287884-1-hj.tedd.an@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An The interval_min and interval_max in LE Set Advertising Parameters command are changed/updated often whenever the values are tuned in the kernel, and it causes some tests failure. This patch adds a parameter check callback for LE Set Advertising Parameters command to ignore the interval_min and interval_max parameters. --- tools/mgmt-tester.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index ef37f0e03..b05ae4f27 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -910,6 +910,20 @@ static uint8_t set_connectable_off_scan_adv_param[] = { 0x00, /* filter_policy */ }; +static int set_connectable_off_scan_adv_check_func(const void *param, + uint16_t length) +{ + const uint8_t *received = param; + uint8_t *expected = set_connectable_off_scan_adv_param; + + /* Compare the received param with expected param, but ignore the + * min_internal and max_interval since these values are turned often + * in the kernel and we don't want to update the expected value every + * time. + */ + return memcmp(&received[4], &expected[4], length - 4); +} + static const struct generic_data set_connectable_off_le_test_2 = { .setup_settings = settings_powered_le_connectable_advertising, .send_opcode = MGMT_OP_SET_CONNECTABLE, @@ -922,6 +936,7 @@ static const struct generic_data set_connectable_off_le_test_2 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func }; static uint16_t settings_powered_le_discoverable[] = { @@ -949,6 +964,7 @@ static const struct generic_data set_connectable_off_le_test_3 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func }; static const struct generic_data set_connectable_off_le_test_4 = { @@ -964,6 +980,7 @@ static const struct generic_data set_connectable_off_le_test_4 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func }; static const char set_fast_conn_on_param[] = { 0x01 }; @@ -4750,6 +4767,7 @@ static const struct generic_data add_advertising_success_13 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_scan_adv_param, .expect_hci_len = sizeof(set_connectable_off_scan_adv_param), + .expect_hci_param_check_func = set_connectable_off_scan_adv_check_func }; static uint8_t set_connectable_off_adv_param[] = { @@ -4763,6 +4781,20 @@ static uint8_t set_connectable_off_adv_param[] = { 0x00, /* filter_policy */ }; +static int set_connectable_off_adv_check_func(const void *param, + uint16_t length) +{ + const uint8_t *received = param; + uint8_t *expected = set_connectable_off_adv_param; + + /* Compare the received param with expected param, but ignore the + * min_internal and max_interval since these values are turned often + * in the kernel and we don't want to update the expected value every + * time. + */ + return memcmp(&received[4], &expected[4], length - 4); +} + static const struct generic_data add_advertising_success_14 = { .setup_settings = settings_powered_le, .send_opcode = MGMT_OP_ADD_ADVERTISING, @@ -4774,6 +4806,7 @@ static const struct generic_data add_advertising_success_14 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_adv_param, .expect_hci_len = sizeof(set_connectable_off_adv_param), + .expect_hci_param_check_func = set_connectable_off_adv_check_func }; static const struct generic_data add_advertising_success_15 = { @@ -4814,6 +4847,7 @@ static const struct generic_data add_advertising_success_17 = { .expect_hci_command = BT_HCI_CMD_LE_SET_ADV_PARAMETERS, .expect_hci_param = set_connectable_off_adv_param, .expect_hci_len = sizeof(set_connectable_off_adv_param), + .expect_hci_param_check_func = set_connectable_off_adv_check_func }; static const char set_powered_off_le_settings_param[] = { -- 2.25.1