summaryrefslogtreecommitdiffstats
path: root/stack/btm
diff options
context:
space:
mode:
authorSrinu Jella <sjella@codeaurora.org>2013-12-18 11:57:33 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:22:03 -0600
commit08de637744f925731db794f1010e7fc3638ebd29 (patch)
tree9da657b52ce14865ef79aa78a8aab2d9be4eecca /stack/btm
parentb7a236472247276c8dcde5e5156394bac159a4fb (diff)
downloadandroid_system_bt-08de637744f925731db794f1010e7fc3638ebd29.tar.gz
android_system_bt-08de637744f925731db794f1010e7fc3638ebd29.tar.bz2
android_system_bt-08de637744f925731db794f1010e7fc3638ebd29.zip
Bluetooth: GAP: Serialize the commands during Pairing process
Serialize the Remote version, Remote features, Authentication requested commands. This will make sure the above commands doesn't go simultaneously to the remote device which can't handle the multiple comands at a time. Change-Id: I4448c291a60ee637dc5927806547e67f26571d86 CRs-Fixed: 896888
Diffstat (limited to 'stack/btm')
-rw-r--r--stack/btm/btm_acl.c47
-rw-r--r--stack/btm/btm_int.h2
-rw-r--r--stack/btm/btm_sec.c9
3 files changed, 31 insertions, 27 deletions
diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c
index 8e1872b0e..0ee70edbe 100644
--- a/stack/btm/btm_acl.c
+++ b/stack/btm/btm_acl.c
@@ -300,7 +300,6 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
/* if BR/EDR do something more */
if (transport == BT_TRANSPORT_BR_EDR)
{
- btsnd_hcic_read_rmt_clk_offset (p->hci_handle);
btsnd_hcic_rmt_ver_req (p->hci_handle);
}
p_dev_rec = btm_find_dev_by_handle (hci_handle);
@@ -357,11 +356,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
btm_establish_continue(p);
}
}
- else
#endif
- {
- btm_read_remote_features (p->hci_handle);
- }
/* read page 1 - on rmt feature event for buffer reasons */
return;
@@ -962,13 +957,14 @@ void btm_read_remote_version_complete (UINT8 *p)
STREAM_TO_UINT8 (p_acl_cb->lmp_version, p);
STREAM_TO_UINT16 (p_acl_cb->manufacturer, p);
STREAM_TO_UINT16 (p_acl_cb->lmp_subversion, p);
+ BTM_TRACE_DEBUG("Calling btm_read_remote_features");
+ btm_read_remote_features (p_acl_cb->hci_handle);
break;
}
}
}
}
-
/*******************************************************************************
**
** Function btm_process_remote_ext_features
@@ -984,6 +980,7 @@ void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read_pages)
UINT16 handle = p_acl_cb->hci_handle;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
UINT8 page_idx;
+ UINT8 status;
BTM_TRACE_DEBUG ("btm_process_remote_ext_features");
@@ -1009,6 +1006,12 @@ void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read_pages)
HCI_FEATURE_BYTES_PER_PAGE);
}
+ if (!(p_dev_rec->sec_flags & BTM_SEC_NAME_KNOWN) || p_dev_rec->is_originator)
+ {
+ BTM_TRACE_DEBUG ("Calling Next Security Procedure");
+ if ((status = btm_sec_execute_procedure (p_dev_rec)) != BTM_CMD_STARTED)
+ btm_sec_dev_rec_cback_event (p_dev_rec, status , FALSE);
+ }
const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
/* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
@@ -1255,24 +1258,28 @@ void btm_establish_continue (tACL_CONN *p_acl_cb)
BTM_SetLinkPolicy (p_acl_cb->remote_addr, &btm_cb.btm_def_link_policy);
}
#endif
- p_acl_cb->link_up_issued = TRUE;
-
- /* If anyone cares, tell him database changed */
- if (btm_cb.p_bl_changed_cb)
+ if(p_acl_cb->link_up_issued == FALSE)
{
- evt_data.event = BTM_BL_CONN_EVT;
- evt_data.conn.p_bda = p_acl_cb->remote_addr;
- evt_data.conn.p_bdn = p_acl_cb->remote_name;
- evt_data.conn.p_dc = p_acl_cb->remote_dc;
- evt_data.conn.p_features = p_acl_cb->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0];
+
+ p_acl_cb->link_up_issued = TRUE;
+
+ /* If anyone cares, tell him database changed */
+ if (btm_cb.p_bl_changed_cb)
+ {
+ evt_data.event = BTM_BL_CONN_EVT;
+ evt_data.conn.p_bda = p_acl_cb->remote_addr;
+ evt_data.conn.p_bdn = p_acl_cb->remote_name;
+ evt_data.conn.p_dc = p_acl_cb->remote_dc;
+ evt_data.conn.p_features = p_acl_cb->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0];
#if BLE_INCLUDED == TRUE
- evt_data.conn.handle = p_acl_cb->hci_handle;
- evt_data.conn.transport = p_acl_cb->transport;
+ evt_data.conn.handle = p_acl_cb->hci_handle;
+ evt_data.conn.transport = p_acl_cb->transport;
#endif
- (*btm_cb.p_bl_changed_cb)(&evt_data);
- }
- btm_acl_update_busy_level (BTM_BLI_ACL_UP_EVT);
+ (*btm_cb.p_bl_changed_cb)(&evt_data);
+ }
+ btm_acl_update_busy_level (BTM_BLI_ACL_UP_EVT);
+ }
}
diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h
index 721a43996..76d70dfb1 100644
--- a/stack/btm/btm_int.h
+++ b/stack/btm/btm_int.h
@@ -1076,6 +1076,8 @@ extern tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm,
extern tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
UINT32 mx_proto_id, UINT32 mx_chan_id,
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
+
+extern tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec);
extern void btm_sec_conn_req (UINT8 *bda, UINT8 *dc);
extern void btm_create_conn_cancel_complete (UINT8 *p);
extern void btm_read_linq_tx_power_complete (UINT8 *p);
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index 487c175cd..a7bb42f1f 100644
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -70,7 +70,7 @@ static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (UINT8 is_originator, UINT16 psm,
UINT32 mx_proto_id,
UINT32 mx_chan_id);
-static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec);
+
static BOOLEAN btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec);
static BOOLEAN btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec);
@@ -5023,11 +5023,6 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
/* the name, or if we are originator because some procedure can have */
/* been scheduled while connection was down */
BTM_TRACE_DEBUG ("is_originator:%d ", p_dev_rec->is_originator);
- if (!(p_dev_rec->sec_flags & BTM_SEC_NAME_KNOWN) || p_dev_rec->is_originator)
- {
- if ((res = btm_sec_execute_procedure (p_dev_rec)) != BTM_CMD_STARTED)
- btm_sec_dev_rec_cback_event (p_dev_rec, res, FALSE);
- }
return;
}
@@ -5712,7 +5707,7 @@ void btm_sec_update_clock_offset (UINT16 handle, UINT16 clock_offset)
** BTM_NO_RESOURCES - permission declined
**
*******************************************************************************/
-static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec)
+extern tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec)
{
BTM_TRACE_EVENT ("btm_sec_execute_procedure: Required:0x%x Flags:0x%x State:%d",
p_dev_rec->security_required, p_dev_rec->sec_flags, p_dev_rec->sec_state);