From patchwork Sat Oct 8 01:14:08 2022 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: 13001576 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F1EEC433F5 for ; Sat, 8 Oct 2022 01:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbiJHBOP (ORCPT ); Fri, 7 Oct 2022 21:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiJHBOO (ORCPT ); Fri, 7 Oct 2022 21:14:14 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DB4EB48A9 for ; Fri, 7 Oct 2022 18:14:13 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id a5-20020a17090aa50500b002008eeb040eso7942571pjq.1 for ; Fri, 07 Oct 2022 18:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=aWZTAG1Eih+DouCQoHVwsrrhAQjYzIpkDznjhxpWO28=; b=SIC34xdGXg5QTnUb9/7diDr+rrIyWICcLB1XV0idxDpadqx0RF29pq20cv8uVLMirs y3/kGzNpGDtHJ/bAcUHS/YI6TdlfdTMiG8zzu8DvbjSZTCKrEYWYN6XjQPdAjhLNXTgF qOa2bPVCEVMwhQYHU398zpTUJWe+YCsxVgIhA9HVmUQg67Ij7WFewMdVCmLINTMpRCIq 0d2/A0s1yuP8MmE43i5TtdG+0sTae4u8+RvUC4qEQjab2OkfeF4yqAZQjnDdoQsCwljz jvz+jxLbz5auLaI/cOcY5lDeShfeqMDv95C1gFVHtwH5LgT0Eld2I7tGBqlrjdozKlYa SFUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=aWZTAG1Eih+DouCQoHVwsrrhAQjYzIpkDznjhxpWO28=; b=NfUpGB+uS3mSYcYJ/LAIkdaEI5lhoxRJLR8LVLJt4p/VtBoBKxGS+eeUrqoUPNfJCM TrNTTTm1gnhXkYuKFMWnVDqWGoQsFdidb0atYPWxEb25+pzAXKDBUiysPqIjjSToGwqj cYoq51VQgT86StIkc9dWDtDl1ZMVpdFti1l9hVUPSf3vLlrTUTkUsr924ynIgKAr7Bhi HcG0XUyBDPcZvDdgPptKUP0bMZA0kgEVWXIkBVUVh4bIhSsNFzON6rFuQRIiVdWhJUS/ gQR9aKmUKiZMWlbVU6kTB7995AUyHOgZPuOu781MGFui6rguKPHEdMf4a4Gw4SVvEYjm Mg/A== X-Gm-Message-State: ACrzQf0GNPjc0yUcRJ4GaJ+FFvwbFG2bcsj8V0+04q/kd/GjtanF6aMP cIOuKLxwAiWgS742VZuTe2bJIZtJRkGNcQ== X-Google-Smtp-Source: AMsMyM4qGzsRZbW+N//zRbWQDuVfvW5/2njjM/9R5srev+y0aBbLT7URlogRphjcnVGTdpfKvuMe+Q== X-Received: by 2002:a17:902:7786:b0:178:48c0:a083 with SMTP id o6-20020a170902778600b0017848c0a083mr7763119pll.125.1665191651864; Fri, 07 Oct 2022 18:14:11 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 131-20020a621989000000b00561969ea721sm2291938pfz.147.2022.10.07.18.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 18:14:11 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/3] btdev: Add support for setting bdaddr Date: Fri, 7 Oct 2022 18:14:08 -0700 Message-Id: <20221008011410.1907549-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds btdev_set_bdaddr so it is possible to set an arbritrary address. --- emulator/btdev.c | 10 ++++++++++ emulator/btdev.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index 3fdfb64a9eba..549f93645684 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -6960,6 +6960,16 @@ const uint8_t *btdev_get_bdaddr(struct btdev *btdev) return btdev->bdaddr; } +bool btdev_set_bdaddr(struct btdev *btdev, const uint8_t *bdaddr) +{ + if (!btdev || !bdaddr) + return false; + + memcpy(btdev->bdaddr, bdaddr, sizeof(btdev->bdaddr)); + + return true; +} + uint8_t *btdev_get_features(struct btdev *btdev) { return btdev->features; diff --git a/emulator/btdev.h b/emulator/btdev.h index 228bf205cf4b..cad5f699f801 100644 --- a/emulator/btdev.h +++ b/emulator/btdev.h @@ -72,6 +72,8 @@ bool btdev_set_debug(struct btdev *btdev, btdev_debug_func_t callback, void *user_data, btdev_destroy_func_t destroy); const uint8_t *btdev_get_bdaddr(struct btdev *btdev); +bool btdev_set_bdaddr(struct btdev *btdev, const uint8_t *bdaddr); + uint8_t *btdev_get_features(struct btdev *btdev); uint8_t btdev_get_scan_enable(struct btdev *btdev); From patchwork Sat Oct 8 01:14:09 2022 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: 13001577 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3A98C433F5 for ; Sat, 8 Oct 2022 01:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229618AbiJHBOT (ORCPT ); Fri, 7 Oct 2022 21:14:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiJHBOS (ORCPT ); Fri, 7 Oct 2022 21:14:18 -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 949C9B56FC for ; Fri, 7 Oct 2022 18:14:14 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id a23so5991351pgi.10 for ; Fri, 07 Oct 2022 18:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=IbF95eHZ2RUxmwb6nGp4/t/NK7QcVM0zQJIL6M3g4f0=; b=Q3oTVAP/UDd2j/4Wheoa9K4WH7sU+IdrlLU2+1sgMr1w/SDy3naiRzM3IKbkpbnlGI Na2+llm0VawdR1bz7WE+89JoJ4fbevISX0QAU8AsSUmMiJRASQ7bMZzmzA71qMo+0ScP qZCP3X06tWcDWsWyFxtlgFqjcSwvj7K2EBxRGPvrIwxbNnmKox9Am2lG7ogDMa3HYy1q cY4bQUVfB5tlsluWQYImLl+4NsTQ7xFxx+ST1x5NX4psaPdCMCbRJVhw8C5ca/R0rxqj kIY0GaynWa7KLiGY1XG9FwnvM1iKPVCSx3GAivjjkloiOQirjW3bFEcStTLNCvXj6mDK pg9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=IbF95eHZ2RUxmwb6nGp4/t/NK7QcVM0zQJIL6M3g4f0=; b=JkoUCx+SLtEH3w3uCl7m4ZGkg4Q0SfAeqSbTBWmIx1l8jW6DiO9IpQVuyB2fGHb846 sQHmp6jc9+tpXk3K1syf2kf/d/HvHA0Bw2/LA3r3JTY01zaiwteY/9eHgZHbo9MvSv2y yMlunobsXAd1Cx2LMyaw423aVc4n/7FNA3nPjJWl8HEMx0mMVJsPuAuhgqFEBzZ2yEBq U04V1nxlMJKCqXah9OYLA9s+2GSG8ol9XYcdwt8BlGo/lHhJi90ALr5FeIQDpjJWajk0 Scd3pHab80TZo3QWmHEYWEz8tKUjKfjp9sSBEyhWnGGirG6JIdQ2/nzqv2pITpIdj22P c2rQ== X-Gm-Message-State: ACrzQf0qAHSrMnIjEsiczDc8SGUoHJL30fwj9hFn3ImSZotdJZu9SmbW iWnfzxq6r6FDVGAFB8o0rLK/8uMHT2+0Fg== X-Google-Smtp-Source: AMsMyM7E/lv1JHqAOBUY6uV2SKwOPkcCKRGdBdwLtetfGvG5ScpYdT7xoreejqrkzjee5Vq/6Oszow== X-Received: by 2002:a63:186:0:b0:442:ee11:48a5 with SMTP id 128-20020a630186000000b00442ee1148a5mr6849845pgb.284.1665191653561; Fri, 07 Oct 2022 18:14:13 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 131-20020a621989000000b00561969ea721sm2291938pfz.147.2022.10.07.18.14.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 18:14:12 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 2/3] vhci: Add function to interact with force_static_address Date: Fri, 7 Oct 2022 18:14:09 -0700 Message-Id: <20221008011410.1907549-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221008011410.1907549-1-luiz.dentz@gmail.com> References: <20221008011410.1907549-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds functions that can be used to set debugfs force_static_address. --- emulator/vhci.c | 10 ++++++++++ emulator/vhci.h | 1 + 2 files changed, 11 insertions(+) diff --git a/emulator/vhci.c b/emulator/vhci.c index 4295e30ef980..a12b11e0f305 100644 --- a/emulator/vhci.c +++ b/emulator/vhci.c @@ -257,3 +257,13 @@ int vhci_set_emu_opcode(struct vhci *vhci, uint16_t opcode) { return btdev_set_emu_opcode(vhci->btdev, opcode); } + +int vhci_set_force_static_address(struct vhci *vhci, bool enable) +{ + char val; + + val = (enable) ? 'Y' : 'N'; + + return vhci_debugfs_write(vhci, "force_static_address", &val, + sizeof(val)); +} diff --git a/emulator/vhci.h b/emulator/vhci.h index c42e8bde1cd5..6da56cb589fe 100644 --- a/emulator/vhci.h +++ b/emulator/vhci.h @@ -28,3 +28,4 @@ int vhci_set_force_wakeup(struct vhci *vhci, bool enable); int vhci_set_msft_opcode(struct vhci *vhci, uint16_t opcode); int vhci_set_aosp_capable(struct vhci *vhci, bool enable); int vhci_set_emu_opcode(struct vhci *vhci, uint16_t opcode); +int vhci_set_force_static_address(struct vhci *vhci, bool enable); From patchwork Sat Oct 8 01:14:10 2022 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: 13001578 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03E57C433FE for ; Sat, 8 Oct 2022 01:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbiJHBOU (ORCPT ); Fri, 7 Oct 2022 21:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiJHBOT (ORCPT ); Fri, 7 Oct 2022 21:14:19 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 051D5B48A9 for ; Fri, 7 Oct 2022 18:14:16 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id bh13so6026519pgb.4 for ; Fri, 07 Oct 2022 18:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=qhM9uwt9zGCQSo0L+d9fkAjpX8v5G+qjdr2EHhc4mao=; b=Pnk5g1O4Bn/ZG5K9E+LVCxCSgBTXyJhOzvaYAGD3b46FO+qZYKrds93t0ecb0AR5cX i0v2fYFKxKlw0caTjavO3XTqu0NMKoXZITr4UkG3sj+wSzUNcOLB+G71sZdqTnZoyQff PNFskQ+DX0v3vtMH/jhHxaiHyIZSacKc+aIf8Yla+u28vM9TeKRUzP83PPa8UodzTUAN 1eGFhyVYQRVpnUyielW/v/Ey+yIvGx767BpcjS4ipjJ6ci9si8znNDZHCsJ81alsTfmM F+FDlwA95NIUtokQxP7pO3+gVZ9e3UE6Jof9ElWCkYeGvDHXsIZHxFbYWVE9uM0iSE1D bxOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=qhM9uwt9zGCQSo0L+d9fkAjpX8v5G+qjdr2EHhc4mao=; b=3ZNn4yTvAAr0uRZtoWV1i3zAOBcgf2uwEW6wZDHFLvbkBXhLgUa6P0f2qu2+9qpzvN L5yOW5QvJSWCJUDSi2EoAVtbRZN3ID9mcoFgGmSGgJG1b1j3W2baFQAU5ZeEvE3XVP+M n1SkxxRKwLxsPs6HE0NuLMM0K3V4LDyBuHF6AZ4rrewqWikCTC8FEqC8OdHwSuvihw9s fCP9ryim7I2WJKkYVGzreORHsf4H4nEv3SKK6HWBw9TNSGd8/SahipalEQsleGPaoUQn otrT2B08yRGAFFf1Yw94w2x1dwdm7wVff7cMjPynRx2sv5jfgHN7HUNFt0qvtdIroIvo agQg== X-Gm-Message-State: ACrzQf2FvoPXI6Kxqb0Ericp0f6CYNUK925gsc9XXUoku1I3XU4NUCwr mqX1/nhcMLfd/BXc23Qx6ZvNT5DPiDiAyg== X-Google-Smtp-Source: AMsMyM6uABNH7crH6fgFHihAhXUCpbA3kGllosx5nXfMNCnr1DXhiGxdWKwmoQd/Ypx+8ngiyC1aOA== X-Received: by 2002:a63:84c6:0:b0:45a:c93:988c with SMTP id k189-20020a6384c6000000b0045a0c93988cmr6794082pgd.605.1665191654921; Fri, 07 Oct 2022 18:14:14 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id 131-20020a621989000000b00561969ea721sm2291938pfz.147.2022.10.07.18.14.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 18:14:14 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 3/3] mgmt-tester: Fix Set Static Address tests Date: Fri, 7 Oct 2022 18:14:10 -0700 Message-Id: <20221008011410.1907549-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221008011410.1907549-1-luiz.dentz@gmail.com> References: <20221008011410.1907549-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Set Static Address tests needs to power after setting the address since the programming of the address using the HCI command only happens during power on procedure. --- tools/mgmt-tester.c | 63 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 7bb219953a7c..a56c38173fb7 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include "emulator/vhci.h" #include "emulator/bthost.h" #include "emulator/hciemu.h" +#include "emulator/btdev.h" #include "src/shared/util.h" #include "src/shared/tester.h" @@ -299,6 +301,7 @@ struct hci_entry { }; struct generic_data { + bdaddr_t *setup_bdaddr; bool setup_le_states; const uint8_t *le_states; const uint16_t *setup_settings; @@ -416,6 +419,16 @@ static void read_index_list_callback(uint8_t status, uint16_t length, if (tester_use_debug()) hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + if (test && test->setup_bdaddr) { + struct vhci *vhci = hciemu_get_vhci(data->hciemu); + struct btdev *btdev = vhci_get_btdev(vhci); + + if (!btdev_set_bdaddr(btdev, test->setup_bdaddr->b)) { + tester_warn("btdev_set_bdaddr failed"); + tester_pre_setup_failed(); + } + } + if (test && test->setup_le_states) hciemu_set_central_le_states(data->hciemu, test->le_states); @@ -4055,30 +4068,38 @@ static const struct generic_data unblock_device_invalid_param_test_1 = { static const char set_static_addr_valid_param[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0xc0 }; -static const char set_static_addr_settings[] = { 0x00, 0x82, 0x00, 0x00 }; +static const char set_static_addr_settings_param[] = { 0x01, 0x82, 0x00, 0x00 }; static const struct generic_data set_static_addr_success_test = { - .send_opcode = MGMT_OP_SET_STATIC_ADDRESS, - .send_param = set_static_addr_valid_param, - .send_len = sizeof(set_static_addr_valid_param), + .setup_bdaddr = BDADDR_ANY, + .setup_send_opcode = MGMT_OP_SET_STATIC_ADDRESS, + .setup_send_param = set_static_addr_valid_param, + .setup_send_len = sizeof(set_static_addr_valid_param), + .send_opcode = MGMT_OP_SET_POWERED, + .send_param = set_powered_on_param, + .send_len = sizeof(set_powered_on_param), .expect_status = MGMT_STATUS_SUCCESS, - .expect_param = set_static_addr_settings, - .expect_len = sizeof(set_static_addr_settings), + .expect_param = set_static_addr_settings_param, + .expect_len = sizeof(set_static_addr_settings_param), .expect_settings_set = MGMT_SETTING_STATIC_ADDRESS, .expect_hci_command = BT_HCI_CMD_LE_SET_RANDOM_ADDRESS, .expect_hci_param = set_static_addr_valid_param, .expect_hci_len = sizeof(set_static_addr_valid_param), }; -static const char set_static_addr_settings_dual[] = { 0x80, 0x00, 0x00, 0x00 }; +static const char set_static_addr_settings_dual[] = { 0x81, 0x80, 0x00, 0x00 }; static const struct generic_data set_static_addr_success_test_2 = { - .send_opcode = MGMT_OP_SET_STATIC_ADDRESS, - .send_param = set_static_addr_valid_param, - .send_len = sizeof(set_static_addr_valid_param), + .setup_send_opcode = MGMT_OP_SET_STATIC_ADDRESS, + .setup_send_param = set_static_addr_valid_param, + .setup_send_len = sizeof(set_static_addr_valid_param), + .send_opcode = MGMT_OP_SET_POWERED, + .send_param = set_powered_on_param, + .send_len = sizeof(set_powered_on_param), .expect_status = MGMT_STATUS_SUCCESS, .expect_param = set_static_addr_settings_dual, .expect_len = sizeof(set_static_addr_settings_dual), + .expect_settings_set = MGMT_SETTING_STATIC_ADDRESS, .expect_hci_command = BT_HCI_CMD_LE_SET_RANDOM_ADDRESS, .expect_hci_param = set_static_addr_valid_param, .expect_hci_len = sizeof(set_static_addr_valid_param), @@ -11386,6 +11407,23 @@ static void test_command_generic(const void *test_data) test_add_condition(data); } +static void setup_set_static_addr_success_2(const void *test_data) +{ + struct test_data *data = tester_get_data(); + struct vhci *vhci = hciemu_get_vhci(data->hciemu); + int err; + + /* Force use of static address */ + err = vhci_set_force_static_address(vhci, true); + if (err) { + tester_warn("Unable to set force_static_address: %s (%d)", + strerror(-err), -err); + tester_test_failed(); + return; + } + setup_command_generic(test_data); +} + static void check_scan(void *user_data) { struct test_data *data = tester_get_data(); @@ -13233,10 +13271,11 @@ int main(int argc, char *argv[]) test_le("Set Static Address - Success 1", &set_static_addr_success_test, - NULL, test_command_generic); + setup_command_generic, test_command_generic); test_bredrle("Set Static Address - Success 2", &set_static_addr_success_test_2, - NULL, test_command_generic); + setup_set_static_addr_success_2, + test_command_generic); test_bredrle("Set Static Address - Failure 1", &set_static_addr_failure_test, NULL, test_command_generic);