From 464e13edb6457bdc93d302ee9f7691eb7d8782f4 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 18 Sep 2014 11:00:25 +0300 Subject: [PATCH] mgmt-tester: Add simple LE pairing initiator test case --- tools/mgmt-tester.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 33694019e..72fc0aaa0 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -2291,7 +2291,10 @@ static const void *pair_device_send_param_func(uint16_t *len) static uint8_t param[8]; memcpy(param, hciemu_get_client_bdaddr(data->hciemu), 6); - param[6] = 0x00; /* Address type */ + if (data->hciemu_type == HCIEMU_TYPE_LE) + param[6] = 0x01; /* Address type */ + else + param[6] = 0x00; /* Address type */ param[7] = test->io_cap; *len = sizeof(param); @@ -2305,7 +2308,10 @@ static const void *pair_device_expect_param_func(uint16_t *len) static uint8_t param[7]; memcpy(param, hciemu_get_client_bdaddr(data->hciemu), 6); - param[6] = 0x00; /* Address type */ + if (data->hciemu_type == HCIEMU_TYPE_LE) + param[6] = 0x01; /* Address type */ + else + param[6] = 0x00; /* Address type */ *len = sizeof(param); @@ -2604,6 +2610,16 @@ static const struct generic_data pair_device_ssp_nonbondable_1 = { .client_io_cap = 0x01, /* DisplayYesNo */ }; +static const struct generic_data pair_device_le_success_test_1 = { + .setup_settings = settings_powered_bondable, + .send_opcode = MGMT_OP_PAIR_DEVICE, + .send_func = pair_device_send_param_func, + .expect_status = MGMT_STATUS_SUCCESS, + .expect_func = pair_device_expect_param_func, + .expect_alt_ev = MGMT_EV_NEW_LONG_TERM_KEY, + .expect_alt_ev_len = sizeof(struct mgmt_ev_new_long_term_key), +}; + static uint16_t settings_powered_connectable_bondable[] = { MGMT_OP_SET_BONDABLE, MGMT_OP_SET_CONNECTABLE, @@ -4605,6 +4621,9 @@ int main(int argc, char *argv[]) test_bredrle("Pair Device - SSP Non-bondable 1", &pair_device_ssp_nonbondable_1, NULL, test_command_generic); + test_le("Pair Device - LE Success 1", + &pair_device_le_success_test_1, + NULL, test_command_generic); test_bredrle("Pairing Acceptor - Legacy 1", &pairing_acceptor_legacy_1, NULL, -- 2.47.3