Skip to content

Commit

Permalink
Merge branch 'bugfix/l2cap_use_wrong_handle' into 'master'
Browse files Browse the repository at this point in the history
fix(bt/bluedroid):  Fixed the issue of using the wrong handle to handle the BTA_JV_L2CAP_READ_EVT event

Closes IDFGH-12886

See merge request espressif/esp-idf!31098
  • Loading branch information
wmy-espressif committed May 31, 2024
2 parents 53c0886 + a3d3b74 commit 809f1e3
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
fixed_queue_enqueue(slot->rx.queue, p_data_buf, FIXED_QUEUE_MAX_TIMEOUT);
} else {
osi_free(p_data_buf);
break;
}
}
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
Expand Down Expand Up @@ -945,12 +944,11 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
break; // to do disconnect
}
memset(p_data_buf, 0, count + sizeof(BT_HDR));
p_data_buf->len = BTA_JvL2capRead(p_data->data_ind.handle, slot->id, p_data_buf->data, count);
p_data_buf->len = BTA_JvL2capRead(p_data->l2c_read.handle, slot->id, p_data_buf->data, count);
if (p_data_buf->len > 0) {
fixed_queue_enqueue(slot->rx.queue, p_data_buf, FIXED_QUEUE_MAX_TIMEOUT);
} else {
osi_free(p_data_buf);
break;
}
}
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
Expand Down Expand Up @@ -1060,7 +1058,7 @@ static ssize_t l2cap_vfs_write(int fd, const void * data, size_t size)
if (!enqueue_status) {
BTC_TRACE_DEBUG("%s tx_len:%d, fd:%d\n", __func__, fixed_queue_length(slot->tx.queue), fd);
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
//block untill under water level, be closed or time out
//block until under water level, be closed or time out
tx_event_group_val =
xEventGroupWaitBits(l2cap_local_param.tx_event_group, SLOT_WRITE_BIT(serial) | SLOT_CLOSE_BIT(serial), pdTRUE,
pdFALSE, VFS_WRITE_TIMEOUT / portTICK_PERIOD_MS);
Expand Down

0 comments on commit 809f1e3

Please sign in to comment.