aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-11-05 12:04:49 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-11-09 14:45:51 -0800
commit0d5013510a410b931fa2ad93fe3147a2762b901d (patch)
treea7b8243fae954377431edfe037cd15be31b877bc /tools
parent72c562e4e47f3bf59a91d776a396c76df2e99ddc (diff)
mgmt-tester: Add test for Device Privacy Mode flag
This tests the use of Set Device Flags to set Device Privacy Mode which results in the following sequence: @ MGMT Event: Command Compl.. (0x0001) plen 10 {0x0001} Set Device Flags (0x0050) plen 7 Status: Success (0x00) LE Address: BC:9A:78:56:34:12 (OUI BC-9A-78) < HCI Command: LE Set Exten.. (0x08|0x0042) plen 6 Extended scan: Disabled (0x00) Filter duplicates: Disabled (0x00) Duration: 0 msec (0x0000) Period: 0.00 sec (0x0000) = mgmt-tester: Set Device Flags (0x0050): Success (0x00) = mgmt-tester: Test condition complete, 4 left = mgmt-tester: New Device Flags Changed event received = mgmt-tester: Test condition complete, 3 left > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Scan Enable (0x08|0x0042) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Addre.. (0x08|0x002d) plen 1 Address resolution: Disabled (0x00) = mgmt-tester: HCI Command 0x2042 length 6 > HCI Event: Command Complete (0x0e) plen 4 LE Set Address Resolution Enable (0x08|0x002d) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Priva.. (0x08|0x004e) plen 8 Peer Identity address type: Public (0x00) Peer Identity address: BC:9A:78:56:34:12 (OUI BC-9A-78) Privacy Mode: Use Device Privacy (0x01) = mgmt-tester: HCI Command 0x202d length 1 = mgmt-tester: Test condition complete, 2 left > HCI Event: Command Complete (0x0e) plen 4 LE Set Privacy Mode (0x08|0x004e) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Addre.. (0x08|0x002d) plen 1 Address resolution: Enabled (0x01) = mgmt-tester: HCI Command 0x204e length 8 = mgmt-tester: Test condition complete, 1 left > HCI Event: Command Complete (0x0e) plen 4 LE Set Address Resolution Enable (0x08|0x002d) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Exten.. (0x08|0x0041) plen 8 Own address type: Random (0x03) Filter policy: Ignore not in accept list (0x01) PHYs: 0x01 Entry 0: LE 1M Type: Passive (0x00) Interval: 60.000 msec (0x0060) Window: 30.000 msec (0x0030) = mgmt-tester: HCI Command 0x202d length 1 = mgmt-tester: Test condition complete, 0 left
Diffstat (limited to 'tools')
-rw-r--r--tools/mgmt-tester.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index e9fcb26025..e5319d1232 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -10578,6 +10578,63 @@ static const struct generic_data ll_privacy_unpair_2 = {
.expect_hci_len = sizeof(add_to_al_client),
};
+static const uint8_t set_device_flags_param_1[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, /* BDADDR */
+ 0x01, /* Type - LE Public */
+ 0x02, 0x00, 0x00, 0x00 /* Flags - Device Privacy */
+};
+
+static const uint8_t set_device_flags_rsp[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, /* BDADDR */
+ 0x01 /* Type - LE Public */
+};
+
+static const uint8_t le_set_priv_mode_param[] = {
+ 0x00, /* Type */
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, /* BDADDR */
+ 0x01 /* Privacy Mode */
+};
+
+static const struct hci_cmd_data ll_privacy_set_device_flags_1_hci_list[] = {
+ {
+ .opcode = BT_HCI_CMD_LE_SET_RESOLV_ENABLE,
+ .param = set_resolv_off_param,
+ .len = sizeof(set_resolv_off_param),
+ },
+ {
+ .opcode = BT_HCI_CMD_LE_SET_PRIV_MODE,
+ .param = le_set_priv_mode_param,
+ .len = sizeof(le_set_priv_mode_param),
+ },
+ {
+ .opcode = BT_HCI_CMD_LE_SET_RESOLV_ENABLE,
+ .param = set_resolv_on_param,
+ .len = sizeof(set_resolv_on_param),
+ },
+};
+
+static const uint8_t device_flags_changed_params_1[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, /* BDADDR */
+ 0x01, /* Type - LE Public */
+ 0x03, 0x00, 0x00, 0x00, /* Supported Flags */
+ 0x02, 0x00, 0x00, 0x00 /* Current Flags */
+};
+
+static const struct generic_data ll_privacy_set_device_flag_1 = {
+ .setup_settings = settings_le_privacy_ll_privacy,
+ .setup_exp_feat_param = set_exp_feat_param_ll_privacy,
+ .send_opcode = MGMT_OP_SET_DEVICE_FLAGS,
+ .send_param = set_device_flags_param_1,
+ .send_len = sizeof(set_device_flags_param_1),
+ .expect_param = set_device_flags_rsp,
+ .expect_len = sizeof(set_device_flags_rsp),
+ .expect_status = MGMT_STATUS_SUCCESS,
+ .expect_alt_ev = MGMT_EV_DEVICE_FLAGS_CHANGED,
+ .expect_alt_ev_param = device_flags_changed_params_1,
+ .expect_alt_ev_len = sizeof(device_flags_changed_params_1),
+ .expect_hci_list = ll_privacy_set_device_flags_1_hci_list,
+};
+
static void setup_load_irks_callback(uint8_t status, uint16_t length,
const void *param, void *user_data)
{
@@ -11085,6 +11142,27 @@ static void setup_ll_privacy_add_adv(const void *test_data)
setup_powered_callback, NULL, NULL);
}
+static void setup_ll_privacy_add_device(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ unsigned char param[] = { 0x01 };
+
+ mgmt_send(data->mgmt, MGMT_OP_LOAD_IRKS, data->mgmt_index,
+ sizeof(load_irks_le_public_param_1),
+ load_irks_le_public_param_1,
+ setup_load_irks_callback, NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_SET_POWERED, data->mgmt_index,
+ sizeof(param), param,
+ setup_powered_callback, NULL, NULL);
+
+ mgmt_send(data->mgmt, MGMT_OP_ADD_DEVICE, data->mgmt_index,
+ sizeof(add_device_le_public_param_1),
+ add_device_le_public_param_1,
+ setup_add_device_callback, NULL, NULL);
+
+}
+
static bool power_off(uint16_t index)
{
int sk, err;
@@ -14406,5 +14484,15 @@ int main(int argc, char *argv[])
NULL,
test_ll_privacy_unpair_2, 5);
+ /* LL Privacy
+ * Setup: Enable LL Privacy, add IRK of new device, Add Device
+ * Run: Set Device Flags
+ * Expect: Device Privacy Mode is set.
+ */
+ test_bredrle50("LL Privacy - Set Device Flag 1 (Device Privacy)",
+ &ll_privacy_set_device_flag_1,
+ setup_ll_privacy_add_device,
+ test_command_generic);
+
return tester_run();
}