Diff between c95e067c3e2d143c1ac746182879d6db9dc1ff13 and 282f0d076a803cc445f9a7f0cc066ca489ccc493

Changed Files

File Additions Deletions Status
android/android-tester.c +82 -52 modified

Full Patch

diff --git a/android/android-tester.c b/android/android-tester.c
index e0b4579..aa953bf 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -3301,64 +3301,94 @@ static void hid_ctrl_connect_cb(uint16_t handle, uint16_t cid, void *user_data)
 	bthost_add_cid_hook(bthost, handle, cid, hid_ctrl_cid_hook_cb, NULL);
 }
 
+static const uint8_t did_req_pdu[] = { 0x06, /* PDU id */
+			0x00, 0x00, /* Transaction id */
+			0x00, 0x1d, /* Req length */
+			0x35, 0x11, /* Attributes length */
+			0x1c, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00,
+			0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, 0xff,
+			0xff, 0x35, 0x05, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x00,
+			0x06, 0x00, 0x01, 0x00, 0x1d, 0x35, 0x11, 0x1c, 0x00,
+			0x00, 0x11, 0x24, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
+			0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, 0xff, 0xff, 0x35,
+			0x05, 0x0a, 0x00, 0x0, 0xff, 0xff,
+			0x00 }; /* no continuation */
+
+static const uint8_t did_rsp_pdu[] = { 0x07, /* PDU id */
+			0x00, 0x00, /* Transaction id */
+			0x00, 0x4f, /* Response length */
+			0x00, 0x4c, /* Attributes length */
+			0x35, 0x4a, 0x35, 0x48, 0x09, 0x00, 0x00, 0x0a, 0x00,
+			0x01, 0x00, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19,
+			0x12, 0x00, 0x09, 0x00, 0x05, 0x35, 0x03, 0x19, 0x10,
+			0x02, 0x09, 0x00, 0x09, 0x35, 0x08, 0x35, 0x06, 0x19,
+			0x12, 0x00, 0x09, 0x01, 0x03, 0x09, 0x02, 0x00, 0x09,
+			0x01, 0x03, 0x09, 0x02, 0x01, 0x09, 0x1d, 0x6b, 0x09,
+			0x02, 0x02, 0x09, 0x02, 0x46, 0x09, 0x02, 0x03, 0x09,
+			0x05, 0x0e, 0x09, 0x02, 0x04, 0x28, 0x01, 0x09, 0x02,
+			0x05, 0x09, 0x00, 0x02,
+			0x00 }; /* no continuation */
+
+static const uint8_t hid_rsp_pdu[] = { 0x07, /* PDU id */
+			0x00, 0x01, /* Transaction id */
+			0x01, 0x71, /* Response length */
+			0x01, 0x6E, /* Attributes length */
+			0x36, 0x01, 0x6b, 0x36, 0x01, 0x68, 0x09, 0x00, 0x00,
+			0x0a, 0x00, 0x01, 0x00, 0x00, 0x09, 0x00, 0x01, 0x35,
+			0x03, 0x19, 0x11, 0x24, 0x09, 0x00, 0x04, 0x35, 0x0d,
+			0x35, 0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x11, 0x35,
+			0x03, 0x19, 0x00, 0x11, 0x09, 0x00, 0x05, 0x35, 0x03,
+			0x19, 0x10, 0x02, 0x09, 0x00, 0x06, 0x35, 0x09, 0x09,
+			0x65, 0x6e, 0x09, 0x00, 0x6a, 0x09, 0x01, 0x00, 0x09,
+			0x00, 0x09, 0x35, 0x08, 0x35, 0x06, 0x19, 0x11, 0x24,
+			0x09, 0x01, 0x00, 0x09, 0x00, 0x0d, 0x35, 0x0f, 0x35,
+			0x0d, 0x35, 0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x13,
+			0x35, 0x03, 0x19, 0x00, 0x11, 0x09, 0x01, 0x00, 0x25,
+			0x1e, 0x4c, 0x6f, 0x67, 0x69, 0x74, 0x65, 0x63, 0x68,
+			0x20, 0x42, 0x6c, 0x75, 0x65, 0x74, 0x6f, 0x6f, 0x74,
+			0x68, 0x20, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x20, 0x4d,
+			0x35, 0x35, 0x35, 0x62, 0x09, 0x01, 0x01, 0x25, 0x0f,
+			0x42, 0x6c, 0x75, 0x65, 0x74, 0x6f, 0x6f, 0x74, 0x68,
+			0x20, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x09, 0x01, 0x02,
+			0x25, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x74, 0x65, 0x63,
+			0x68, 0x09, 0x02, 0x00, 0x09, 0x01, 0x00, 0x09, 0x02,
+			0x01, 0x09, 0x01, 0x11, 0x09, 0x02, 0x02, 0x08, 0x80,
+			0x09, 0x02, 0x03, 0x08, 0x21, 0x09, 0x02, 0x04, 0x28,
+			0x01, 0x09, 0x02, 0x05, 0x28, 0x01, 0x09, 0x02, 0x06,
+			0x35, 0x74, 0x35, 0x72, 0x08, 0x22, 0x25, 0x6e, 0x05,
+			0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01,
+			0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08, 0x15,
+			0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02,
+			0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x16, 0x01, 0xf8,
+			0x26, 0xff, 0x07, 0x75, 0x0c, 0x95, 0x02, 0x81, 0x06,
+			0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95,
+			0x01, 0x81, 0x06, 0x05, 0x0c, 0x0a, 0x38, 0x02, 0x81,
+			0x06, 0x05, 0x09, 0x19, 0x09, 0x29, 0x10, 0x15, 0x00,
+			0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0xc0,
+			0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85,
+			0x10, 0x75, 0x08, 0x95, 0x06, 0x15, 0x00, 0x26, 0xff,
+			0x00, 0x09, 0x01, 0x81, 0x00, 0x09, 0x01, 0x91, 0x00,
+			0xc0, 0x09, 0x02, 0x07, 0x35, 0x08, 0x35, 0x06, 0x09,
+			0x04, 0x09, 0x09, 0x01, 0x00, 0x09, 0x02, 0x08, 0x28,
+			0x00, 0x09, 0x02, 0x09, 0x28, 0x01, 0x09, 0x02, 0x0a,
+			0x28, 0x01, 0x09, 0x02, 0x0b, 0x09, 0x01, 0x00, 0x09,
+			0x02, 0x0c, 0x09, 0x0c, 0x80, 0x09, 0x02, 0x0d, 0x28,
+			0x00, 0x09, 0x02, 0x0e, 0x28, 0x01,
+			0x00 }; /* no continuation */
+
 static void hid_sdp_cid_hook_cb(const void *data, uint16_t len, void *user_data)
 {
 	struct test_data *t_data = tester_get_data();
 	struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
-	uint8_t pdu[] = { 0x07, /* PDU id */
-				0x00, 0x00, /* Transaction id */
-				0x01, 0x71, /* Response length */
-				0x01, 0x6E, /* Attributes length */
-				0x36, 0x01, 0x6b, 0x36, 0x01, 0x68, 0x09, 0x00,
-				0x00, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x09, 0x00,
-				0x01, 0x35, 0x03, 0x19, 0x11, 0x24, 0x09, 0x00,
-				0x04, 0x35, 0x0d, 0x35, 0x06, 0x19, 0x01, 0x00,
-				0x09, 0x00, 0x11, 0x35, 0x03, 0x19, 0x00, 0x11,
-				0x09, 0x00, 0x05, 0x35, 0x03, 0x19, 0x10, 0x02,
-				0x09, 0x00, 0x06, 0x35, 0x09, 0x09, 0x65, 0x6e,
-				0x09, 0x00, 0x6a, 0x09, 0x01, 0x00, 0x09, 0x00,
-				0x09, 0x35, 0x08, 0x35, 0x06, 0x19, 0x11, 0x24,
-				0x09, 0x01, 0x00, 0x09, 0x00, 0x0d, 0x35, 0x0f,
-				0x35, 0x0d, 0x35, 0x06, 0x19, 0x01, 0x00, 0x09,
-				0x00, 0x13, 0x35, 0x03, 0x19, 0x00, 0x11, 0x09,
-				0x01, 0x00, 0x25, 0x1e, 0x4c, 0x6f, 0x67, 0x69,
-				0x74, 0x65, 0x63, 0x68, 0x20, 0x42, 0x6c, 0x75,
-				0x65, 0x74, 0x6f, 0x6f, 0x74, 0x68, 0x20, 0x4d,
-				0x6f, 0x75, 0x73, 0x65, 0x20, 0x4d, 0x35, 0x35,
-				0x35, 0x62, 0x09, 0x01, 0x01, 0x25, 0x0f, 0x42,
-				0x6c, 0x75, 0x65, 0x74, 0x6f, 0x6f, 0x74, 0x68,
-				0x20, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x09, 0x01,
-				0x02, 0x25, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x74,
-				0x65, 0x63, 0x68, 0x09, 0x02, 0x00, 0x09, 0x01,
-				0x00, 0x09, 0x02, 0x01, 0x09, 0x01, 0x11, 0x09,
-				0x02, 0x02, 0x08, 0x80, 0x09, 0x02, 0x03, 0x08,
-				0x21, 0x09, 0x02, 0x04, 0x28, 0x01, 0x09, 0x02,
-				0x05, 0x28, 0x01, 0x09, 0x02, 0x06, 0x35, 0x74,
-				0x35, 0x72, 0x08, 0x22, 0x25, 0x6e, 0x05, 0x01,
-				0x09, 0x02, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x01,
-				0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x08,
-				0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08,
-				0x81, 0x02, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31,
-				0x16, 0x01, 0xf8, 0x26, 0xff, 0x07, 0x75, 0x0c,
-				0x95, 0x02, 0x81, 0x06, 0x09, 0x38, 0x15, 0x81,
-				0x25, 0x7f, 0x75, 0x08, 0x95, 0x01, 0x81, 0x06,
-				0x05, 0x0c, 0x0a, 0x38, 0x02, 0x81, 0x06, 0x05,
-				0x09, 0x19, 0x09, 0x29, 0x10, 0x15, 0x00, 0x25,
-				0x01, 0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0xc0,
-				0xc0, 0x06, 0x00, 0xff, 0x09, 0x01, 0xa1, 0x01,
-				0x85, 0x10, 0x75, 0x08, 0x95, 0x06, 0x15, 0x00,
-				0x26, 0xff, 0x00, 0x09, 0x01, 0x81, 0x00, 0x09,
-				0x01, 0x91, 0x00, 0xc0, 0x09, 0x02, 0x07, 0x35,
-				0x08, 0x35, 0x06, 0x09, 0x04, 0x09, 0x09, 0x01,
-				0x00, 0x09, 0x02, 0x08, 0x28, 0x00, 0x09, 0x02,
-				0x09, 0x28, 0x01, 0x09, 0x02, 0x0a, 0x28, 0x01,
-				0x09, 0x02, 0x0b, 0x09, 0x01, 0x00, 0x09, 0x02,
-				0x0c, 0x09, 0x0c, 0x80, 0x09, 0x02, 0x0d, 0x28,
-				0x00, 0x09, 0x02, 0x0e, 0x28, 0x01,
-				0x00 /* no continuation */};
+
+	if (!memcmp(did_req_pdu, data, len)) {
+		bthost_send_cid(bthost, t_data->sdp_handle, t_data->sdp_cid,
+					did_rsp_pdu, sizeof(did_rsp_pdu));
+		return;
+	}
 
 	bthost_send_cid(bthost, t_data->sdp_handle, t_data->sdp_cid,
-						(void *)pdu, sizeof(pdu));
+					hid_rsp_pdu, sizeof(hid_rsp_pdu));
 }
 
 static void hid_sdp_search_cb(uint16_t handle, uint16_t cid, void *user_data)