From 546622fd9f090f1f5af16b0a76f4bc38f114d032 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 27 Jan 2013 19:08:44 +0200 Subject: [PATCH] tools: Add mixed UUIDs test case for mgmt_add_uuid --- tools/mgmt-tester.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index ed5e961c0..a99a18e96 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -1332,6 +1332,37 @@ static const char write_eir_uuid128_multi_hci_2[] = { 0x00, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const char write_eir_uuid_mix_hci[] = { 0x00, + 0x02, 0x0a, 0x00, 0x05, 0x03, 0x01, 0x11, 0x03, + 0x11, 0x09, 0x05, 0x78, 0x56, 0x34, 0x12, 0xef, + 0xcd, 0xbc, 0x9a, 0x21, 0x07, 0x00, 0x11, 0x22, + 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, + 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xff, 0xee, 0xdd, + 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, + 0x44, 0x33, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const struct generic_data add_uuid16_test_1 = { .send_opcode = MGMT_OP_ADD_UUID, @@ -1441,6 +1472,18 @@ static const struct generic_data add_uuid128_multi_test_2 = { .expect_hci_len = sizeof(write_eir_uuid128_multi_hci_2), }; +static const struct generic_data add_uuid_mix_test_1 = { + .send_opcode = MGMT_OP_ADD_UUID, + .send_param = add_uuid128_param_2, + .send_len = sizeof(add_uuid128_param_2), + .expect_status = MGMT_STATUS_SUCCESS, + .expect_param = set_dev_class_zero_rsp, + .expect_len = sizeof(set_dev_class_zero_rsp), + .expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE, + .expect_hci_param = write_eir_uuid_mix_hci, + .expect_hci_len = sizeof(write_eir_uuid_mix_hci), +}; + static const char load_link_keys_valid_param_1[] = { 0x00, 0x00, 0x00 }; static const char load_link_keys_valid_param_2[] = { 0x01, 0x00, 0x00 }; static const char load_link_keys_invalid_param_1[] = { 0x02, 0x00, 0x00 }; @@ -1968,6 +2011,38 @@ static void setup_multi_uuid16_2(const void *test_data) setup_powered_callback, NULL, NULL); } +static void setup_uuid_mix(const void *test_data) +{ + struct test_data *data = tester_get_data(); + unsigned char param[] = { 0x01 }; + + tester_print("Powering on controller (with mixed UUIDs)"); + + mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index, + sizeof(param), param, NULL, NULL, NULL); + + mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index, + sizeof(add_spp_uuid_param), add_spp_uuid_param, + NULL, NULL, NULL); + mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index, + sizeof(add_uuid32_param_1), add_uuid32_param_1, + NULL, NULL, NULL); + mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index, + sizeof(add_uuid128_param_1), add_uuid128_param_1, + NULL, NULL, NULL); + + mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index, + sizeof(add_dun_uuid_param), add_dun_uuid_param, + NULL, NULL, NULL); + mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index, + sizeof(add_uuid32_param_2), add_uuid32_param_2, + NULL, NULL, NULL); + + mgmt_send(data->mgmt, MGMT_OP_SET_POWERED, data->mgmt_index, + sizeof(param), param, + setup_powered_callback, NULL, NULL); +} + static void setup_powered(const void *test_data) { struct test_data *data = tester_get_data(); @@ -2499,6 +2574,8 @@ int main(int argc, char *argv[]) setup_multi_uuid128, test_command_generic); test_bredr("Add UUID - UUID-128 partial 1", &add_uuid128_multi_test_2, setup_multi_uuid128_2, test_command_generic); + test_bredr("Add UUID - UUID mix", &add_uuid_mix_test_1, + setup_uuid_mix, test_command_generic); test_bredr("Load Link Keys - Empty List Success 1", &load_link_keys_success_test_1, NULL, -- 2.47.3