From: Tedd Ho-Jeong An <[email protected]>
This patch adds a test case to test if the scan response data is updated
when the following scenarios are performed.
1. Add Extended Advertising Parameters Command
2. Add Extended Advertising Data Command w/ Scan Resp Data
3. Remove Advertising Command
4. Add Extended Advertising Parameters Command
5. Add Extended Advertising Data Command w/ Scan Resp Data
6. Host should set Scan Resp Data
---
tools/mgmt-tester.c | 85 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 84 insertions(+), 1 deletion(-)
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 2b27394a1..f45a6c015 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -6156,6 +6156,23 @@ static void setup_pairing_acceptor(const void *test_data)
setup_bthost();
}
+/* Generic callback for checking the mgmt evnet status
+ */
+static void generic_mgmt_status_callback(uint8_t status, uint16_t length,
+ const void *param, void *user_data)
+{
+ bool bthost = PTR_TO_INT(user_data);
+
+ if (status != MGMT_STATUS_SUCCESS) {
+ tester_setup_failed();
+ return;
+ }
+
+ if (bthost)
+ setup_bthost();
+}
+
+
static void setup_powered_callback(uint8_t status, uint16_t length,
const void *param, void *user_data)
{
@@ -6990,6 +7007,66 @@ static void setup_ext_adv_params(const void *test_data)
NULL, NULL);
}
+static const uint8_t hci_set_ext_adv_data_name[] = {
+ 0x01, /* Handle */
+ 0x03, /* Operation */
+ 0x01, /* Complete name */
+ 0x06, 0x05, 0x08, 0x74, 0x65, 0x73, 0x74
+};
+
+static const struct generic_data add_ext_adv_scan_resp_off_on = {
+ .send_opcode = MGMT_OP_ADD_EXT_ADV_DATA,
+ .send_param = ext_adv_data_valid,
+ .send_len = sizeof(ext_adv_data_valid),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .expect_param = ext_adv_data_mgmt_rsp_valid,
+ .expect_len = sizeof(ext_adv_data_mgmt_rsp_valid),
+ .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_RSP_DATA,
+ .expect_hci_param = hci_set_ext_adv_data_name,
+ .expect_hci_len = sizeof(hci_set_ext_adv_data_name),
+};
+
+static void setup_add_ext_adv_on_off(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ unsigned char param[] = { 0x01 };
+ int enable_bthost = 1;
+
+ mgmt_send(data->mgmt, MGMT_OP_SET_LE, data->mgmt_index,
+ sizeof(param), ¶m,
+ NULL, NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_SET_POWERED, data->mgmt_index,
+ sizeof(param), ¶m,
+ generic_mgmt_status_callback,
+ NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_ADD_EXT_ADV_PARAMS, data->mgmt_index,
+ sizeof(ext_adv_params_valid),
+ &ext_adv_params_valid,
+ generic_mgmt_status_callback,
+ NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_ADD_EXT_ADV_DATA, data->mgmt_index,
+ sizeof(ext_adv_data_valid),
+ &ext_adv_data_valid,
+ generic_mgmt_status_callback,
+ NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_REMOVE_ADVERTISING, data->mgmt_index,
+ sizeof(remove_advertising_param_1),
+ &remove_advertising_param_1,
+ generic_mgmt_status_callback,
+ NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_ADD_EXT_ADV_PARAMS, data->mgmt_index,
+ sizeof(ext_adv_params_valid),
+ &ext_adv_params_valid,
+ generic_mgmt_status_callback,
+ INT_TO_PTR(enable_bthost), NULL);
+
+}
+
static void pin_code_request_callback(uint16_t index, uint16_t length,
const void *param, void *user_data)
{
@@ -13960,11 +14037,17 @@ int main(int argc, char *argv[])
setup_ext_adv_params,
test_command_generic);
- test_bredrle50("zxcv Ext Adv MGMT - AD Scan Response (5.0) Success",
+ test_bredrle50("Ext Adv MGMT - AD Scan Response (5.0) Success",
&adv_scan_rsp_success,
setup_ext_adv_params,
test_command_generic);
+ test_bredrle50("Ext Adv MGMT - AD Scan Resp - Off and On",
+ &add_ext_adv_scan_resp_off_on,
+ setup_add_ext_adv_on_off,
+ test_command_generic);
+
+
/* MGMT_OP_SET_DEVICE_ID
* Using Bluetooth SIG for source.
*/
--
2.34.1
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=652500
---Test result---
Test Summary:
CheckPatch PASS 0.75 seconds
GitLint PASS 0.45 seconds
Prep - Setup ELL PASS 52.57 seconds
Build - Prep PASS 0.58 seconds
Build - Configure PASS 9.76 seconds
Build - Make PASS 1759.59 seconds
Make Check PASS 12.12 seconds
Make Check w/Valgrind PASS 541.29 seconds
Make Distcheck PASS 273.37 seconds
Build w/ext ELL - Configure PASS 11.70 seconds
Build w/ext ELL - Make PASS 1763.12 seconds
Incremental Build with patchesPASS 1786.68 seconds
---
Regards,
Linux Bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:
On Tue, 21 Jun 2022 13:10:54 -0700 you wrote:
> From: Tedd Ho-Jeong An <[email protected]>
>
> This patch adds a test case to test if the scan response data is updated
> when the following scenarios are performed.
>
> 1. Add Extended Advertising Parameters Command
> 2. Add Extended Advertising Data Command w/ Scan Resp Data
> 3. Remove Advertising Command
> 4. Add Extended Advertising Parameters Command
> 5. Add Extended Advertising Data Command w/ Scan Resp Data
> 6. Host should set Scan Resp Data
>
> [...]
Here is the summary with links:
- [BlueZ] tools/mgmt-tester: Add test case for scan response data is not updating
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b8b3277ba387
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html