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

Commit c105be2e authored by Zach Johnson's avatar Zach Johnson
Browse files

L2CA_SetDesireRole literally changes nothing

it's always called with "master", and desire_role is always master to
begin with

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ied49ba1d44a368df485685b65586d8ec590dd32b
parent d6c80f29
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -2872,28 +2872,13 @@ static void bta_dm_remove_sec_dev_entry(const RawAddress& remote_bd_addr) {
 ******************************************************************************/
static void bta_dm_adjust_roles(bool delay_role_switch) {
  uint8_t i;
  bool set_master_role = false;
  uint8_t br_count =
      bta_dm_cb.device_list.count - bta_dm_cb.device_list.le_count;
  if (br_count) {
    /* the configuration is no scatternet
     * or AV connection exists and there are more than one ACL link */
    if ((p_bta_dm_rm_cfg[0].cfg == BTA_DM_NO_SCATTERNET) ||
        (bta_dm_cb.cur_av_count && br_count > 1)) {
      L2CA_SetDesireRole(HCI_ROLE_MASTER);
      set_master_role = true;
    }

    for (i = 0; i < bta_dm_cb.device_list.count; i++) {
      if (bta_dm_cb.device_list.peer_device[i].conn_state == BTA_DM_CONNECTED &&
          bta_dm_cb.device_list.peer_device[i].transport ==
              BT_TRANSPORT_BR_EDR) {
        if (!set_master_role &&
            (bta_dm_cb.device_list.peer_device[i].pref_role != BTA_ANY_ROLE) &&
            (p_bta_dm_rm_cfg[0].cfg == BTA_DM_PARTIAL_SCATTERNET)) {
          L2CA_SetDesireRole(HCI_ROLE_MASTER);
          set_master_role = true;
        }

        if ((bta_dm_cb.device_list.peer_device[i].pref_role ==
             BTA_MASTER_ROLE_ONLY) ||
@@ -2920,13 +2905,6 @@ static void bta_dm_adjust_roles(bool delay_role_switch) {
        }
      }
    }

    if (!set_master_role) {
      L2CA_SetDesireRole(HCI_ROLE_MASTER);
    }

  } else {
    L2CA_SetDesireRole(HCI_ROLE_MASTER);
  }
}

+0 −8
Original line number Diff line number Diff line
@@ -194,14 +194,6 @@ uint8_t bluetooth::shim::L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
  return write_success ? L2CAP_DW_SUCCESS : L2CAP_DW_FAILED;
}

/**
 * L2cap Layer APIs
 */
uint8_t bluetooth::shim::L2CA_SetDesireRole(uint8_t new_role) {
  LOG_INFO("UNIMPLEMENTED %s", __func__);
  return 0;
}

/**
 * Link APIs
 */
+0 −19
Original line number Diff line number Diff line
@@ -344,25 +344,6 @@ bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
 ******************************************************************************/
uint8_t L2CA_SetTraceLevel(uint8_t trace_level);

/*******************************************************************************
 *
 * Function     L2CA_SetDesireRole
 *
 * Description  This function sets the desire role for L2CAP.
 *              If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
 *              HciCreateConnection.
 *              If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow
 *              switch on HciCreateConnection.
 *
 *              If the new role is a valid role (HCI_ROLE_MASTER or
 *              HCI_ROLE_SLAVE), the desire role is set to the new value.
 *              Otherwise, it is not changed.
 *
 * Returns      the new (current) role
 *
 ******************************************************************************/
uint8_t L2CA_SetDesireRole(uint8_t new_role);

/*******************************************************************************
 *
 * Function     L2CA_FlushChannel
+0 −15
Original line number Diff line number Diff line
@@ -626,21 +626,6 @@ extern bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr,
 ******************************************************************************/
extern uint8_t L2CA_SetTraceLevel(uint8_t trace_level);

/*******************************************************************************
 *
 * Function     L2CA_SetDesireRole
 *
 * Description  This function sets the desire role for L2CAP.
 *
 *              If the new role is a valid role (HCI_ROLE_MASTER or
 *              HCI_ROLE_SLAVE), the desire role is set to the new value.
 *              Otherwise, it is not changed.
 *
 * Returns      the new (current) role
 *
 ******************************************************************************/
extern uint8_t L2CA_SetDesireRole(uint8_t new_role);

/*******************************************************************************
 *
 * Function     L2CA_FlushChannel
+0 −25
Original line number Diff line number Diff line
@@ -1124,31 +1124,6 @@ uint8_t L2CA_SetTraceLevel(uint8_t new_level) {
  return (l2cb.l2cap_trace_level);
}

/*******************************************************************************
 *
 * Function     L2CA_SetDesireRole
 *
 * Description  This function sets the desire role for L2CAP.
 *
 *              If the new role is a valid role (HCI_ROLE_MASTER or
 *              HCI_ROLE_SLAVE), the desire role is set to the new value.
 *              Otherwise, it is not changed.
 *
 * Returns      the new (current) role
 *
 ******************************************************************************/
uint8_t L2CA_SetDesireRole(uint8_t new_role) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::L2CA_SetDesireRole(new_role);
  }

  L2CAP_TRACE_API("L2CA_SetDesireRole() new:x%x", new_role);

  l2cb.desire_role = new_role;

  return (l2cb.desire_role);
}

/*******************************************************************************
 *
 * Function         L2CA_SetAclPriority