Diff between 39c29f8cac2de8e685e88e751421fdc3d5984baf and a1723c83ba0561a23de24af4b64e3f7fa126b973

Changed Files

File Additions Deletions Status
tools/mgmt-tester.c +76 -3 modified

Full Patch

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 857a67b..b69b131 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -821,7 +821,7 @@ static const char write_eir_uuid16_hci[] = { 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 char write_eir_multi_uuid16_hci[] = { 0x00,
+static const char write_eir_multi_uuid16_hci_1[] = { 0x00,
 			0x02, 0x0a, 0x00, 0x09, 0x03, 0x01, 0x11, 0x03,
 			0x11, 0x04, 0x11, 0x05, 0x11, 0x00, 0x00, 0x00,
 			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -852,6 +852,37 @@ static const char write_eir_multi_uuid16_hci[] = { 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 char write_eir_multi_uuid16_hci_2[241] = { 0x00,
+			0x02, 0x0a, 0x00, 0xeb, 0x02, 0x00, 0x20, 0x01,
+			0x20, 0x02, 0x20, 0x03, 0x20, 0x04, 0x20, 0x05,
+			0x20, 0x06, 0x20, 0x07, 0x20, 0x08, 0x20, 0x09,
+			0x20, 0x0a, 0x20, 0x0b, 0x20, 0x0c, 0x20, 0x0d,
+			0x20, 0x0e, 0x20, 0x0f, 0x20, 0x10, 0x20, 0x11,
+			0x20, 0x12, 0x20, 0x13, 0x20, 0x14, 0x20, 0x15,
+			0x20, 0x16, 0x20, 0x17, 0x20, 0x18, 0x20, 0x19,
+			0x20, 0x1a, 0x20, 0x1b, 0x20, 0x1c, 0x20, 0x1d,
+			0x20, 0x1e, 0x20, 0x1f, 0x20, 0x20, 0x20, 0x21,
+			0x20, 0x22, 0x20, 0x23, 0x20, 0x24, 0x20, 0x25,
+			0x20, 0x26, 0x20, 0x27, 0x20, 0x28, 0x20, 0x29,
+			0x20, 0x2a, 0x20, 0x2b, 0x20, 0x2c, 0x20, 0x2d,
+			0x20, 0x2e, 0x20, 0x2f, 0x20, 0x30, 0x20, 0x31,
+			0x20, 0x32, 0x20, 0x33, 0x20, 0x34, 0x20, 0x35,
+			0x20, 0x36, 0x20, 0x37, 0x20, 0x38, 0x20, 0x39,
+			0x20, 0x3a, 0x20, 0x3b, 0x20, 0x3c, 0x20, 0x3d,
+			0x20, 0x3e, 0x20, 0x3f, 0x20, 0x40, 0x20, 0x41,
+			0x20, 0x42, 0x20, 0x43, 0x20, 0x44, 0x20, 0x45,
+			0x20, 0x46, 0x20, 0x47, 0x20, 0x48, 0x20, 0x49,
+			0x20, 0x4a, 0x20, 0x4b, 0x20, 0x4c, 0x20, 0x4d,
+			0x20, 0x4e, 0x20, 0x4f, 0x20, 0x50, 0x20, 0x51,
+			0x20, 0x52, 0x20, 0x53, 0x20, 0x54, 0x20, 0x55,
+			0x20, 0x56, 0x20, 0x57, 0x20, 0x58, 0x20, 0x59,
+			0x20, 0x5a, 0x20, 0x5b, 0x20, 0x5c, 0x20, 0x5d,
+			0x20, 0x5e, 0x20, 0x5f, 0x20, 0x60, 0x20, 0x61,
+			0x20, 0x62, 0x20, 0x63, 0x20, 0x64, 0x20, 0x65,
+			0x20, 0x66, 0x20, 0x67, 0x20, 0x68, 0x20, 0x69,
+			0x20, 0x6a, 0x20, 0x6b, 0x20, 0x6c, 0x20, 0x6d,
+			0x20, 0x6e, 0x20, 0x6f, 0x20, 0x70, 0x20, 0x71,
+			0x20, 0x72, 0x20, 0x73, 0x20, 0x74, 0x20, 0x00 };
 static const char add_uuid32_param_1[] = {
 			0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
 			0x00, 0x10, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12,
@@ -1022,8 +1053,20 @@ static const struct generic_data add_multi_uuid16_test_1 = {
 	.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_multi_uuid16_hci,
-	.expect_hci_len = sizeof(write_eir_multi_uuid16_hci),
+	.expect_hci_param = write_eir_multi_uuid16_hci_1,
+	.expect_hci_len = sizeof(write_eir_multi_uuid16_hci_1),
+};
+
+static const struct generic_data add_multi_uuid16_test_2 = {
+	.send_opcode = MGMT_OP_ADD_UUID,
+	.send_param = add_opp_uuid_param,
+	.send_len = sizeof(add_opp_uuid_param),
+	.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_multi_uuid16_hci_2,
+	.expect_hci_len = sizeof(write_eir_multi_uuid16_hci_2),
 };
 
 static const struct generic_data add_uuid32_test_1 = {
@@ -1468,6 +1511,34 @@ static void setup_multi_uuid16(const void *test_data)
 					setup_powered_callback, NULL, NULL);
 }
 
+static void setup_multi_uuid16_2(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	unsigned char param[] = { 0x01 };
+	unsigned char uuid_param[] = {
+			0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00 };
+	int i;
+
+	tester_print("Powering on controller (with many 16-bit UUIDs)");
+
+	mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index,
+				sizeof(param), param, NULL, NULL, NULL);
+
+	for (i = 0; i < 117; i++) {
+		uint16_t val = htobs(i + 0x2000);
+		memcpy(&uuid_param[12], &val, sizeof(val));
+		mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index,
+				sizeof(uuid_param), uuid_param,
+				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();
@@ -1862,6 +1933,8 @@ int main(int argc, char *argv[])
 				setup_ssp, test_command_generic);
 	test_bredr("Add UUID - UUID-16 multiple 1", &add_multi_uuid16_test_1,
 				setup_multi_uuid16, test_command_generic);
+	test_bredr("Add UUID - UUID-16 partial 1", &add_multi_uuid16_test_2,
+				setup_multi_uuid16_2, test_command_generic);
 	test_bredr("Add UUID - UUID-32 1", &add_uuid32_test_1, setup_ssp,
 				test_command_generic);
 	test_bredr("Add UUID - UUID-32 multiple 1", &add_uuid32_multi_test_1,