From ef9e550dd98cb6bc0cfca78289e220702a1bf82d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 30 Jul 2014 14:04:30 +0300 Subject: [PATCH] tools/mgmt-tester: Add just-works Pair Device tests with IO cap checks --- tools/mgmt-tester.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 75565631c..aec6d6214 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -2470,6 +2470,56 @@ static const struct generic_data pair_device_ssp_test_2 = { .client_io_cap = 0x01, /* DisplayYesNo */ }; +static const void *client_io_cap_param_func(uint8_t *len) +{ + struct test_data *data = tester_get_data(); + const struct generic_data *test = data->test_data; + static uint8_t param[9]; + + memcpy(param, hciemu_get_client_bdaddr(data->hciemu), 6); + memcpy(¶m[6], test->expect_hci_param, 3); + + *len = sizeof(param); + + return param; +} + +const uint8_t no_bonding_io_cap[] = { 0x03, 0x00, 0x00 }; +static const struct generic_data pair_device_ssp_test_3 = { + .setup_settings = settings_powered_ssp, + .client_enable_ssp = true, + .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_LINK_KEY, + .expect_alt_ev_len = 26, + .expect_hci_command = BT_HCI_CMD_IO_CAPABILITY_REQUEST_REPLY, + .expect_hci_func = client_io_cap_param_func, + .expect_hci_param = no_bonding_io_cap, + .expect_hci_len = sizeof(no_bonding_io_cap), + .io_cap = 0x03, /* NoInputNoOutput */ + .client_io_cap = 0x03, /* NoInputNoOutput */ +}; + +const uint8_t bonding_io_cap[] = { 0x03, 0x00, 0x02 }; +static const struct generic_data pair_device_ssp_test_4 = { + .setup_settings = settings_powered_bondable_ssp, + .client_enable_ssp = true, + .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_LINK_KEY, + .expect_alt_ev_len = 26, + .expect_hci_command = BT_HCI_CMD_IO_CAPABILITY_REQUEST_REPLY, + .expect_hci_func = client_io_cap_param_func, + .expect_hci_param = bonding_io_cap, + .expect_hci_len = sizeof(bonding_io_cap), + .io_cap = 0x03, /* NoInputNoOutput */ + .client_io_cap = 0x03, /* NoInputNoOutput */ +}; + static const struct generic_data pair_device_ssp_reject_1 = { .setup_settings = settings_powered_bondable_ssp, .client_enable_ssp = true, @@ -4411,6 +4461,12 @@ int main(int argc, char *argv[]) test_bredrle("Pair Device - SSP Just-Works Success 1", &pair_device_ssp_test_1, NULL, test_command_generic); + test_bredrle("Pair Device - SSP Just-Works Success 2", + &pair_device_ssp_test_3, + NULL, test_command_generic); + test_bredrle("Pair Device - SSP Just-Works Success 3", + &pair_device_ssp_test_4, + NULL, test_command_generic); test_bredrle("Pair Device - SSP Confirm Success 1", &pair_device_ssp_test_2, NULL, test_command_generic); -- 2.47.3