From bc95df786e2192ef45500f0ef31a2d057a19f831 Mon Sep 17 00:00:00 2001 From: Ravi Nagarajan Date: Tue, 12 Jun 2012 15:04:47 +0530 Subject: Handle service discovery failure For HID connection, hid and sdp connections could be attempted at the same time. Some devices, that are short on resources, do not handle this well, and reject our SDP L2CAP connection. SDP discovery failure was not handled, leading to GKI exception. This has been resolved Change-Id: Ib49d66c62a2d05a83b44b733d3c9c4259b5d4c6f --- btif/src/btif_dm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'btif') diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c index 5e81480..a655364 100755 --- a/btif/src/btif_dm.c +++ b/btif/src/btif_dm.c @@ -513,10 +513,13 @@ static void search_services_copy_cb(UINT16 event, char *p_dest, char *p_src) { case BTA_DM_DISC_RES_EVT: { - if (p_src_data->disc_res.num_uuids > 0) + if ((p_src_data->disc_res.result == BTA_SUCCESS) && + (p_src_data->disc_res.num_uuids > 0)) + { p_dest_data->disc_res.p_uuid_list = (UINT8*)(p_dest + sizeof(tBTA_DM_SEARCH)); memcpy(p_dest_data->disc_res.p_uuid_list, p_src_data->disc_res.p_uuid_list, - p_src_data->disc_res.num_uuids*MAX_UUID_SIZE); + p_src_data->disc_res.num_uuids*MAX_UUID_SIZE); + } } break; } } @@ -986,7 +989,7 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param) p_data->disc_res.result, p_data->disc_res.services); prop.type = BT_PROPERTY_UUIDS; prop.len = 0; - if (p_data->disc_res.num_uuids > 0) + if ((p_data->disc_res.result == BTA_SUCCESS) && (p_data->disc_res.num_uuids > 0)) { prop.val = p_data->disc_res.p_uuid_list; prop.len = p_data->disc_res.num_uuids * MAX_UUID_SIZE; @@ -1391,7 +1394,7 @@ static void bte_dm_search_services_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH { case BTA_DM_DISC_RES_EVT: { - if (p_data->disc_res.num_uuids > 0) { + if ((p_data->disc_res.result == BTA_SUCCESS) && (p_data->disc_res.num_uuids > 0)) { param_len += (p_data->disc_res.num_uuids * MAX_UUID_SIZE); } } break; -- cgit v1.1