mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 20:24:32 +02:00
Merge branch 'bugfix/leedarson_v3.3' into 'release/v3.3'
component_bt: Fix some code logic errors (v3.3) See merge request espressif/esp-idf!16041
This commit is contained in:
@@ -488,9 +488,14 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
|||||||
{
|
{
|
||||||
tBTA_GATTC_DATA gattc_data;
|
tBTA_GATTC_DATA gattc_data;
|
||||||
BOOLEAN found_app = FALSE;
|
BOOLEAN found_app = FALSE;
|
||||||
|
tGATT_TCB *p_tcb;
|
||||||
|
|
||||||
tGATT_TCB *p_tcb = gatt_find_tcb_by_addr(p_data->api_conn.remote_bda, BT_TRANSPORT_LE);
|
if (!p_clcb || !p_data) {
|
||||||
if(p_tcb && p_clcb && p_data) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_tcb = gatt_find_tcb_by_addr(p_data->api_conn.remote_bda, BT_TRANSPORT_LE);
|
||||||
|
if(p_tcb) {
|
||||||
found_app = gatt_find_specific_app_in_hold_link(p_tcb, p_clcb->p_rcb->client_if);
|
found_app = gatt_find_specific_app_in_hold_link(p_tcb, p_clcb->p_rcb->client_if);
|
||||||
}
|
}
|
||||||
/* open/hold a connection */
|
/* open/hold a connection */
|
||||||
|
@@ -759,7 +759,7 @@ void BTA_GATTC_PrepareWriteCharDescr (UINT16 conn_id, UINT16 handle,
|
|||||||
tBTA_GATT_AUTH_REQ auth_req)
|
tBTA_GATT_AUTH_REQ auth_req)
|
||||||
{
|
{
|
||||||
tBTA_GATTC_API_WRITE *p_buf;
|
tBTA_GATTC_API_WRITE *p_buf;
|
||||||
UINT16 len = sizeof(tBTA_GATTC_API_WRITE) + p_data->len;
|
UINT16 len = sizeof(tBTA_GATTC_API_WRITE);
|
||||||
|
|
||||||
if (p_data != NULL) {
|
if (p_data != NULL) {
|
||||||
len += p_data->len;
|
len += p_data->len;
|
||||||
|
@@ -391,6 +391,7 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = BT_STATUS_FAIL;
|
status = BT_STATUS_FAIL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||||
|
@@ -121,7 +121,7 @@ static void btc_gattc_copy_req_data(btc_msg_t *msg, void *p_dest, void *p_src)
|
|||||||
tBTA_GATTC *p_dest_data = (tBTA_GATTC *) p_dest;
|
tBTA_GATTC *p_dest_data = (tBTA_GATTC *) p_dest;
|
||||||
tBTA_GATTC *p_src_data = (tBTA_GATTC *) p_src;
|
tBTA_GATTC *p_src_data = (tBTA_GATTC *) p_src;
|
||||||
|
|
||||||
if (!p_src_data || !p_dest_data) {
|
if (!p_src_data || !p_dest_data || !msg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -249,11 +249,12 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
|
|||||||
{
|
{
|
||||||
uint8_t type, hdr_size;
|
uint8_t type, hdr_size;
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t *stream = packet->data + packet->offset;
|
uint8_t *stream = NULL;
|
||||||
|
|
||||||
if (!packet) {
|
if (!packet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
stream = packet->data + packet->offset;
|
||||||
|
|
||||||
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
|
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
|
||||||
hci_packet_complete(packet);
|
hci_packet_complete(packet);
|
||||||
|
@@ -827,6 +827,7 @@ BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr)
|
|||||||
tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
|
tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
|
||||||
{
|
{
|
||||||
tACL_CONN *p_acl = btm_bda_to_acl(bd_addr, BT_TRANSPORT_LE);
|
tACL_CONN *p_acl = btm_bda_to_acl(bd_addr, BT_TRANSPORT_LE);
|
||||||
|
|
||||||
BTM_TRACE_DEBUG("%s: tx_pdu_length =%d", __FUNCTION__, tx_pdu_length);
|
BTM_TRACE_DEBUG("%s: tx_pdu_length =%d", __FUNCTION__, tx_pdu_length);
|
||||||
|
|
||||||
if (!controller_get_interface()->supports_ble_packet_extension()) {
|
if (!controller_get_interface()->supports_ble_packet_extension()) {
|
||||||
@@ -834,12 +835,12 @@ tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length)
|
|||||||
return BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED;
|
return BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_acl != NULL) {
|
||||||
if (!HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl->peer_le_features)) {
|
if (!HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl->peer_le_features)) {
|
||||||
BTM_TRACE_ERROR("%s failed, peer does not support request", __FUNCTION__);
|
BTM_TRACE_ERROR("%s failed, peer does not support request", __FUNCTION__);
|
||||||
return BTM_PEER_LE_DATA_LEN_UNSUPPORTED;
|
return BTM_PEER_LE_DATA_LEN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_acl != NULL) {
|
|
||||||
if (tx_pdu_length > BTM_BLE_DATA_SIZE_MAX) {
|
if (tx_pdu_length > BTM_BLE_DATA_SIZE_MAX) {
|
||||||
tx_pdu_length = BTM_BLE_DATA_SIZE_MAX;
|
tx_pdu_length = BTM_BLE_DATA_SIZE_MAX;
|
||||||
} else if (tx_pdu_length < BTM_BLE_DATA_SIZE_MIN) {
|
} else if (tx_pdu_length < BTM_BLE_DATA_SIZE_MIN) {
|
||||||
|
@@ -1388,6 +1388,8 @@ tBTM_STATUS BTM_BleSetAdvParamsAll(UINT16 adv_int_min, UINT16 adv_int_max, UINT8
|
|||||||
|
|
||||||
if (p_dir_bda) {
|
if (p_dir_bda) {
|
||||||
memcpy(&p_cb->direct_bda, p_dir_bda, sizeof(tBLE_BD_ADDR));
|
memcpy(&p_cb->direct_bda, p_dir_bda, sizeof(tBLE_BD_ADDR));
|
||||||
|
} else {
|
||||||
|
return BTM_ILLEGAL_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BTM_TRACE_EVENT ("update params for an active adv\n");
|
BTM_TRACE_EVENT ("update params for an active adv\n");
|
||||||
@@ -1714,8 +1716,10 @@ tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type
|
|||||||
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb)
|
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb)
|
||||||
{
|
{
|
||||||
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
|
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
|
||||||
ble_cb->update_exceptional_list_cmp_cb = update_exceptional_list_cmp_cb;
|
|
||||||
tBTM_STATUS status = BTM_NO_RESOURCES;
|
tBTM_STATUS status = BTM_NO_RESOURCES;
|
||||||
|
|
||||||
|
ble_cb->update_exceptional_list_cmp_cb = update_exceptional_list_cmp_cb;
|
||||||
|
|
||||||
if (!controller_get_interface()->supports_ble()) {
|
if (!controller_get_interface()->supports_ble()) {
|
||||||
return BTM_ILLEGAL_VALUE;
|
return BTM_ILLEGAL_VALUE;
|
||||||
}
|
}
|
||||||
@@ -1750,9 +1754,6 @@ tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type
|
|||||||
//do nothing
|
//do nothing
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(status == BTM_ILLEGAL_VALUE) {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = BTM_VendorSpecificCommand(HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST, 1 + 4 + BD_ADDR_LEN, device_info_array, NULL);
|
status = BTM_VendorSpecificCommand(HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST, 1 + 4 + BD_ADDR_LEN, device_info_array, NULL);
|
||||||
if(status == BTM_CMD_STARTED) {
|
if(status == BTM_CMD_STARTED) {
|
||||||
|
@@ -1507,9 +1507,9 @@ void BTM_ConfirmReqReply(tBTM_STATUS res, BD_ADDR bd_addr)
|
|||||||
if (res == BTM_SUCCESS) {
|
if (res == BTM_SUCCESS) {
|
||||||
if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL) {
|
if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL) {
|
||||||
p_dev_rec->sec_flags |= BTM_SEC_LINK_KEY_AUTHED;
|
p_dev_rec->sec_flags |= BTM_SEC_LINK_KEY_AUTHED;
|
||||||
}
|
|
||||||
p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
|
p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
btsnd_hcic_user_conf_reply (bd_addr, TRUE);
|
btsnd_hcic_user_conf_reply (bd_addr, TRUE);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -814,15 +814,16 @@ tGATT_STATUS GATTC_ConfigureMTU (UINT16 conn_id)
|
|||||||
|
|
||||||
GATT_TRACE_API ("GATTC_ConfigureMTU conn_id=%d mtu=%d", conn_id, mtu );
|
GATT_TRACE_API ("GATTC_ConfigureMTU conn_id=%d mtu=%d", conn_id, mtu );
|
||||||
|
|
||||||
|
if ((p_tcb == NULL) || (p_reg == NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE)) {
|
||||||
|
return GATT_ILLEGAL_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Validate that the link is BLE, not BR/EDR */
|
/* Validate that the link is BLE, not BR/EDR */
|
||||||
if (p_tcb->transport != BT_TRANSPORT_LE) {
|
if (p_tcb->transport != BT_TRANSPORT_LE) {
|
||||||
return GATT_ERROR;
|
return GATT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (p_tcb == NULL) || (p_reg == NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE)) {
|
|
||||||
return GATT_ILLEGAL_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gatt_is_clcb_allocated(conn_id)) {
|
if (gatt_is_clcb_allocated(conn_id)) {
|
||||||
GATT_TRACE_ERROR("GATTC_ConfigureMTU GATT_BUSY conn_id = %d", conn_id);
|
GATT_TRACE_ERROR("GATTC_ConfigureMTU GATT_BUSY conn_id = %d", conn_id);
|
||||||
return GATT_BUSY;
|
return GATT_BUSY;
|
||||||
|
@@ -140,8 +140,8 @@ void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB *p_clcb, UINT8 sec_act)
|
void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB *p_clcb, UINT8 sec_act)
|
||||||
{
|
{
|
||||||
if (p_clcb && p_clcb->p_tcb &&
|
if (p_clcb && p_clcb->p_tcb) {
|
||||||
fixed_queue_is_empty(p_clcb->p_tcb->pending_enc_clcb)) {
|
if (fixed_queue_is_empty(p_clcb->p_tcb->pending_enc_clcb)) {
|
||||||
gatt_set_sec_act(p_clcb->p_tcb, GATT_SEC_NONE);
|
gatt_set_sec_act(p_clcb->p_tcb, GATT_SEC_NONE);
|
||||||
}
|
}
|
||||||
#if (GATTC_INCLUDED == TRUE)
|
#if (GATTC_INCLUDED == TRUE)
|
||||||
@@ -153,6 +153,7 @@ void gatt_sec_check_complete(BOOLEAN sec_check_ok, tGATT_CLCB *p_clcb, UINT8 s
|
|||||||
gatt_act_read(p_clcb, p_clcb->counter);
|
gatt_act_read(p_clcb, p_clcb->counter);
|
||||||
}
|
}
|
||||||
#endif ///GATTC_INCLUDED == TRUE
|
#endif ///GATTC_INCLUDED == TRUE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@@ -257,11 +257,6 @@
|
|||||||
#define L2CAP_EXTFEA_EXT_WINDOW 0x00000100 /* Extended Window Size */
|
#define L2CAP_EXTFEA_EXT_WINDOW 0x00000100 /* Extended Window Size */
|
||||||
#define L2CAP_EXTFEA_UCD_RECEPTION 0x00000200 /* Unicast Connectionless Data Reception */
|
#define L2CAP_EXTFEA_UCD_RECEPTION 0x00000200 /* Unicast Connectionless Data Reception */
|
||||||
|
|
||||||
/* Mask for locally supported features used in Information Response (default to none) */
|
|
||||||
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
|
|
||||||
#define L2CAP_EXTFEA_SUPPORTED_MASK 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Mask for LE supported features used in Information Response (default to none) */
|
/* Mask for LE supported features used in Information Response (default to none) */
|
||||||
#ifndef L2CAP_BLE_EXTFEA_MASK
|
#ifndef L2CAP_BLE_EXTFEA_MASK
|
||||||
#define L2CAP_BLE_EXTFEA_MASK 0
|
#define L2CAP_BLE_EXTFEA_MASK 0
|
||||||
|
@@ -1720,13 +1720,9 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda, tBLE_ADDR_TYPE
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_INCLUDED == TRUE
|
|
||||||
(*l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedConn_Cb)
|
(*l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedConn_Cb)
|
||||||
(fixed_cid, p_lcb->remote_bd_addr, TRUE, 0, p_lcb->transport);
|
(fixed_cid, p_lcb->remote_bd_addr, TRUE, 0, transport);
|
||||||
#else
|
|
||||||
(*l2cb.fixed_reg[fixed_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedConn_Cb)
|
|
||||||
(fixed_cid, p_lcb->remote_bd_addr, TRUE, 0, BT_TRANSPORT_BR_EDR);
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -937,8 +937,8 @@ void l2c_process_timeout (TIMER_LIST_ENT *p_tle)
|
|||||||
if (p_lcb){
|
if (p_lcb){
|
||||||
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PENDING;
|
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PENDING;
|
||||||
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PARAM_FULL;
|
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PARAM_FULL;
|
||||||
}
|
|
||||||
l2c_send_update_conn_params_cb(p_lcb, status);
|
l2c_send_update_conn_params_cb(p_lcb, status);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user