Loading system/stack/btm/btm_sec.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2789,7 +2789,7 @@ static tBTM_STATUS btm_sec_dd_create_conn(tBTM_SEC_DEV_REC* p_dev_rec) { /* set up the control block to indicated dedicated bonding */ btm_cb.pairing_flags |= BTM_PAIR_FLAGS_DISC_WHEN_DONE; if (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR)) { if (!l2cu_create_conn_br_edr(p_lcb)) { LOG(WARNING) << "Security Manager: failed create allocate LCB " << p_dev_rec->bd_addr; Loading system/stack/l2cap/l2c_api.cc +11 −7 Original line number Diff line number Diff line Loading @@ -321,7 +321,7 @@ uint16_t L2CA_ErtmConnectReq(uint16_t psm, const RawAddress& p_bd_addr, /* No link. Get an LCB and start link establishment */ p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_BR_EDR); /* currently use BR/EDR for ERTM mode l2cap connection */ if ((p_lcb == nullptr) || (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR))) { if ((p_lcb == nullptr) || (!l2cu_create_conn_br_edr(p_lcb))) { LOG(WARNING) << __func__ << ": connection not started for PSM=" << loghex(psm) << ", p_lcb=" << p_lcb; Loading Loading @@ -531,7 +531,7 @@ uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr, p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_LE); if ((p_lcb == NULL) /* currently use BR/EDR for ERTM mode l2cap connection */ || (!l2cu_create_conn(p_lcb, BT_TRANSPORT_LE))) { || (!l2cu_create_conn_le(p_lcb))) { L2CAP_TRACE_WARNING("%s conn not started for PSM: 0x%04x p_lcb: 0x%08x", __func__, psm, p_lcb); return 0; Loading Loading @@ -976,7 +976,7 @@ bool L2CA_Ping(const RawAddress& p_bd_addr, tL2CA_ECHO_RSP_CB* p_callback) { L2CAP_TRACE_WARNING("L2CAP - no LCB for L2CA_ping"); return (false); } if (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR)) { if (!l2cu_create_conn_br_edr(p_lcb)) { return (false); } Loading Loading @@ -1742,12 +1742,16 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda, return false; } if (!l2cu_create_conn(p_lcb, transport, initiating_phys)) { L2CAP_TRACE_WARNING("%s() - create_conn failed", __func__); bool ret = ((transport == BT_TRANSPORT_LE) ? l2cu_create_conn_le(p_lcb, initiating_phys) : l2cu_create_conn_br_edr(p_lcb)); if (!ret) { L2CAP_TRACE_WARNING("%s() - create connection failed", __func__); l2cu_release_lcb(p_lcb); return false; } return true; return ret; } /******************************************************************************* Loading system/stack/l2cap/l2c_int.h +3 −3 Original line number Diff line number Diff line Loading @@ -691,9 +691,9 @@ extern void l2cu_device_reset(void); extern tL2C_LCB* l2cu_find_lcb_by_state(tL2C_LINK_STATE state); extern bool l2cu_lcb_disconnecting(void); extern bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport); extern bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport, uint8_t initiating_phys); extern bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb); extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb); extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys); extern bool l2cu_create_conn_after_switch(tL2C_LCB* p_lcb); extern BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb, tL2C_TX_COMPLETE_CB_INFO* p_cbi); Loading system/stack/l2cap/l2c_link.cc +9 −4 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ bool l2c_link_hci_conn_comp(uint8_t status, uint16_t handle, * controller */ p_lcb->link_state = LST_CONNECTING; } else { l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR); l2cu_create_conn_br_edr(p_lcb); } } } Loading Loading @@ -446,9 +446,14 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) { } #endif } if (l2cu_create_conn(p_lcb, transport)) if (p_lcb->transport == BT_TRANSPORT_LE) { if (l2cu_create_conn_le(p_lcb)) lcb_is_free = false; /* still using this lcb */ } else { if (l2cu_create_conn_br_edr(p_lcb)) lcb_is_free = false; /* still using this lcb */ } } p_lcb->p_pending_ccb = NULL; Loading @@ -460,7 +465,7 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) { if (lcb_is_free && ((p_lcb = l2cu_find_lcb_by_state(LST_CONNECT_HOLDING)) != NULL)) { /* we found one-- create a connection */ l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR); l2cu_create_conn_br_edr(p_lcb); } return status; Loading system/stack/l2cap/l2c_utils.cc +20 −26 Original line number Diff line number Diff line Loading @@ -2110,34 +2110,19 @@ void l2cu_device_reset(void) { l2cb.is_ble_connecting = false; } /******************************************************************************* * * Function l2cu_create_conn * * Description This function initiates an acl connection via HCI * * Returns true if successful, false if get buffer fails. * ******************************************************************************/ bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport) { bool l2cu_create_conn_le(tL2C_LCB* p_lcb) { uint8_t phy = controller_get_interface()->get_le_all_initiating_phys(); return l2cu_create_conn(p_lcb, transport, phy); return l2cu_create_conn_le(p_lcb, phy); } bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport, uint8_t initiating_phys) { int xx; tL2C_LCB* p_lcb_cur = &l2cb.lcb_pool[0]; #if (BTM_SCO_INCLUDED == TRUE) bool is_sco_active; #endif /* This function initiates an acl connection to a LE device. * Returns true if request started successfully, false otherwise. */ bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys) { tBT_DEVICE_TYPE dev_type; tBLE_ADDR_TYPE addr_type; BTM_ReadDevInfo(p_lcb->remote_bd_addr, &dev_type, &addr_type); if (transport == BT_TRANSPORT_LE) { if (!controller_get_interface()->supports_ble()) return false; p_lcb->ble_addr_type = addr_type; Loading @@ -2147,6 +2132,15 @@ bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport, return (l2cble_create_conn(p_lcb)); } /* This function initiates an acl connection to a Classic device via HCI. * Returns true on success, false otherwise. */ bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) { int xx; tL2C_LCB* p_lcb_cur = &l2cb.lcb_pool[0]; #if (BTM_SCO_INCLUDED == TRUE) bool is_sco_active; #endif /* If there is a connection where we perform as a slave, try to switch roles for this connection */ for (xx = 0, p_lcb_cur = &l2cb.lcb_pool[0]; xx < MAX_L2CAP_LINKS; Loading Loading
system/stack/btm/btm_sec.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2789,7 +2789,7 @@ static tBTM_STATUS btm_sec_dd_create_conn(tBTM_SEC_DEV_REC* p_dev_rec) { /* set up the control block to indicated dedicated bonding */ btm_cb.pairing_flags |= BTM_PAIR_FLAGS_DISC_WHEN_DONE; if (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR)) { if (!l2cu_create_conn_br_edr(p_lcb)) { LOG(WARNING) << "Security Manager: failed create allocate LCB " << p_dev_rec->bd_addr; Loading
system/stack/l2cap/l2c_api.cc +11 −7 Original line number Diff line number Diff line Loading @@ -321,7 +321,7 @@ uint16_t L2CA_ErtmConnectReq(uint16_t psm, const RawAddress& p_bd_addr, /* No link. Get an LCB and start link establishment */ p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_BR_EDR); /* currently use BR/EDR for ERTM mode l2cap connection */ if ((p_lcb == nullptr) || (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR))) { if ((p_lcb == nullptr) || (!l2cu_create_conn_br_edr(p_lcb))) { LOG(WARNING) << __func__ << ": connection not started for PSM=" << loghex(psm) << ", p_lcb=" << p_lcb; Loading Loading @@ -531,7 +531,7 @@ uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr, p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_LE); if ((p_lcb == NULL) /* currently use BR/EDR for ERTM mode l2cap connection */ || (!l2cu_create_conn(p_lcb, BT_TRANSPORT_LE))) { || (!l2cu_create_conn_le(p_lcb))) { L2CAP_TRACE_WARNING("%s conn not started for PSM: 0x%04x p_lcb: 0x%08x", __func__, psm, p_lcb); return 0; Loading Loading @@ -976,7 +976,7 @@ bool L2CA_Ping(const RawAddress& p_bd_addr, tL2CA_ECHO_RSP_CB* p_callback) { L2CAP_TRACE_WARNING("L2CAP - no LCB for L2CA_ping"); return (false); } if (!l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR)) { if (!l2cu_create_conn_br_edr(p_lcb)) { return (false); } Loading Loading @@ -1742,12 +1742,16 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda, return false; } if (!l2cu_create_conn(p_lcb, transport, initiating_phys)) { L2CAP_TRACE_WARNING("%s() - create_conn failed", __func__); bool ret = ((transport == BT_TRANSPORT_LE) ? l2cu_create_conn_le(p_lcb, initiating_phys) : l2cu_create_conn_br_edr(p_lcb)); if (!ret) { L2CAP_TRACE_WARNING("%s() - create connection failed", __func__); l2cu_release_lcb(p_lcb); return false; } return true; return ret; } /******************************************************************************* Loading
system/stack/l2cap/l2c_int.h +3 −3 Original line number Diff line number Diff line Loading @@ -691,9 +691,9 @@ extern void l2cu_device_reset(void); extern tL2C_LCB* l2cu_find_lcb_by_state(tL2C_LINK_STATE state); extern bool l2cu_lcb_disconnecting(void); extern bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport); extern bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport, uint8_t initiating_phys); extern bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb); extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb); extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys); extern bool l2cu_create_conn_after_switch(tL2C_LCB* p_lcb); extern BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb, tL2C_TX_COMPLETE_CB_INFO* p_cbi); Loading
system/stack/l2cap/l2c_link.cc +9 −4 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ bool l2c_link_hci_conn_comp(uint8_t status, uint16_t handle, * controller */ p_lcb->link_state = LST_CONNECTING; } else { l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR); l2cu_create_conn_br_edr(p_lcb); } } } Loading Loading @@ -446,9 +446,14 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) { } #endif } if (l2cu_create_conn(p_lcb, transport)) if (p_lcb->transport == BT_TRANSPORT_LE) { if (l2cu_create_conn_le(p_lcb)) lcb_is_free = false; /* still using this lcb */ } else { if (l2cu_create_conn_br_edr(p_lcb)) lcb_is_free = false; /* still using this lcb */ } } p_lcb->p_pending_ccb = NULL; Loading @@ -460,7 +465,7 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) { if (lcb_is_free && ((p_lcb = l2cu_find_lcb_by_state(LST_CONNECT_HOLDING)) != NULL)) { /* we found one-- create a connection */ l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR); l2cu_create_conn_br_edr(p_lcb); } return status; Loading
system/stack/l2cap/l2c_utils.cc +20 −26 Original line number Diff line number Diff line Loading @@ -2110,34 +2110,19 @@ void l2cu_device_reset(void) { l2cb.is_ble_connecting = false; } /******************************************************************************* * * Function l2cu_create_conn * * Description This function initiates an acl connection via HCI * * Returns true if successful, false if get buffer fails. * ******************************************************************************/ bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport) { bool l2cu_create_conn_le(tL2C_LCB* p_lcb) { uint8_t phy = controller_get_interface()->get_le_all_initiating_phys(); return l2cu_create_conn(p_lcb, transport, phy); return l2cu_create_conn_le(p_lcb, phy); } bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport, uint8_t initiating_phys) { int xx; tL2C_LCB* p_lcb_cur = &l2cb.lcb_pool[0]; #if (BTM_SCO_INCLUDED == TRUE) bool is_sco_active; #endif /* This function initiates an acl connection to a LE device. * Returns true if request started successfully, false otherwise. */ bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys) { tBT_DEVICE_TYPE dev_type; tBLE_ADDR_TYPE addr_type; BTM_ReadDevInfo(p_lcb->remote_bd_addr, &dev_type, &addr_type); if (transport == BT_TRANSPORT_LE) { if (!controller_get_interface()->supports_ble()) return false; p_lcb->ble_addr_type = addr_type; Loading @@ -2147,6 +2132,15 @@ bool l2cu_create_conn(tL2C_LCB* p_lcb, tBT_TRANSPORT transport, return (l2cble_create_conn(p_lcb)); } /* This function initiates an acl connection to a Classic device via HCI. * Returns true on success, false otherwise. */ bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) { int xx; tL2C_LCB* p_lcb_cur = &l2cb.lcb_pool[0]; #if (BTM_SCO_INCLUDED == TRUE) bool is_sco_active; #endif /* If there is a connection where we perform as a slave, try to switch roles for this connection */ for (xx = 0, p_lcb_cur = &l2cb.lcb_pool[0]; xx < MAX_L2CAP_LINKS; Loading