summaryrefslogtreecommitdiff
path: root/stack
diff options
context:
space:
mode:
authoralk3pInjection <webmaster@raspii.tech>2023-06-02 00:30:40 +0800
committeralk3pInjection <webmaster@raspii.tech>2023-06-02 00:30:40 +0800
commitb5b7ccf6def93ede838bf60345104b688f1d5632 (patch)
tree4eb12c4c287cf0369a782d94f3732ac6417fc21d /stack
parent810097b0cf3fbccb54027c408db59023f0bc13ed (diff)
parent913e85217c103e559d6d2c1a9528ef796744e57b (diff)
Merge tag 'LA.QSSI.13.0.r1-10200-qssi.0' into tachibanaHEADtachibana
"LA.QSSI.13.0.r1-10200-qssi.0" Change-Id: I4db0203d2218efb18f82aa939e00f946f7361b84
Diffstat (limited to 'stack')
-rw-r--r--stack/btm/btm_ble.cc7
-rw-r--r--stack/gatt/eatt_int.h1
-rw-r--r--stack/gatt/eatt_utils.cc29
-rw-r--r--stack/gatt/gatt_main.cc7
4 files changed, 42 insertions, 2 deletions
diff --git a/stack/btm/btm_ble.cc b/stack/btm/btm_ble.cc
index f2dc1adef..1c5b38dc8 100644
--- a/stack/btm/btm_ble.cc
+++ b/stack/btm/btm_ble.cc
@@ -1855,8 +1855,13 @@ void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) {
gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr);
/* Update EATT support */
- if (encr_enable)
+ if (encr_enable) {
gatt_update_eatt_support(p_dev_rec->ble.pseudo_addr);
+ tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE);
+ if (p_tcb && p_tcb->is_eatt_supported && !p_tcb->apps_needing_eatt.empty()) {
+ gatt_establish_eatt_connect(p_tcb, 1);
+ }
+ }
}
/*******************************************************************************
diff --git a/stack/gatt/eatt_int.h b/stack/gatt/eatt_int.h
index 593cbb9a9..99cf78384 100644
--- a/stack/gatt/eatt_int.h
+++ b/stack/gatt/eatt_int.h
@@ -79,5 +79,6 @@ extern void eatt_disc_rsp_enq(tGATT_TCB* p_tcb, uint16_t cid, BT_HDR *p_msg);
extern bool eatt_congest_notify_apps(tGATT_TCB* p_tcb, uint16_t cid, bool congested);
extern tGATT_EBCB* gatt_find_eatt_bcb_using_all_cids(uint16_t lcid);
extern void gatt_send_conn_cb_after_enc_failure(tGATT_TCB* p_tcb);
+extern void gatt_move_att_ops_from_eatt_bcb(tGATT_TCB* p_tcb);
#endif
diff --git a/stack/gatt/eatt_utils.cc b/stack/gatt/eatt_utils.cc
index 4a89c0b2f..919d615e9 100644
--- a/stack/gatt/eatt_utils.cc
+++ b/stack/gatt/eatt_utils.cc
@@ -1457,3 +1457,32 @@ void gatt_send_conn_cb_after_enc_failure(tGATT_TCB* p_tcb) {
}
}
}
+
+/*******************************************************************************
+ *
+ * Function gatt_move_att_ops_from_eatt_bcb
+ *
+ * Description The function moves ATT channel ops from EATT bcb to p_tcb
+ *
+ * Returns void
+ *
+ ******************************************************************************/
+void gatt_move_att_ops_from_eatt_bcb(tGATT_TCB* p_tcb) {
+ tGATT_EBCB* p_eatt_bcb = NULL;
+
+ VLOG(1) << __func__;
+ p_eatt_bcb = gatt_find_eatt_bcb_by_cid(p_tcb, L2CAP_ATT_CID);
+ if (!p_eatt_bcb) {
+ VLOG(1) << __func__ << " p_eatt_bcb not available for ATT CID: ";
+ return;
+ }
+
+ p_tcb->payload_size = p_eatt_bcb->payload_size;
+ p_tcb->ind_ack_timer = p_eatt_bcb->ind_ack_timer;
+ p_tcb->conf_timer = p_eatt_bcb->conf_timer;
+ p_tcb->cl_cmd_q = p_eatt_bcb->cl_cmd_q;
+ p_tcb->pending_ind_q = p_eatt_bcb->pending_ind_q;
+ p_tcb->indicate_handle = p_eatt_bcb->indicate_handle;
+ p_tcb->sr_cmd = p_eatt_bcb->sr_cmd;
+ p_tcb->sr_cmd.multi_rsp_q = p_eatt_bcb->sr_cmd.multi_rsp_q;
+}
diff --git a/stack/gatt/gatt_main.cc b/stack/gatt/gatt_main.cc
index 71880b787..0486f9404 100644
--- a/stack/gatt/gatt_main.cc
+++ b/stack/gatt/gatt_main.cc
@@ -1369,6 +1369,8 @@ static void gatt_l2cif_eatt_connect_cfm_cback(RawAddress &p_bd_addr,
gatt_eatt_bcb_in_progress_dealloc(p_bd_addr);
p_tcb->apps_needing_eatt.clear();
p_tcb->is_eatt_supported = false;
+ gatt_move_att_ops_from_eatt_bcb(p_tcb);
+ gatt_eatt_bcb_dealloc(p_tcb, L2CAP_ATT_CID);
gatt_send_conn_cb_after_enc_failure(p_tcb);
return;
@@ -1401,6 +1403,8 @@ static void gatt_l2cif_eatt_connect_cfm_cback(RawAddress &p_bd_addr,
if (gatt_num_eatt_bcbs(p_tcb) == 0) {
VLOG(1) << " First EATT conn attempt rejected, set eatt as not supported";
p_tcb->is_eatt_supported = false;
+ gatt_move_att_ops_from_eatt_bcb(p_tcb);
+ gatt_eatt_bcb_dealloc(p_tcb, L2CAP_ATT_CID);
}
}
@@ -1714,7 +1718,8 @@ void gatt_data_process(tGATT_TCB& tcb, uint16_t lcid, BT_HDR* p_buf) {
STREAM_TO_UINT8(op_code, p);
LOG(INFO) << __func__ << " op_code = " << +op_code
- << ", msg_len = " << +msg_len;
+ << ", msg_len = " << +msg_len
+ << ", lcid = " << +lcid;
/* remove the two MSBs associated with sign write and write cmd */
pseudo_op_code = op_code & (~GATT_WRITE_CMD_MASK);