2020-12-23 00:30:16

by Tedd Ho-Jeong An

[permalink] [raw]
Subject: [PATCH 1/3] tools/mgmt-tester: Update sample data for adv features

This patch updates the expected sample data for advertising feature to
include the changes for tx power.
---
tools/mgmt-tester.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index bef506134..d9d7b3430 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -4162,7 +4162,7 @@ static const struct generic_data read_adv_features_invalid_index_test = {
};

static const uint8_t read_adv_features_rsp_1[] = {
- 0x7f, 0x00, 0x00, 0x00, /* supported flags */
+ 0x7f, 0xf0, 0x00, 0x00, /* supported flags */
0x1f, /* max_adv_data_len */
0x1f, /* max_scan_rsp_len */
0x05, /* max_instances */
@@ -4177,7 +4177,7 @@ static const struct generic_data read_adv_features_success_1 = {
};

static const uint8_t read_adv_features_rsp_2[] = {
- 0x7f, 0x00, 0x00, 0x00, /* supported flags */
+ 0x7f, 0xf0, 0x00, 0x00, /* supported flags */
0x1f, /* max_adv_data_len */
0x1f, /* max_scan_rsp_len */
0x05, /* max_instances */
@@ -7137,7 +7137,7 @@ static const struct generic_data set_appearance_success = {
};

static const uint8_t read_adv_features_rsp_3[] = {
- 0xff, 0x0f, 0x00, 0x00, /* supported flags */
+ 0xff, 0xff, 0x00, 0x00, /* supported flags */
0x1f, /* max_adv_data_len */
0x1f, /* max_scan_rsp_len */
0x01, /* max_instances */
--
2.25.1


2020-12-23 00:30:16

by Tedd Ho-Jeong An

[permalink] [raw]
Subject: [PATCH 3/3] tools/mgmt-tester: Adds new test data with updated tx power

This patch adds new test data for the ext advertising test cases that
presets the advertising parameter and toggles the connectable flags.

When the adv instance is created, it updates the default tx power with
the value read from the controller. After toggling the connectable flag,
the host uses the tx_power stored in the adv list cache, which is the
value read from the controller, instead of the default tx power
value(127).
---
tools/mgmt-tester.c | 88 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 80 insertions(+), 8 deletions(-)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index d9d7b3430..fe73a6d89 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -7592,6 +7592,24 @@ static const struct generic_data add_ext_advertising_success_15 = {
.expect_hci_len = sizeof(set_connectable_on_ext_adv_param),
};

+static uint8_t preset_connectable_on_ext_adv_param[] = {
+ 0x01, /* Handle */
+ 0x13, 0x00, /* Event type */
+ 0x00, 0x08, 0x00, /* min_interval */
+ 0x00, 0x08, 0x00, /* max_interval */
+ 0x07, /* channel_map */
+ 0x00, /* own_addr_type */
+ 0x00, /* peer_addr_type */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* peer_addr */
+ 0x00, /* filter_policy */
+ 0x00, /* Tx power */
+ 0x01, /* Primary PHY */
+ 0x00, /* primary adv max skip */
+ 0x01, /* Secondary PHY */
+ 0x00, /* adv sid*/
+ 0x00, /* Scan req notification */
+};
+
static const struct generic_data add_ext_advertising_success_16 = {
.send_opcode = MGMT_OP_SET_CONNECTABLE,
.send_param = set_connectable_on_param,
@@ -7600,8 +7618,26 @@ static const struct generic_data add_ext_advertising_success_16 = {
.expect_param = set_connectable_settings_param_3,
.expect_len = sizeof(set_connectable_settings_param_3),
.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
- .expect_hci_param = set_connectable_on_ext_adv_param,
- .expect_hci_len = sizeof(set_connectable_on_ext_adv_param),
+ .expect_hci_param = preset_connectable_on_ext_adv_param,
+ .expect_hci_len = sizeof(preset_connectable_on_ext_adv_param),
+};
+
+static uint8_t preset_connectable_off_ext_adv_param[] = {
+ 0x01, /* Handle */
+ 0x10, 0x00, /* Event type */
+ 0x00, 0x08, 0x00, /* min_interval */
+ 0x00, 0x08, 0x00, /* max_interval */
+ 0x07, /* channel_map */
+ 0x01, /* own_addr_type */
+ 0x00, /* peer_addr_type */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* peer_addr */
+ 0x00, /* filter_policy */
+ 0x00, /* Tx power */
+ 0x01, /* Primary PHY */
+ 0x00, /* primary adv max skip */
+ 0x01, /* Secondary PHY */
+ 0x00, /* adv sid*/
+ 0x00, /* Scan req notification */
};

static const struct generic_data add_ext_advertising_success_17 = {
@@ -7612,8 +7648,8 @@ static const struct generic_data add_ext_advertising_success_17 = {
.expect_param = set_le_settings_param_2,
.expect_len = sizeof(set_le_settings_param_2),
.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
- .expect_hci_param = set_connectable_off_ext_adv_param,
- .expect_hci_len = sizeof(set_connectable_off_ext_adv_param),
+ .expect_hci_param = preset_connectable_off_ext_adv_param,
+ .expect_hci_len = sizeof(preset_connectable_off_ext_adv_param),
};

static const struct generic_data add_ext_advertising_le_off = {
@@ -8240,6 +8276,24 @@ static void setup_add_advertising_1m(const void *test_data)
NULL, NULL);
}

+static uint8_t preset_connectable_on_ext_pdu_adv_param[] = {
+ 0x01, /* Handle */
+ 0x01, 0x00, /* Event type */
+ 0x00, 0x08, 0x00, /* min_interval */
+ 0x00, 0x08, 0x00, /* max_interval */
+ 0x07, /* channel_map */
+ 0x00, /* own_addr_type */
+ 0x00, /* peer_addr_type */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* peer_addr */
+ 0x00, /* filter_policy */
+ 0x00, /* Tx power */
+ 0x01, /* Primary PHY */
+ 0x00, /* primary adv max skip */
+ 0x01, /* Secondary PHY */
+ 0x00, /* adv sid*/
+ 0x00, /* Scan req notification */
+};
+
static const struct generic_data add_ext_advertising_conn_on_1m = {
.send_opcode = MGMT_OP_SET_CONNECTABLE,
.send_param = set_connectable_on_param,
@@ -8248,8 +8302,8 @@ static const struct generic_data add_ext_advertising_conn_on_1m = {
.expect_param = set_connectable_settings_param_3,
.expect_len = sizeof(set_connectable_settings_param_3),
.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
- .expect_hci_param = set_connectable_on_ext_pdu_adv_param,
- .expect_hci_len = sizeof(set_connectable_on_ext_pdu_adv_param),
+ .expect_hci_param = preset_connectable_on_ext_pdu_adv_param,
+ .expect_hci_len = sizeof(preset_connectable_on_ext_pdu_adv_param),
};

static void setup_add_advertising_connectable_1m(const void *test_data)
@@ -8282,6 +8336,24 @@ static void setup_add_advertising_connectable_1m(const void *test_data)
NULL, NULL);
}

+static uint8_t preset_connectable_off_ext_1m_adv_param[] = {
+ 0x01, /* Handle */
+ 0x00, 0x00, /* Event type */
+ 0x00, 0x08, 0x00, /* min_interval */
+ 0x00, 0x08, 0x00, /* max_interval */
+ 0x07, /* channel_map */
+ 0x01, /* own_addr_type */
+ 0x00, /* peer_addr_type */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* peer_addr */
+ 0x00, /* filter_policy */
+ 0x00, /* Tx power */
+ 0x01, /* Primary PHY */
+ 0x00, /* primary adv max skip */
+ 0x01, /* Secondary PHY */
+ 0x00, /* adv sid*/
+ 0x00, /* Scan req notification */
+};
+
static const struct generic_data add_ext_advertising_conn_off_1m = {
.send_opcode = MGMT_OP_SET_CONNECTABLE,
.send_param = set_connectable_off_param,
@@ -8290,8 +8362,8 @@ static const struct generic_data add_ext_advertising_conn_off_1m = {
.expect_param = set_le_settings_param_2,
.expect_len = sizeof(set_le_settings_param_2),
.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
- .expect_hci_param = set_connectable_off_ext_1m_adv_param,
- .expect_hci_len = sizeof(set_connectable_off_ext_1m_adv_param),
+ .expect_hci_param = preset_connectable_off_ext_1m_adv_param,
+ .expect_hci_len = sizeof(preset_connectable_off_ext_1m_adv_param),
};

static const uint8_t get_phy_param[] = {
--
2.25.1

2020-12-23 00:30:18

by Tedd Ho-Jeong An

[permalink] [raw]
Subject: [PATCH 2/3] emulator/btdev: Add support LE_READ_TX_POWER command

This patch adds support for LE_READ_TX_POWER command.
It uses a random values for min and max tx power since these values is
read from the controller.
---
emulator/btdev.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index ae382d9b9..17965f9b6 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -4170,6 +4170,22 @@ static int cmd_read_per_adv_list_size(struct btdev *dev, const void *data,
return -ENOTSUP;
}

+static int cmd_read_tx_power(struct btdev *dev, const void *data, uint8_t len)
+{
+ struct bt_hci_rsp_le_read_tx_power rsp;
+
+ memset(&rsp, 0, sizeof(rsp));
+
+ rsp.status = BT_HCI_ERR_SUCCESS;
+ /* a random default value */
+ rsp.max_tx_power = 0x07;
+ rsp.min_tx_power = 0xDE;
+
+ cmd_complete(dev, BT_HCI_CMD_LE_READ_TX_POWER, &rsp, sizeof(rsp));
+
+ return 0;
+}
+
#define CMD_LE_50 \
CMD(BT_HCI_CMD_LE_SET_DEFAULT_PHY, cmd_set_default_phy, NULL), \
CMD(BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR, cmd_set_adv_rand_addr, NULL), \
@@ -4205,7 +4221,8 @@ static int cmd_read_per_adv_list_size(struct btdev *dev, const void *data,
NULL), \
CMD(BT_HCI_CMD_LE_CLEAR_PERIODIC_ADV_LIST, cmd_per_adv_clear, NULL), \
CMD(BT_HCI_CMD_LE_READ_PERIODIC_ADV_LIST_SIZE, \
- cmd_read_per_adv_list_size, NULL)
+ cmd_read_per_adv_list_size, NULL), \
+ CMD(BT_HCI_CMD_LE_READ_TX_POWER, cmd_read_tx_power, NULL)

static const struct btdev_cmd cmd_le_5_0[] = {
CMD_COMMON_ALL,
@@ -4240,6 +4257,7 @@ static void set_le_50_commands(struct btdev *btdev)
btdev->commands[38] |= 0x10; /* LE Remove Periodic Adv List */
btdev->commands[38] |= 0x20; /* LE Clear Periodic Adv List */
btdev->commands[38] |= 0x40; /* LE Read Periodic Adv List Size */
+ btdev->commands[38] |= 0x80; /* LE Read Transmit Power */
btdev->cmds = cmd_le_5_0;
}

--
2.25.1

2020-12-23 01:28:37

by bluez.test.bot

[permalink] [raw]
Subject: RE: [1/3] tools/mgmt-tester: Update sample data for adv features

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=405549

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth

2020-12-23 18:38:18

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [1/3] tools/mgmt-tester: Update sample data for adv features

Hi Tedd,

On Tue, Dec 22, 2020 at 5:28 PM <[email protected]> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=405549
>
> ---Test result---
>
> ##############################
> Test: CheckPatch - PASS
>
> ##############################
> Test: CheckGitLint - PASS
>
> ##############################
> Test: CheckBuild - PASS
>
> ##############################
> Test: MakeCheck - PASS
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

--
Luiz Augusto von Dentz