Merge branch 'bugfix/ble_fix_bluedroid6.0_bug_from_7.1' into 'master'

compoent/bt:Fixed the BT/BLE statck bug from bluedroid7.1.1

The bluedroid 7.1.1 has fixed some bug, synchronize to our SDK now.

See merge request !719
This commit is contained in:
Jiang Jiang Jian 2017-05-02 19:38:50 +08:00
commit 1cef8d8ac1
7 changed files with 47 additions and 9 deletions

View file

@ -3414,6 +3414,7 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
BTM_IsAclConnectionUp(remote_bd_addr, BT_TRANSPORT_BR_EDR)) { BTM_IsAclConnectionUp(remote_bd_addr, BT_TRANSPORT_BR_EDR)) {
APPL_TRACE_DEBUG("%s ACL is not down. Schedule for Dev Removal when ACL closes", APPL_TRACE_DEBUG("%s ACL is not down. Schedule for Dev Removal when ACL closes",
__FUNCTION__); __FUNCTION__);
BTM_SecClearSecurityFlags (remote_bd_addr);
for (index = 0; index < bta_dm_cb.device_list.count; index ++) { for (index = 0; index < bta_dm_cb.device_list.count; index ++) {
if (!bdcmp( bta_dm_cb.device_list.peer_device[index].peer_bdaddr, remote_bd_addr)) { if (!bdcmp( bta_dm_cb.device_list.peer_device[index].peer_bdaddr, remote_bd_addr)) {
break; break;

View file

@ -32,6 +32,7 @@
#include "bta_gattc_int.h" #include "bta_gattc_int.h"
#include "l2c_api.h" #include "l2c_api.h"
#include "l2c_int.h"
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE) #if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
#include "bta_hh_int.h" #include "bta_hh_int.h"
@ -978,8 +979,11 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
/* get any queued command to proceed */ /* get any queued command to proceed */
else if (p_q_cmd != NULL) { else if (p_q_cmd != NULL) {
p_clcb->p_q_cmd = NULL; p_clcb->p_q_cmd = NULL;
/* execute pending operation of link block still present */
if (l2cu_find_lcb_by_bd_addr(p_clcb->p_srcb->server_bda,
BT_TRANSPORT_LE) != NULL) {
bta_gattc_sm_execute(p_clcb, p_q_cmd->hdr.event, p_q_cmd); bta_gattc_sm_execute(p_clcb, p_q_cmd->hdr.event, p_q_cmd);
}
/* if the command executed requeued the cmd, we don't /* if the command executed requeued the cmd, we don't
* want to free the underlying buffer that's being * want to free the underlying buffer that's being
* referenced by p_clcb->p_q_cmd * referenced by p_clcb->p_q_cmd

View file

@ -144,10 +144,6 @@ int bte_main_boot_entry(bluedroid_init_done_cb_t cb)
//data_dispatcher_register_default(hci->event_dispatcher, btu_hci_msg_queue); //data_dispatcher_register_default(hci->event_dispatcher, btu_hci_msg_queue);
hci->set_data_queue(btu_hci_msg_queue); hci->set_data_queue(btu_hci_msg_queue);
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
//bte_load_ble_conf(BTE_BLE_STACK_CONF_FILE);
#endif
//Enbale HCI //Enbale HCI
bte_main_enable(); bte_main_enable();

View file

@ -196,6 +196,26 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr)
return TRUE; return TRUE;
} }
/*******************************************************************************
**
** Function BTM_SecClearSecurityFlags
**
** Description Reset the security flags (mark as not-paired) for a given
** remove device.
**
*******************************************************************************/
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
if (p_dev_rec == NULL)
return;
p_dev_rec->sec_flags = 0;
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
p_dev_rec->sm4 = BTM_SM4_UNKNOWN;
}
/******************************************************************************* /*******************************************************************************
** **
** Function BTM_SecReadDevName ** Function BTM_SecReadDevName

View file

@ -1183,6 +1183,11 @@ void gatt_attr_process_prepare_write (tGATT_TCB *p_tcb, UINT8 i_rcb, UINT16 hand
tGATT_PREPARE_WRITE_RECORD *prepare_record = NULL; tGATT_PREPARE_WRITE_RECORD *prepare_record = NULL;
memset(&sr_data, 0, sizeof(tGATTS_DATA)); memset(&sr_data, 0, sizeof(tGATTS_DATA));
if (len < 2) {
GATT_TRACE_ERROR("%s: Prepare write request was invalid - missing offset, sending error response", __func__);
gatt_send_error_rsp(p_tcb, GATT_INVALID_PDU, op_code, handle, FALSE);
return;
}
//get offset from p_data //get offset from p_data
STREAM_TO_UINT16(offset, p); STREAM_TO_UINT16(offset, p);
len -= 2; len -= 2;

View file

@ -3691,6 +3691,17 @@ UINT8 *BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len);
//extern //extern
char *BTM_SecReadDevName (BD_ADDR bd_addr); char *BTM_SecReadDevName (BD_ADDR bd_addr);
/*******************************************************************************
**
** Function BTM_SecClearSecurityFlags
**
** Description Reset the security flags (mark as not-paired) for a given
** remove device.
**
*******************************************************************************/
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr);
/***************************************************************************** /*****************************************************************************
** POWER MANAGEMENT FUNCTIONS ** POWER MANAGEMENT FUNCTIONS

View file

@ -1362,8 +1362,6 @@ void smp_br_send_pair_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_pairing_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) void smp_pairing_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{ {
if (p_cb->total_tx_unacked == 0) { if (p_cb->total_tx_unacked == 0) {
/* update connection parameter to remote preferred */
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
/* process the pairing complete */ /* process the pairing complete */
smp_proc_pairing_cmpl(p_cb); smp_proc_pairing_cmpl(p_cb);
} }
@ -1401,7 +1399,10 @@ void smp_idle_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/ *******************************************************************************/
void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{ {
/* disable connection parameter update */ /* Disable L2CAP connection parameter updates while bonding since
some peripherals are not able to revert to fast connection parameters
during the start of service discovery. Connection paramter updates
get enabled again once service discovery completes. */
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE); L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
} }