Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99d92c3d authored by Chris Manton's avatar Chris Manton
Browse files

Use return condition to stack/l2cap/l2c_ble::l2cble_conn_comp

Also pull in flow execution from l2c back to btm

Bug: 170396407
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink

Change-Id: Ic8aa743376ca7f8a9f0b868dad4a59437af69847
parent 7ed9f6ae
Loading
Loading
Loading
Loading
+13 −2
Original line number Original line Diff line number Diff line
@@ -51,8 +51,19 @@ static bool acl_ble_common_connection(const tBLE_BD_ADDR& address_with_type,
  btm_ble_increment_link_topology_mask(role);
  btm_ble_increment_link_topology_mask(role);


  // Inform l2cap of a potential connection.
  // Inform l2cap of a potential connection.
  l2cble_conn_comp(handle, role, address_with_type.bda, address_with_type.type,
  if (!l2cble_conn_comp(handle, role, address_with_type.bda,
                   conn_interval, conn_latency, conn_timeout);
                        address_with_type.type, conn_interval, conn_latency,
                        conn_timeout)) {
    btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
    LOG_WARN("Unable to complete l2cap connection");
    return false;
  }

  btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true);

  /* Tell BTM Acl management about the link */
  btm_acl_created(address_with_type.bda, handle, role, BT_TRANSPORT_LE);

  return true;
  return true;
}
}


+0 −7
Original line number Original line Diff line number Diff line
@@ -279,12 +279,10 @@ bool l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
  if (!p_lcb) {
  if (!p_lcb) {
    p_lcb = l2cu_allocate_lcb(bda, false, BT_TRANSPORT_LE);
    p_lcb = l2cu_allocate_lcb(bda, false, BT_TRANSPORT_LE);
    if (!p_lcb) {
    if (!p_lcb) {
      btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
      LOG_ERROR("Unable to allocate link resource for le acl connection");
      LOG_ERROR("Unable to allocate link resource for le acl connection");
      return false;
      return false;
    } else {
    } else {
      if (!l2cu_initialize_fixed_ccb(p_lcb, L2CAP_ATT_CID)) {
      if (!l2cu_initialize_fixed_ccb(p_lcb, L2CAP_ATT_CID)) {
        btm_sec_disconnect(handle, HCI_ERR_NO_CONNECTION);
        LOG_ERROR("Unable to allocate channel resource for le acl connection");
        LOG_ERROR("Unable to allocate channel resource for le acl connection");
        return false;
        return false;
      }
      }
@@ -317,15 +315,10 @@ bool l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
  p_lcb->latency = conn_latency;
  p_lcb->latency = conn_latency;
  p_lcb->conn_update_mask = L2C_BLE_NOT_DEFAULT_PARAM;
  p_lcb->conn_update_mask = L2C_BLE_NOT_DEFAULT_PARAM;


  /* Tell BTM Acl management about the link */
  btm_acl_created(bda, handle, p_lcb->LinkRole(), BT_TRANSPORT_LE);

  p_lcb->peer_chnl_mask[0] = L2CAP_FIXED_CHNL_ATT_BIT |
  p_lcb->peer_chnl_mask[0] = L2CAP_FIXED_CHNL_ATT_BIT |
                             L2CAP_FIXED_CHNL_BLE_SIG_BIT |
                             L2CAP_FIXED_CHNL_BLE_SIG_BIT |
                             L2CAP_FIXED_CHNL_SMP_BIT;
                             L2CAP_FIXED_CHNL_SMP_BIT;


  btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true);

  if (role == HCI_ROLE_SLAVE) {
  if (role == HCI_ROLE_SLAVE) {
    if (!controller_get_interface()
    if (!controller_get_interface()
             ->supports_ble_peripheral_initiated_feature_exchange()) {
             ->supports_ble_peripheral_initiated_feature_exchange()) {