From patchwork Wed Jun 23 04:49:40 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: 465984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE07CC48BC2 for ; Wed, 23 Jun 2021 04:49:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5534611C1 for ; Wed, 23 Jun 2021 04:49:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbhFWEwE (ORCPT ); Wed, 23 Jun 2021 00:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbhFWEwD (ORCPT ); Wed, 23 Jun 2021 00:52:03 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28971C061574 for ; Tue, 22 Jun 2021 21:49:47 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id p9so737312pgb.1 for ; Tue, 22 Jun 2021 21:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VeeLQxuj66jGVpXa6UNilbd/H4ckQmm68Ab/6lrUDk0=; b=AD0MW5jzRpPTvE/UmVY0O7XSMC/FLrnqmzN2S2cZXNKAJlo64djxMH2QcmnUHedM8j OPG6tbNwuCb+EwDEBpTFHVxs8ayUxuvu6oBkIc4FxrG6/Yv545EV5H9PpT0PioVNjL2Y 9mVfMCEu47bFG1NMI3ixz7upU27wxAwGyCv0mXdFaK19ejDJX9hLf3I02Row1f3dYIwZ L6HYnhNorx68Y3OeZGaJHj3rPyQSmQ4uRpUKlL4t/O5RuSJ3fqCnsHMho0aheJDwyBwK F2K179onLLWXJ9Lz32IqEvyYSvf40egHUCVGB7HTXK+svAnsNRgS9MzqRrI6LL3bayKD TEKA== 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:mime-version :content-transfer-encoding; bh=VeeLQxuj66jGVpXa6UNilbd/H4ckQmm68Ab/6lrUDk0=; b=Ck2GutEBhwu9W7br4EiqEG5SIpwwUKEfIiqRm+a/HrtJnkyLnMfdTG0IhIpywFpsDQ 5ZgX9cqn69EVU/Q7Wrak/X4+mjXSaqy4SLI97dYDe+KNtAMLmyXAw23JgU/AvdiaPmOa lA4oFwxjbK8yeD8nahykd+28THcB1nHwIntMsQKp0Ie6t3n9ky00ewWF1Vd/TCg/ZSdd DCXgbNh0uRyz9Q9iAZEggQND7Drj9KuxS5uKPAHT7GnbJAtEuXSIGeMuvWAJh6Huw+SR mJQP6oj/JW+pzYy/NbBmCqZpSn+VcszlzNCa63PRPRmNisUs4FhV0N4gJ8H5da1DPVCn A4Tg== X-Gm-Message-State: AOAM533KpCHJ+/rOViOPy1J8EAvRUzqABv2ga2nlz/WIuCfx+2vQQ7m5 tTWOMVsebioKnwZrrsJbl5ZOlqgADdQ= X-Google-Smtp-Source: ABdhPJxgvujr+ASphrF+PtxGFMQBthOaC0AfsUvYeUt23fFyr8XQNscuUiNsSflhH8wklI6WoV2E/w== X-Received: by 2002:a62:d108:0:b029:304:33e5:4dde with SMTP id z8-20020a62d1080000b029030433e54ddemr7103707pfg.74.1624423786409; Tue, 22 Jun 2021 21:49:46 -0700 (PDT) Received: from han1-mobl3.intel.com ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id c184sm900129pfa.38.2021.06.22.21.49.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:49:45 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 1/5] tools/mgmt-tester: Enable High-Speed(HS) test cases Date: Tue, 22 Jun 2021 21:49:40 -0700 Message-Id: <20210623044944.602205-1-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An This patch enables the BT High-Speed(HS) test cases by enabling the HS in the kernel config. --- doc/tester.config | 1 + tools/mgmt-tester.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/tester.config b/doc/tester.config index 661d7a0b0..850fb6a38 100644 --- a/doc/tester.config +++ b/doc/tester.config @@ -29,6 +29,7 @@ CONFIG_BT_RFCOMM=y CONFIG_BT_BNEP=y CONFIG_BT_HIDP=y CONFIG_BT_LE=y +CONFIG_BT_HS=y CONFIG_BT_HCIVHCI=y diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index fcce699d3..8cae376f4 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -5315,7 +5315,7 @@ static const char ext_ctrl_info1[] = { 0x00, 0x00, 0x00, 0x01, 0xaa, 0x00, /* btaddr */ 0x09, /* version */ 0x3f, 0x00, /* manufacturer */ - 0xff, 0xbe, 0x01, 0x00, /* supported settings */ + 0xff, 0xbf, 0x01, 0x00, /* supported settings */ 0x80, 0x00, 0x00, 0x00, /* current settings */ 0x09, 0x00, /* eir length */ 0x04, /* dev class length */ @@ -5360,7 +5360,7 @@ static const char ext_ctrl_info2[] = { 0x00, 0x00, 0x00, 0x01, 0xaa, 0x00, /* btaddr */ 0x09, /* version */ 0x3f, 0x00, /* manufacturer */ - 0xff, 0xbe, 0x01, 0x00, /* supported settings */ + 0xff, 0xbf, 0x01, 0x00, /* supported settings */ 0x81, 0x02, 0x00, 0x00, /* current settings */ 0x0D, 0x00, /* eir length */ 0x04, /* dev class length */ @@ -5391,7 +5391,7 @@ static const char ext_ctrl_info3[] = { 0x00, 0x00, 0x00, 0x01, 0xaa, 0x00, /* btaddr */ 0x09, /* version */ 0x3f, 0x00, /* manufacturer */ - 0xff, 0xbe, 0x01, 0x00, /* supported settings */ + 0xff, 0xbf, 0x01, 0x00, /* supported settings */ 0x80, 0x02, 0x00, 0x00, /* current settings */ 0x16, 0x00, /* eir length */ 0x04, /* dev class length */ @@ -5426,7 +5426,7 @@ static const char ext_ctrl_info4[] = { 0x00, 0x00, 0x00, 0x01, 0xaa, 0x00, /* btaddr */ 0x09, /* version */ 0x3f, 0x00, /* manufacturer */ - 0xff, 0xbe, 0x01, 0x00, /* supported settings */ + 0xff, 0xbf, 0x01, 0x00, /* supported settings */ 0x80, 0x02, 0x00, 0x00, /* current settings */ 0x1a, 0x00, /* eir length */ 0x04, /* dev class length */ @@ -5485,7 +5485,7 @@ static const char ext_ctrl_info5[] = { 0x00, 0x00, 0x00, 0x01, 0xaa, 0x00, /* btaddr */ 0x09, /* version */ 0x3f, 0x00, /* manufacturer */ - 0xff, 0xbe, 0x01, 0x00, /* supported settings */ + 0xff, 0xbf, 0x01, 0x00, /* supported settings */ 0x81, 0x02, 0x00, 0x00, /* current settings */ 0x1a, 0x00, /* eir len */ 0x04, /* dev class len */ From patchwork Wed Jun 23 04:49:41 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: 465983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1FC1C4743C for ; Wed, 23 Jun 2021 04:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B37861289 for ; Wed, 23 Jun 2021 04:49:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbhFWEwG (ORCPT ); Wed, 23 Jun 2021 00:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbhFWEwG (ORCPT ); Wed, 23 Jun 2021 00:52:06 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696E7C061574 for ; Tue, 22 Jun 2021 21:49:48 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id t13so701905pgu.11 for ; Tue, 22 Jun 2021 21:49:48 -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=2nBGbTzffN+8Gp2X7oU5OZU354CzcvXLkIj5BR9jI7A=; b=sn2vftpaIYJwbguyByYpzg32/8ybyxXq2eN07iqdYXZgExQ2mzWaW5FJRLow1aD6o5 42UH3RssBnJI97wSKP3Pd5Zqqa4ALH1onoVhckAmRHBeM5UqPFWZYFH4jFvB4LgzN4An mbkHHGkoD2WU2hcr+h9JvtEm5rnYcShKgbSLk67l7mKF7K9Z6aqm/asywOn1RbNcJoOO AnIrvzvdBdLslW1eDshVuruQeln4XW82934iVGyX/Uvdnetpta0VMjJUrV3w0WEhaEG7 ER2XcbQaxsf2G7ulbm5DHg3tsgZvWJQMoBTXMNHn+GlIzwxq98a0Qx33hr87/yO5Zsql e17Q== 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=2nBGbTzffN+8Gp2X7oU5OZU354CzcvXLkIj5BR9jI7A=; b=tE7c41QDt6aQB9v0MS6NdUhyeyanq7nc94Py0wqhgJJukbYF2KL7AF6ODPEKwUx7cO pAkFbLXlGavWhBXcozhSznec+Zgr4FzxypUPwozcp6nIxRfDMVGpMR7q7an+7Bqhllu7 k0tudx5k30edu7NCLtBlA+PJYGJxcELwbNKC3/KDWYjmoet48A/Df229SK7rBMXlQLpe vEkDewKrqatgC3zVsHw/iI2o9+fHjk6VbA74xE2t9rvxrqrfhIgwWu6J+eqpG10Lh0fe 9VOZKzKStgb2rAZq6qhiFenOLTVhN56/KX8QsWseervoNSubDnkVfUz8t46mHG647ijs ZXvA== X-Gm-Message-State: AOAM532m3FokHp84fIZhFoFvaNp9kzfwUAeTDBYgDMYN7b4MtuXfoOrl vAzYS7pVZCkf5Y/UhBbSH22zC/VUMm4= X-Google-Smtp-Source: ABdhPJy2Li2avxKTOYkk/pIl3AVTFDH8pRLC8UcDsf8QG/M0vi6iwm9F4Ecqlxtx0669JMLKKWzU/A== X-Received: by 2002:a62:ce4b:0:b029:301:ec00:eed9 with SMTP id y72-20020a62ce4b0000b0290301ec00eed9mr7027273pfg.44.1624423787510; Tue, 22 Jun 2021 21:49:47 -0700 (PDT) Received: from han1-mobl3.intel.com ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id c184sm900129pfa.38.2021.06.22.21.49.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:49:47 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 2/5] emulator/btdev: Add support multiple instance of extended advertising Date: Tue, 22 Jun 2021 21:49:41 -0700 Message-Id: <20210623044944.602205-2-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210623044944.602205-1-hj.tedd.an@gmail.com> References: <20210623044944.602205-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 support multiple instance of extended advertising. --- emulator/btdev.c | 419 ++++++++++++++++++++++++++++++++++++----------- monitor/bt.h | 1 + 2 files changed, 324 insertions(+), 96 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index eba9f57f9..c5ea35e54 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -52,6 +52,7 @@ struct hook { }; #define MAX_HOOK_ENTRIES 16 +#define MAX_EXT_ADV_SETS 3 struct btdev_conn { uint16_t handle; @@ -72,6 +73,21 @@ struct btdev_rl { uint8_t local_irk[16]; }; +struct le_ext_adv { + uint8_t handle; + uint8_t enable; + uint8_t type; /* evt_properties */ + uint8_t own_addr_type; /* own_addr_type */ + uint8_t direct_addr_type; /* peer_addr_type */ + uint8_t direct_addr[6]; /* peer_addr */ + uint8_t filter_policy; /* filter_policy */ + uint8_t random_addr[6]; + uint8_t adv_data[252]; + uint8_t adv_data_len; + uint8_t scan_data[252]; + uint8_t scan_data_len; +}; + struct btdev { enum btdev_type type; @@ -185,6 +201,8 @@ struct btdev { uint16_t le_ext_adv_type; + struct queue *le_ext_adv; + btdev_debug_func_t debug_callback; btdev_destroy_func_t debug_destroy; void *debug_data; @@ -1010,8 +1028,9 @@ static struct btdev_conn *conn_link(struct btdev *dev, struct btdev *remote, conn2->link = conn1; util_debug(dev->debug_callback, dev->debug_data, - "conn1 %p handle 0x%04x conn2 %p handle 0x%04x", - conn1, conn1->handle, conn2, conn2->handle); + "conn1 %p handle 0x%04x", conn1, conn1->handle); + util_debug(dev->debug_callback, dev->debug_data, + "conn2 %p handle 0x%04x", conn2, conn2->handle); return conn1; } @@ -3083,18 +3102,6 @@ static const uint8_t *scan_addr(const struct btdev *btdev) return btdev->bdaddr; } -static bool ext_adv_match(struct btdev *scan, struct btdev *adv) -{ - /* Match everything if this is not directed advertising */ - if (!(adv->le_ext_adv_type & 0x04)) - return true; - - if (scan->le_scan_own_addr_type != adv->le_adv_direct_addr_type) - return false; - - return !memcmp(scan_addr(scan), adv->le_adv_direct_addr, 6); -} - static const uint8_t *adv_addr(const struct btdev *btdev) { if (btdev->le_adv_own_addr == 0x01) @@ -4192,13 +4199,103 @@ static int cmd_set_default_phy(struct btdev *dev, const void *data, return 0; } +static const uint8_t *ext_adv_addr(const struct btdev *btdev, + struct le_ext_adv *ext_adv) +{ + if (ext_adv->own_addr_type == 0x01) + return ext_adv->random_addr; + + return btdev->bdaddr; +} + +static bool ext_adv_match_addr(const struct btdev *btdev, + struct le_ext_adv *ext_adv) +{ + /* Match everything if this is not directed advertising */ + if (!(ext_adv->type & 0x04)) + return true; + + if (btdev->le_scan_own_addr_type != ext_adv->direct_addr_type) + return false; + + return !memcmp(scan_addr(btdev), ext_adv->direct_addr, 6); +} + +static bool match_ext_adv_handle(const void *data, const void *match_data) +{ + const struct le_ext_adv *ext_adv = data; + uint8_t handle = PTR_TO_UINT(match_data); + + return ext_adv->handle == handle; +} + +static void ext_adv_disable(void *data, void *user_data) +{ + struct le_ext_adv *ext_adv = data; + uint8_t handle = PTR_TO_UINT(user_data); + + if (handle && ext_adv->handle != handle) + return; + + ext_adv->enable = 0x00; +} + +static bool ext_adv_is_connectable(struct le_ext_adv *ext_adv) +{ + if (!ext_adv->enable) + return false; + + return ext_adv->type & 0x01; +} + +static struct le_ext_adv *le_ext_adv_new(struct btdev *btdev, uint8_t handle) +{ + struct le_ext_adv *ext_adv; + + ext_adv = new0(struct le_ext_adv, 1); + ext_adv->handle = handle; + + /* Add to queue */ + if (!queue_push_tail(btdev->le_ext_adv, ext_adv)) { + free(ext_adv); + return NULL; + } + + return ext_adv; +} + +static void le_ext_adv_free(void *data) +{ + struct le_ext_adv *ext_adv = data; + + free(ext_adv); +} + static int cmd_set_adv_rand_addr(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_set_adv_set_rand_addr *cmd = data; + struct le_ext_adv *ext_adv; uint8_t status = BT_HCI_ERR_SUCCESS; - memcpy(dev->random_addr, cmd->bdaddr, 6); + /* Check if Ext Adv is already existed */ + ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle, + UINT_TO_PTR(cmd->handle)); + if (!ext_adv) { + status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; + cmd_complete(dev, BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR, &status, + sizeof(status)); + return 0; + } + + if (ext_adv_is_connectable(ext_adv)) { + status = BT_HCI_ERR_COMMAND_DISALLOWED; + cmd_complete(dev, BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR, &status, + sizeof(status)); + return 0; + } + + memcpy(ext_adv->random_addr, cmd->bdaddr, 6); cmd_complete(dev, BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR, &status, sizeof(status)); @@ -4210,20 +4307,43 @@ static int cmd_set_ext_adv_params(struct btdev *dev, const void *data, { const struct bt_hci_cmd_le_set_ext_adv_params *cmd = data; struct bt_hci_rsp_le_set_ext_adv_params rsp; + struct le_ext_adv *ext_adv; uint8_t status; - if (dev->le_adv_enable) { + /* Check if Ext Adv is already existed */ + ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle, + UINT_TO_PTR(cmd->handle)); + if (!ext_adv) { + /* No more than maximum number */ + if (queue_length(dev->le_ext_adv) >= MAX_EXT_ADV_SETS) { + status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; + cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, + &status, sizeof(status)); + return 0; + } + + /* Create new set */ + ext_adv = le_ext_adv_new(dev, cmd->handle); + if (!ext_adv) { + status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; + cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, + &status, sizeof(status)); + return 0; + } + } + + if (ext_adv->enable) { status = BT_HCI_ERR_COMMAND_DISALLOWED; cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, &status, sizeof(status)); return 0; } - dev->le_ext_adv_type = le16_to_cpu(cmd->evt_properties); - dev->le_adv_own_addr = cmd->own_addr_type; - dev->le_adv_direct_addr_type = cmd->peer_addr_type; - memcpy(dev->le_adv_direct_addr, cmd->peer_addr, 6); - dev->le_adv_filter_policy = cmd->filter_policy; + ext_adv->type = le16_to_cpu(cmd->evt_properties); + ext_adv->own_addr_type = cmd->own_addr_type; + ext_adv->direct_addr_type = cmd->peer_addr_type; + memcpy(ext_adv->direct_addr, cmd->peer_addr, 6); + ext_adv->filter_policy = cmd->filter_policy; rsp.status = BT_HCI_ERR_SUCCESS; rsp.tx_power = 0; @@ -4236,10 +4356,20 @@ static int cmd_set_ext_adv_data(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_set_ext_adv_data *cmd = data; + struct le_ext_adv *ext_adv; uint8_t status = BT_HCI_ERR_SUCCESS; - dev->le_adv_data_len = cmd->data_len; - memcpy(dev->le_adv_data, cmd->data, 31); + ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle, + UINT_TO_PTR(cmd->handle)); + if (!ext_adv) { + status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; + cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_DATA, &status, + sizeof(status)); + return 0; + } + + ext_adv->adv_data_len = cmd->data_len; + memcpy(ext_adv->adv_data, cmd->data, cmd->data_len); cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_DATA, &status, sizeof(status)); @@ -4250,10 +4380,20 @@ static int cmd_set_ext_scan_rsp_data(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_set_ext_scan_rsp_data *cmd = data; + struct le_ext_adv *ext_adv; uint8_t status = BT_HCI_ERR_SUCCESS; - dev->le_scan_data_len = cmd->data_len; - memcpy(dev->le_scan_data, cmd->data, 31); + ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle, + UINT_TO_PTR(cmd->handle)); + if (!ext_adv) { + status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; + cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_DATA, &status, + sizeof(status)); + return 0; + } + + ext_adv->scan_data_len = cmd->data_len; + memcpy(ext_adv->scan_data, cmd->data, cmd->data_len); cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_SCAN_RSP_DATA, &status, sizeof(status)); @@ -4261,6 +4401,7 @@ static int cmd_set_ext_scan_rsp_data(struct btdev *dev, const void *data, } static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, + struct le_ext_adv *ext_adv, uint16_t type, bool is_scan_rsp) { struct __packed { @@ -4274,8 +4415,8 @@ static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, memset(&meta_event.lear, 0, sizeof(meta_event.lear)); meta_event.num_reports = 1; meta_event.lear.event_type = cpu_to_le16(type); - meta_event.lear.addr_type = remote->le_adv_own_addr; - memcpy(meta_event.lear.addr, adv_addr(remote), 6); + meta_event.lear.addr_type = ext_adv->own_addr_type; + memcpy(meta_event.lear.addr, ext_adv_addr(remote, ext_adv), 6); meta_event.lear.rssi = 127; meta_event.lear.tx_power = 127; /* Right now we dont care about phy in adv report */ @@ -4284,12 +4425,12 @@ static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, /* Scan or advertising response */ if (is_scan_rsp) { - meta_event.lear.data_len = remote->le_scan_data_len; - memcpy(meta_event.lear.data, remote->le_scan_data, + meta_event.lear.data_len = ext_adv->scan_data_len; + memcpy(meta_event.lear.data, ext_adv->scan_data, meta_event.lear.data_len); } else { - meta_event.lear.data_len = remote->le_adv_data_len; - memcpy(meta_event.lear.data, remote->le_adv_data, + meta_event.lear.data_len = ext_adv->adv_data_len; + memcpy(meta_event.lear.data, ext_adv->adv_data, meta_event.lear.data_len); } @@ -4297,12 +4438,13 @@ static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, 1 + 24 + meta_event.lear.data_len); } -static void le_set_ext_adv_enable_complete(struct btdev *btdev) +static void le_set_ext_adv_enable_complete(struct btdev *btdev, + struct le_ext_adv *ext_adv) { uint16_t report_type; int i; - report_type = get_ext_adv_type(btdev->le_ext_adv_type); + report_type = get_ext_adv_type(ext_adv->type); for (i = 0; i < MAX_BTDEV_ENTRIES; i++) { if (!btdev_list[i] || btdev_list[i] == btdev) @@ -4311,26 +4453,27 @@ static void le_set_ext_adv_enable_complete(struct btdev *btdev) if (!btdev_list[i]->le_scan_enable) continue; - if (!ext_adv_match(btdev_list[i], btdev)) + if (!ext_adv_match_addr(btdev_list[i], ext_adv)) continue; - send_ext_adv(btdev_list[i], btdev, report_type, false); + send_ext_adv(btdev_list[i], btdev, ext_adv, report_type, false); if (btdev_list[i]->le_scan_type != 0x01) continue; /* if scannable bit is set the send scan response */ - if (btdev->le_ext_adv_type & 0x02) { - if (btdev->le_ext_adv_type == 0x13) + if (ext_adv->type & 0x02) { + if (ext_adv->type == 0x13) report_type = 0x1b; - else if (btdev->le_ext_adv_type == 0x12) + else if (ext_adv->type == 0x12) report_type = 0x1a; - else if (!(btdev->le_ext_adv_type & 0x10)) + else if (!(ext_adv->type & 0x10)) report_type &= 0x08; else continue; - send_ext_adv(btdev_list[i], btdev, report_type, true); + send_ext_adv(btdev_list[i], btdev, ext_adv, + report_type, true); } } } @@ -4339,31 +4482,62 @@ static int cmd_set_ext_adv_enable(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_set_ext_adv_enable *cmd = data; - uint8_t status; + uint8_t status = BT_HCI_ERR_SUCCESS; + int i; - if (dev->le_adv_enable == cmd->enable) - status = BT_HCI_ERR_COMMAND_DISALLOWED; - else { + /* Num of set is zero */ + if (!cmd->num_of_sets) { + if (cmd->enable) { + status = BT_HCI_ERR_INVALID_PARAMETERS; + goto exit_complete; + } + + /* Disable all advertising sets */ + queue_foreach(dev->le_ext_adv, ext_adv_disable, NULL); + goto exit_complete; + } + + /* Process each sets */ + for (i = 0; i < cmd->num_of_sets; i++) { const struct bt_hci_cmd_ext_adv_set *eas; + struct le_ext_adv *ext_adv; - if (cmd->num_of_sets) { - eas = data + sizeof(*cmd); - if (eas->duration || cmd->num_of_sets > 1) - status = BT_HCI_ERR_INVALID_PARAMETERS; - else - status = BT_HCI_ERR_SUCCESS; - } else - status = BT_HCI_ERR_SUCCESS; + eas = data + sizeof(*cmd) + (sizeof(*eas) * i); + + ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle, + UINT_TO_PTR(eas->handle)); + if (!ext_adv) { + status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; + goto exit_complete; + } + + if (ext_adv->enable == cmd->enable) { + status = BT_HCI_ERR_COMMAND_DISALLOWED; + goto exit_complete; + } - if (status == BT_HCI_ERR_SUCCESS) - dev->le_adv_enable = cmd->enable; + ext_adv->enable = cmd->enable; } +exit_complete: cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, &status, sizeof(status)); - if (status == BT_HCI_ERR_SUCCESS && dev->le_adv_enable) - le_set_ext_adv_enable_complete(dev); + if (status == BT_HCI_ERR_SUCCESS && cmd->enable) { + /* Go through each sets and send adv event to peer device */ + for (i = 0; i < cmd->num_of_sets; i++) { + const struct bt_hci_cmd_ext_adv_set *eas; + struct le_ext_adv *ext_adv; + + eas = data + sizeof(*cmd) + (sizeof(*eas) * i); + + ext_adv = queue_find(dev->le_ext_adv, + match_ext_adv_handle, + UINT_TO_PTR(eas->handle)); + if (ext_adv) + le_set_ext_adv_enable_complete(dev, ext_adv); + } + } return 0; } @@ -4383,8 +4557,7 @@ static int cmd_read_num_adv_sets(struct btdev *dev, const void *data, memset(&rsp, 0, sizeof(rsp)); rsp.status = BT_HCI_ERR_SUCCESS; - /* Support one set as of now */ - rsp.num_of_sets = 1; + rsp.num_of_sets = MAX_EXT_ADV_SETS; cmd_complete(dev, BT_HCI_CMD_LE_READ_NUM_SUPPORTED_ADV_SETS, &rsp, sizeof(rsp)); @@ -4394,8 +4567,29 @@ static int cmd_read_num_adv_sets(struct btdev *dev, const void *data, static int cmd_remove_adv_set(struct btdev *dev, const void *data, uint8_t len) { + const struct bt_hci_cmd_le_remove_adv_set *cmd = data; + struct le_ext_adv *ext_adv; uint8_t status = BT_HCI_ERR_SUCCESS; + ext_adv = queue_find(dev->le_ext_adv, match_ext_adv_handle, + UINT_TO_PTR(cmd->handle)); + if (!ext_adv) { + status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; + cmd_complete(dev, BT_HCI_CMD_LE_SET_EXT_ADV_DATA, &status, + sizeof(status)); + return 0; + } + + if (ext_adv->enable) { + status = BT_HCI_ERR_COMMAND_DISALLOWED; + cmd_complete(dev, BT_HCI_CMD_LE_REMOVE_ADV_SET, &status, + sizeof(status)); + return 0; + } + + queue_remove(dev->le_ext_adv, ext_adv); + free(ext_adv); + cmd_complete(dev, BT_HCI_CMD_LE_REMOVE_ADV_SET, &status, sizeof(status)); @@ -4405,8 +4599,23 @@ static int cmd_remove_adv_set(struct btdev *dev, const void *data, static int cmd_clear_adv_sets(struct btdev *dev, const void *data, uint8_t len) { + const struct queue_entry *entry; uint8_t status = BT_HCI_ERR_SUCCESS; + for (entry = queue_get_entries(dev->le_ext_adv); entry; + entry = entry->next) { + struct le_ext_adv *ext_adv = entry->data; + + if (ext_adv->enable) { + status = BT_HCI_ERR_COMMAND_DISALLOWED; + cmd_complete(dev, BT_HCI_CMD_LE_CLEAR_ADV_SETS, &status, + sizeof(status)); + return 0; + } + } + + queue_remove_all(dev->le_ext_adv, NULL, NULL, le_ext_adv_free); + cmd_complete(dev, BT_HCI_CMD_LE_CLEAR_ADV_SETS, &status, sizeof(status)); @@ -4513,68 +4722,72 @@ static int cmd_set_ext_scan_enable(struct btdev *dev, const void *data, return 0; } -static int cmd_set_ext_scan_enable_complete(struct btdev *dev, const void *data, - uint8_t len) +static void scan_ext_adv(struct btdev *dev, struct btdev *remote) { - const struct bt_hci_cmd_le_set_ext_scan_enable *cmd = data; - int i; - - if (!dev->le_scan_enable || !cmd->enable) - return 0; + const struct queue_entry *entry; - for (i = 0; i < MAX_BTDEV_ENTRIES; i++) { + for (entry = queue_get_entries(remote->le_ext_adv); entry; + entry = entry->next) { + struct le_ext_adv *ext_adv = entry->data; uint16_t report_type; - if (!btdev_list[i] || btdev_list[i] == dev) + if (!ext_adv->enable) continue; - if (!btdev_list[i]->le_adv_enable) - continue; - - if (!ext_adv_match(dev, btdev_list[i])) + if (!ext_adv_match_addr(dev, ext_adv)) continue; - report_type = get_ext_adv_type(btdev_list[i]->le_ext_adv_type); - send_ext_adv(dev, btdev_list[i], report_type, false); + report_type = get_ext_adv_type(ext_adv->type); + send_ext_adv(dev, remote, ext_adv, report_type, false); if (dev->le_scan_type != 0x01) continue; /* if scannable bit is set the send scan response */ - if (btdev_list[i]->le_ext_adv_type & 0x02) { - if (btdev_list[i]->le_ext_adv_type == 0x13) + if (ext_adv->type & 0x02) { + if (ext_adv->type == 0x13) report_type = 0x1b; - else if (btdev_list[i]->le_ext_adv_type == 0x12) + else if (ext_adv->type == 0x12) report_type = 0x1a; - else if (!(btdev_list[i]->le_ext_adv_type & 0x10)) + else if (!(ext_adv->type & 0x10)) report_type &= 0x08; else continue; - send_ext_adv(dev, btdev_list[i], report_type, true); + send_ext_adv(dev, remote, ext_adv, report_type, true); } } - - return 0; } -static int cmd_ext_create_conn(struct btdev *dev, const void *data, uint8_t len) +static int cmd_set_ext_scan_enable_complete(struct btdev *dev, const void *data, + uint8_t len) { - cmd_status(dev, BT_HCI_ERR_SUCCESS, BT_HCI_CMD_LE_EXT_CREATE_CONN); + const struct bt_hci_cmd_le_set_ext_scan_enable *cmd = data; + int i; + + if (!dev->le_scan_enable || !cmd->enable) + return 0; + + for (i = 0; i < MAX_BTDEV_ENTRIES; i++) { + if (!btdev_list[i] || btdev_list[i] == dev) + continue; + + scan_ext_adv(dev, btdev_list[i]); + } return 0; } -static bool ext_adv_connectable(struct btdev *btdev) +static int cmd_ext_create_conn(struct btdev *dev, const void *data, uint8_t len) { - if (!btdev->le_adv_enable) - return false; + cmd_status(dev, BT_HCI_ERR_SUCCESS, BT_HCI_CMD_LE_EXT_CREATE_CONN); - return btdev->le_ext_adv_type & 0x01; + return 0; } static void le_ext_conn_complete(struct btdev *btdev, const struct bt_hci_cmd_le_ext_create_conn *cmd, + struct le_ext_adv *ext_adv, uint8_t status) { struct bt_hci_evt_le_enhanced_conn_complete ev; @@ -4589,10 +4802,10 @@ static void le_ext_conn_complete(struct btdev *btdev, if (!conn) return; - if (!btdev->le_ext_adv_type) { - btdev->le_adv_enable = 0; - conn->link->dev->le_adv_enable = 0; - } + /* Disable EXT ADV */ + queue_foreach(btdev->le_ext_adv, ext_adv_disable, NULL); + queue_foreach(conn->link->dev->le_ext_adv, ext_adv_disable, + NULL); ev.status = status; ev.peer_addr_type = btdev->le_scan_own_addr_type; @@ -4625,19 +4838,30 @@ static int cmd_ext_create_conn_complete(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_ext_create_conn *cmd = data; + const struct queue_entry *entry; struct btdev *remote; dev->le_scan_own_addr_type = cmd->own_addr_type; remote = find_btdev_by_bdaddr_type(cmd->peer_addr, cmd->peer_addr_type); - if (remote && ext_adv_connectable(remote) && - ext_adv_match(dev, remote) && - remote->le_adv_own_addr == cmd->peer_addr_type) - le_ext_conn_complete(dev, cmd, 0); - else - le_ext_conn_complete(dev, cmd, + if (!remote) { + le_ext_conn_complete(dev, cmd, NULL, BT_HCI_ERR_CONN_FAILED_TO_ESTABLISH); + return 0; + } + + for (entry = queue_get_entries(remote->le_ext_adv); entry; + entry = entry->next) { + struct le_ext_adv *ext_adv = entry->data; + if (ext_adv_is_connectable(ext_adv) && + ext_adv_match_addr(dev, ext_adv) && + ext_adv->own_addr_type == cmd->peer_addr_type) { + le_ext_conn_complete(dev, cmd, ext_adv, 0); + return 0; + } + + } return 0; } @@ -5748,6 +5972,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) get_bdaddr(id, index, btdev->bdaddr); btdev->conns = queue_new(); + btdev->le_ext_adv = queue_new(); return btdev; } @@ -5763,6 +5988,8 @@ void btdev_destroy(struct btdev *btdev) bt_crypto_unref(btdev->crypto); del_btdev(btdev); + queue_destroy(btdev->le_ext_adv, le_ext_adv_free); + free(btdev); } diff --git a/monitor/bt.h b/monitor/bt.h index ac4f976fc..d60bbdb20 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -3657,6 +3657,7 @@ struct bt_hci_evt_le_req_peer_sca_complete { #define BT_HCI_ERR_INVALID_PARAMETERS 0x12 #define BT_HCI_ERR_UNSPECIFIED_ERROR 0x1f #define BT_HCI_ERR_CONN_FAILED_TO_ESTABLISH 0x3e +#define BT_HCI_ERR_UNKNOWN_ADVERTISING_ID 0x42 struct bt_l2cap_hdr { uint16_t len; From patchwork Wed Jun 23 04:49:42 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: 466424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2370C48BE5 for ; Wed, 23 Jun 2021 04:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97767613B0 for ; Wed, 23 Jun 2021 04:49:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbhFWEwH (ORCPT ); Wed, 23 Jun 2021 00:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbhFWEwG (ORCPT ); Wed, 23 Jun 2021 00:52:06 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DF41C061756 for ; Tue, 22 Jun 2021 21:49:49 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id e20so760791pgg.0 for ; Tue, 22 Jun 2021 21:49:49 -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=uZSiXJbnGeuxS5aa3LIqv6u5CYJbvasHC6wO3ANSWgA=; b=Y/Ic+ACaWdGdeFAfYaA4lmUkXlacteBfVEhWN9bc5DUC1yeKJ1hh2idiWprwHL6b+U 39VyS7NJ4xsON/1QP3RsEPpFlZSKerwJT6bO1tX/+7qPPSssYXZYvj9eWawOCr/4amgE lHH7nmJD9v+fr+KP3bZ//fPOYozSCSCNCQx3qvhS7xH8zB3bGGOLHxCUZI3L+zlMTUEc kv7mW04WLg7VeguHhUKdxQP4veUZNGrhXDVvlvxg942PVtbpa6UpI2/hFdVMJ7/BF7Zo uwwS/Ks3cN08oRDwbT0rhI0hFRRoJ15r7LhEFuapcweJwJOs3H1t+rVNcBXzriUWQV9T rQ9A== 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=uZSiXJbnGeuxS5aa3LIqv6u5CYJbvasHC6wO3ANSWgA=; b=UH1OSUkC0WNruw3vJ55A2m0oPxW9O2gRYaCWEh9Nq9XdXLxBNE9CF33WW6nTU664n+ Nb/+FYIkh4uOovfxbscblFcbqjZzA6cvRw7yDeDSMsgYoBRQ/S2ThAfWULCS4C3xFcDq nY5KitPvk6QZP7dr+Qi1wFqYvfgzwv8F33wvadEJrWeb4BxfhBg+K2ZfG0v3M+3zuvdf HDENN0Wm25el5+08I3RN3TwT+iVxhsj5UqB3QOlsA7HK34AhKhPY6hSaiBxdP2CiZMgv rdOjmdqq9lcxyQMHiFBudA59uAfMEfEEhQLA6WBMltX5ImFzcubsVTGaKPKN5DEvS6sh BiCw== X-Gm-Message-State: AOAM532fNzGE1ATQyzF3kQ7zR6M0I8wqIfsSWJ/dXJuSeteqiwMMkxpt Av4EbdbdH9kjsxE5I7P0Ku/QDr1+dwA= X-Google-Smtp-Source: ABdhPJzixXEROX1Jwz/tBdUQ6Rci9hEuSujhHrKc8+zOPA72A6fT201lPCGpvWKz+ssvq4qS6939Zg== X-Received: by 2002:a62:7616:0:b029:305:f420:49cc with SMTP id r22-20020a6276160000b0290305f42049ccmr4409961pfc.51.1624423788437; Tue, 22 Jun 2021 21:49:48 -0700 (PDT) Received: from han1-mobl3.intel.com ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id c184sm900129pfa.38.2021.06.22.21.49.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:49:48 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 3/5] emulator/btdev: Add support HCI LE Adv Set Terminated event Date: Tue, 22 Jun 2021 21:49:42 -0700 Message-Id: <20210623044944.602205-3-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210623044944.602205-1-hj.tedd.an@gmail.com> References: <20210623044944.602205-1-hj.tedd.an@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This patch adds support the HCI_LE_Advertising_Set_Terminated event in btdev. --- emulator/btdev.c | 64 +++++++++++++++++++++++++++++++++++++++++++++--- monitor/bt.h | 1 + 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index c5ea35e54..90457a5aa 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -74,6 +74,7 @@ struct btdev_rl { }; struct le_ext_adv { + struct btdev *dev; uint8_t handle; uint8_t enable; uint8_t type; /* evt_properties */ @@ -86,6 +87,7 @@ struct le_ext_adv { uint8_t adv_data_len; uint8_t scan_data[252]; uint8_t scan_data_len; + unsigned int id; }; struct btdev { @@ -4237,6 +4239,11 @@ static void ext_adv_disable(void *data, void *user_data) if (handle && ext_adv->handle != handle) return; + if (ext_adv->id) { + timeout_remove(ext_adv->id); + ext_adv->id = 0; + } + ext_adv->enable = 0x00; } @@ -4253,6 +4260,7 @@ static struct le_ext_adv *le_ext_adv_new(struct btdev *btdev, uint8_t handle) struct le_ext_adv *ext_adv; ext_adv = new0(struct le_ext_adv, 1); + ext_adv->dev = btdev; ext_adv->handle = handle; /* Add to queue */ @@ -4268,6 +4276,12 @@ static void le_ext_adv_free(void *data) { struct le_ext_adv *ext_adv = data; + /* Remove to queue */ + queue_remove(ext_adv->dev->le_ext_adv, ext_adv); + + if (ext_adv->id) + timeout_remove(ext_adv->id); + free(ext_adv); } @@ -4477,6 +4491,31 @@ static void le_set_ext_adv_enable_complete(struct btdev *btdev, } } } +static void adv_set_terminate(struct btdev *dev, uint8_t status, uint8_t handle, + uint16_t conn_handle, uint8_t num_evts) +{ + struct bt_hci_evt_le_adv_set_term ev; + + memset(&ev, 0, sizeof(ev)); + ev.status = status; + ev.handle = handle; + ev.conn_handle = cpu_to_le16(conn_handle); + ev.num_evts = num_evts; + + le_meta_event(dev, BT_HCI_EVT_LE_ADV_SET_TERM, &ev, sizeof(ev)); +} + +static bool ext_adv_timeout(void *user_data) +{ + struct le_ext_adv *adv = user_data; + + adv->id = 0; + adv_set_terminate(adv->dev, BT_HCI_ERR_ADV_TIMEOUT, adv->handle, + 0x0000, 0x00); + le_ext_adv_free(adv); + + return false; +} static int cmd_set_ext_adv_enable(struct btdev *dev, const void *data, uint8_t len) @@ -4517,6 +4556,13 @@ static int cmd_set_ext_adv_enable(struct btdev *dev, const void *data, } ext_adv->enable = cmd->enable; + + if (!cmd->enable) + ext_adv_disable(ext_adv, NULL); + else if (eas->duration) + ext_adv->id = timeout_add(eas->duration * 10, + ext_adv_timeout, + ext_adv, NULL); } exit_complete: @@ -4785,6 +4831,19 @@ static int cmd_ext_create_conn(struct btdev *dev, const void *data, uint8_t len) return 0; } +static void ext_adv_term(void *data, void *user_data) +{ + struct le_ext_adv *adv = data; + struct btdev_conn *conn = user_data; + + /* if connectable bit is set the send adv terminate */ + if (conn && adv->type & 0x01) { + adv_set_terminate(conn->dev, 0x00, adv->handle, conn->handle, + 0x00); + le_ext_adv_free(adv); + } +} + static void le_ext_conn_complete(struct btdev *btdev, const struct bt_hci_cmd_le_ext_create_conn *cmd, struct le_ext_adv *ext_adv, @@ -4803,9 +4862,8 @@ static void le_ext_conn_complete(struct btdev *btdev, return; /* Disable EXT ADV */ - queue_foreach(btdev->le_ext_adv, ext_adv_disable, NULL); - queue_foreach(conn->link->dev->le_ext_adv, ext_adv_disable, - NULL); + queue_foreach(btdev->le_ext_adv, ext_adv_term, conn); + queue_foreach(conn->link->dev->le_ext_adv, ext_adv_term, conn); ev.status = status; ev.peer_addr_type = btdev->le_scan_own_addr_type; diff --git a/monitor/bt.h b/monitor/bt.h index d60bbdb20..738bc294b 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -3656,6 +3656,7 @@ struct bt_hci_evt_le_req_peer_sca_complete { #define BT_HCI_ERR_UNSUPPORTED_FEATURE 0x11 #define BT_HCI_ERR_INVALID_PARAMETERS 0x12 #define BT_HCI_ERR_UNSPECIFIED_ERROR 0x1f +#define BT_HCI_ERR_ADV_TIMEOUT 0x3c #define BT_HCI_ERR_CONN_FAILED_TO_ESTABLISH 0x3e #define BT_HCI_ERR_UNKNOWN_ADVERTISING_ID 0x42 From patchwork Wed Jun 23 04:49:43 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: 466423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3D1CC48BC2 for ; Wed, 23 Jun 2021 04:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD9F661289 for ; Wed, 23 Jun 2021 04:49:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbhFWEwI (ORCPT ); Wed, 23 Jun 2021 00:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhFWEwG (ORCPT ); Wed, 23 Jun 2021 00:52:06 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E24DDC06175F for ; Tue, 22 Jun 2021 21:49:49 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id p9so737380pgb.1 for ; Tue, 22 Jun 2021 21:49:49 -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=fijeLYxAajiOMQuAFN30hNSlRkp9xloU3BMCsZB7sQs=; b=ZGHwVB8BXii6/bZFD4MPHL/tWRMNRJ4GyOcpweSofQ+NffIcLxYqkIttyp5U/wYa2K GC1b0jPVcdWJ8jGBLFhU5ZyVWk6T2zPzdfkKd8TjOjxYUWOxAmsw+/0vBBgThTtwOVZy YWwNfEK++U9I4c6pbEnC2AgxNGKPDtsWXXFmnYH3WplL7KrJHCAVZ1nFmBxPSYeL3oEy SJx9B/9cOFZaUFmLYcDg4B/Q7xTxAZbSPl2P70kYziKJlSxO1xV97kLOqihCmHDa4Hmf iTm4pT2EkQOvkh+cBclbCla5Yq83a8IITHrTJJgLzkieF8CW6VSKdzLeXOVsi1HG0ViH bCyg== 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=fijeLYxAajiOMQuAFN30hNSlRkp9xloU3BMCsZB7sQs=; b=f0w4VTh49qLu6EXA7uCV/KZXMTGANI3M3cdnBUCVimroXsjIdhahbts4OmdFD9JF4I Uu6aZpvxm/42U9CYCvFkVpX31eMTgIvR853NVPWWnfni8TlVDaS0XPkMENyJ5G684YsK oFtUbGrJ/UlZ5TQ2Q/fq+u0MoOyG8U1hjYtV0jXz5yIke/YgqeagVXujVA2THf/SVLTh 12zrYnvpszAYEEVhm6M6PB4k2f2fwXi/TZBftfPxY2MgNJdmQs2dyRuAnMe61RDi2bTc k3/cky+DjR3vdtnVCWE5/89YmgSZPLx7vzedSGU5uSDLyz0Yetk/4FpoQN5OlH0T/KnQ VdoA== X-Gm-Message-State: AOAM530v3QqOwtEGdHsVnwnkOWdqGSC9r5rGD6PQV7dzvFFsHGCZFdge 94qS+exLqGP5XvVTiNV26hDk8qAuv4c= X-Google-Smtp-Source: ABdhPJzdFbLFMJWJl/xbFZxktfggDTt/7pklQmQQD5xg8novntAT6f8Rbrp7imFwnplslRUnfgS+lw== X-Received: by 2002:a63:7d4e:: with SMTP id m14mr2051854pgn.421.1624423789379; Tue, 22 Jun 2021 21:49:49 -0700 (PDT) Received: from han1-mobl3.intel.com ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id c184sm900129pfa.38.2021.06.22.21.49.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:49:49 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 4/5] emulator/bthost: Create ext adv params before setting adv data Date: Tue, 22 Jun 2021 21:49:43 -0700 Message-Id: <20210623044944.602205-4-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210623044944.602205-1-hj.tedd.an@gmail.com> References: <20210623044944.602205-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 Based on the SPEC 5.2 Vol 4, Part E, Section 7.8.54, the LE_Set_Extended_Advertising_Data_Command may be issued after an advertising set identifed by the Advertising_Handle has been created using the HCI_LE_Set_Extended_Advertising_Parameters command. --- emulator/bthost.c | 26 ++++++++++++++++++++------ emulator/bthost.h | 1 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index 16934d35a..62f5a1bae 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -2549,6 +2549,7 @@ void bthost_set_ext_adv_data(struct bthost *bthost, const uint8_t *data, memset(adv_cp, 0, sizeof(*adv_cp)); memset(adv_cp->data, 0, 31); + adv_cp->handle = 1; adv_cp->operation = 0x03; adv_cp->fragment_preference = 0x01; @@ -2572,20 +2573,33 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable) send_command(bthost, BT_HCI_CMD_LE_SET_ADV_ENABLE, &enable, 1); } -void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable) +void bthost_set_ext_adv_params(struct bthost *bthost) { struct bt_hci_cmd_le_set_ext_adv_params cp; - struct bt_hci_cmd_le_set_ext_adv_enable cp_enable; memset(&cp, 0, sizeof(cp)); + cp.handle = 0x01; cp.evt_properties = cpu_to_le16(0x0013); send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, &cp, sizeof(cp)); +} + +void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable) +{ + struct bt_hci_cmd_le_set_ext_adv_enable *cp_enable; + struct bt_hci_cmd_ext_adv_set *cp_set; + uint8_t cp[6]; + + memset(cp, 0, 6); + + cp_enable = (struct bt_hci_cmd_le_set_ext_adv_enable *)cp; + cp_set = (struct bt_hci_cmd_ext_adv_set *)(cp + sizeof(*cp_enable)); + + cp_enable->enable = enable; + cp_enable->num_of_sets = 1; + cp_set->handle = 1; - memset(&cp_enable, 0, sizeof(cp_enable)); - cp_enable.enable = enable; - send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, &cp_enable, - sizeof(cp_enable)); + send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, cp, 6); } void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode) diff --git a/emulator/bthost.h b/emulator/bthost.h index 7e5286df3..5a85b7232 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -80,6 +80,7 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable); void bthost_set_ext_adv_data(struct bthost *bthost, const uint8_t *data, uint8_t len); +void bthost_set_ext_adv_params(struct bthost *bthost); void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable); void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode); From patchwork Wed Jun 23 04:49:44 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: 465982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C24E3C49EA5 for ; Wed, 23 Jun 2021 04:49:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA8A161289 for ; Wed, 23 Jun 2021 04:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbhFWEwK (ORCPT ); Wed, 23 Jun 2021 00:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbhFWEwI (ORCPT ); Wed, 23 Jun 2021 00:52:08 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C68C061574 for ; Tue, 22 Jun 2021 21:49:50 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id c15so497800pls.13 for ; Tue, 22 Jun 2021 21:49:50 -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=jU/8LF/OreKqHBJT3ncRfFZ9nHj+jlfRqb827tR0OnU=; b=oZL1yQxkMZdseQyBr1Leb8/Ut44cc+DldWhj7HlSgG69oimSzZP3LMvZD6QgagSHTI dpKHGl3CLC5O+HAcmXTcnGHpyqPZ+TElLuHgxj1m/HKc+nMsvL6bDQS4GLHqiEKKkaW4 srrQeuaUo4IKqxB9rxMUa12ARP3DowafkGouYk30k7995FYIVQUGvLrrWMb0B7G2UI0V k+lgQP9jw42T2fq6hHA6yQGhL7aFuJ9eNjSUWBTNrzDdP1K9buvCR7H4kLNeeNj42H6B KvxIphn6i5738o5mkeDniNkHfNtMIsW6B8KT6hJfq+yA9aBhHAb2l4pJqLTHjoIrxBtF SW1A== 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=jU/8LF/OreKqHBJT3ncRfFZ9nHj+jlfRqb827tR0OnU=; b=MHB61rBKXsjsSngXDjZb38oM8IhoOJYOzA2ChRp232+Y6Vs9mMEJ8c3BJ7jmGd8T5t 4MlCOiFy4clpucH9C/AInxHyfa4yorFcSxVbt8Sln6DzXamffk5o0OTP4tGHQZSVcA/s NJ9PYZne5UzvuI/DCxpVnVqQZt/kzKcAl9cTq/mFjMAUUA73Al1iIFOfPAy6nAsDnA4N a2q+1o6iYLU5Te9MKkKdPM5h5nvsyeYQLKALUZk29V7aRAjm0KQFP/kt2nm8JsFQU6ff ViGDd4Bp7RoCI9W8h+9b/gBSQueH5VpEhq6I+IYCdhqC1VEc0P/6OqZ2XG+Bfv0gp3QW XlZA== X-Gm-Message-State: AOAM531SX7MMxMTfX7+OsAr+oa0NDIqcD0Ud5hT0XF3xc+4hMNEb0e3Y L0eu6/0GJgPOnCcWVaS5xhJl+R8Zojk= X-Google-Smtp-Source: ABdhPJzEvBukn+bFFFISE0Jb5opOSQqawby0qHYalbsVNMHCRQYHBYK+ULl1GbSZewFmeO//WTWXjQ== X-Received: by 2002:a17:90a:4d48:: with SMTP id l8mr6571387pjh.120.1624423790195; Tue, 22 Jun 2021 21:49:50 -0700 (PDT) Received: from han1-mobl3.intel.com ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id c184sm900129pfa.38.2021.06.22.21.49.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:49:49 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 5/5] tools/mgmt-tester: Update to support multiple extended adv instances Date: Tue, 22 Jun 2021 21:49:44 -0700 Message-Id: <20210623044944.602205-5-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210623044944.602205-1-hj.tedd.an@gmail.com> References: <20210623044944.602205-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 to align with the multiple extended advertising support. --- tools/mgmt-tester.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 8cae376f4..d2ded574e 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -5871,9 +5871,10 @@ static void setup_bthost(void) if (data->hciemu_type == HCIEMU_TYPE_LE || test->client_enable_adv) { - if (data->hciemu_type >= HCIEMU_TYPE_BREDRLE50) + if (data->hciemu_type >= HCIEMU_TYPE_BREDRLE50) { + bthost_set_ext_adv_params(bthost); bthost_set_ext_adv_enable(bthost, 0x01); - else + } else bthost_set_adv_enable(bthost, 0x01); } else bthost_write_scan_enable(bthost, 0x03); @@ -7554,7 +7555,7 @@ static const uint8_t read_adv_features_rsp_3[] = { 0xff, 0xff, 0x01, 0x00, /* supported flags */ 0x1f, /* max_adv_data_len */ 0x1f, /* max_scan_rsp_len */ - 0x01, /* max_instances */ + 0x03, /* max_instances */ 0x00, /* num_instances */ }; @@ -8077,9 +8078,6 @@ static const struct generic_data add_ext_advertising_timeout_expired = { .expect_alt_ev = MGMT_EV_ADVERTISING_REMOVED, .expect_alt_ev_param = advertising_instance1_param, .expect_alt_ev_len = sizeof(advertising_instance1_param), - .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, - .expect_hci_param = set_ext_adv_disable_param, - .expect_hci_len = sizeof(set_ext_adv_disable_param), }; static const struct generic_data remove_ext_advertising_fail_1 = { @@ -8120,7 +8118,7 @@ static const struct generic_data remove_ext_advertising_success_2 = { }; static const uint8_t set_ext_adv_data_test2[] = { - 0x01, /* handle */ + 0x02, /* handle */ 0x03, /* complete data */ 0x01, /* controller should not fragment */ 0x07, /* adv data len */ @@ -8129,13 +8127,10 @@ static const uint8_t set_ext_adv_data_test2[] = { 0x74, 0x65, 0x73, 0x74, 0x32, /* "test2" */ }; -static const struct generic_data multi_ext_advertising_switch = { +static const struct generic_data multi_ext_advertising = { .expect_alt_ev = MGMT_EV_ADVERTISING_REMOVED, .expect_alt_ev_param = advertising_instance1_param, .expect_alt_ev_len = sizeof(advertising_instance1_param), - .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_DATA, - .expect_hci_param = set_ext_adv_data_test2, - .expect_hci_len = sizeof(set_ext_adv_data_test2), }; static const struct generic_data multi_ext_advertising_add_second = { @@ -9654,6 +9649,7 @@ static void trigger_device_found(void *user_data) bthost_set_adv_enable(bthost, 0x01); } else if (data->hciemu_type >= HCIEMU_TYPE_BREDRLE50) { + bthost_set_ext_adv_params(bthost); if (test->set_adv) bthost_set_ext_adv_data(bthost, test->adv_data, test->adv_data_len); @@ -9818,21 +9814,16 @@ static void le_connected_event(uint16_t index, uint16_t length, tester_print("Device connected"); - test_add_condition(data); - - if (data->hciemu_type >= HCIEMU_TYPE_BREDRLE50) - hciemu_add_hook(data->hciemu, HCIEMU_HOOK_POST_CMD, - BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, - test_adv_enable_hook, data); - else + if (data->hciemu_type < HCIEMU_TYPE_BREDRLE50) { + test_add_condition(data); hciemu_add_hook(data->hciemu, HCIEMU_HOOK_POST_CMD, BT_HCI_CMD_LE_SET_ADV_ENABLE, test_adv_enable_hook, data); + } /* Make sure we get not disconnected during the testaces */ mgmt_register(data->mgmt_alt, MGMT_EV_DEVICE_DISCONNECTED, data->mgmt_index, disconnected_event, - NULL, NULL); test_condition_complete(data); @@ -11067,7 +11058,6 @@ int main(int argc, char *argv[]) &add_advertising_name_data_appear, setup_command_generic, test_command_generic); - test_le_full("Adv. connectable & connected (slave) - Success", &conn_slave_adv_conneactable_test, setup_advertise_while_connected, @@ -11406,8 +11396,8 @@ int main(int argc, char *argv[]) /* When advertising two instances, the instances should be * advertised in a round-robin fashion. */ - test_bredrle50("Multi Ext Advertising - Success 1 (Instance Switch)", - &multi_ext_advertising_switch, + test_bredrle50("Multi Ext Advertising - Success 1", + &multi_ext_advertising, setup_multi_adv, test_command_generic); @@ -11430,7 +11420,7 @@ int main(int argc, char *argv[]) NULL, test_command_generic); test_bredrle50("Set PHY 1m 2m coded Succcess", &set_phy_all_success, - NULL, test_command_generic); + NULL, test_command_generic); test_bredrle50("Set PHY 2m tx success", &set_phy_2m_tx_success, NULL, test_command_generic);