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

Commit 156866ef authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "bt-remote-features" into tm-dev

* changes:
  Remove unused entry into l2cap
  Remove unused btm_read_remote_version_complete_raw
  Remove legacy HCI_READ_RMT_FEATURES_COMP_EVT
parents 92db446a e94f3e08
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -145,8 +145,7 @@ void acl_ble_enhanced_connection_complete_from_shim(

  // The legacy stack continues the LE connection after the read remote version
  // complete has been received.
  l2cble_notify_le_connection(address_with_type.bda);
  l2cble_use_preferred_conn_params(address_with_type.bda);
  // maybe_chain_more_commands_after_read_remote_version_complete
}

void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
+0 −80
Original line number Diff line number Diff line
@@ -91,7 +91,6 @@ struct StackAclBtmAcl {
  bool change_connection_packet_types(tACL_CONN& link,
                                      const uint16_t new_packet_type_bitmask);
  void btm_establish_continue(tACL_CONN* p_acl_cb);
  void btm_read_remote_features(uint16_t handle);
  void btm_set_default_link_policy(tLINK_POLICY settings);
  void btm_acl_role_changed(tHCI_STATUS hci_status, const RawAddress& bd_addr,
                            tHCI_ROLE new_role);
@@ -834,24 +833,6 @@ void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
  }
}

void btm_read_remote_version_complete_raw(uint8_t* p) {
  uint8_t status;
  uint16_t handle;
  uint8_t lmp_version;
  uint16_t manufacturer;
  uint16_t lmp_subversion;

  STREAM_TO_UINT8(status, p);
  STREAM_TO_UINT16(handle, p);
  STREAM_TO_UINT8(lmp_version, p);
  STREAM_TO_UINT16(manufacturer, p);
  STREAM_TO_UINT16(lmp_subversion, p);

  ASSERT_LOG(false, "gd acl layer should be receiving this completion");
  btm_read_remote_version_complete(static_cast<tHCI_STATUS>(status), handle,
                                   lmp_version, manufacturer, lmp_version);
}

void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle,
                                      uint8_t lmp_version,
                                      uint16_t manufacturer,
@@ -896,40 +877,6 @@ void btm_process_remote_ext_features(tACL_CONN* p_acl_cb,
                            br_edr_supported, le_supported);
}

/*******************************************************************************
 *
 * Function         btm_read_remote_features
 *
 * Description      Local function called to send a read remote supported
 *                  features/remote extended features page[0].
 *
 * Returns          void
 *
 ******************************************************************************/
void StackAclBtmAcl::btm_read_remote_features(uint16_t handle) {
  uint8_t acl_idx;
  tACL_CONN* p_acl_cb;

  acl_idx = btm_handle_to_acl_index(handle);
  if (acl_idx >= MAX_L2CAP_LINKS) {
    LOG_WARN("Unable to find active acl");
    return;
  }

  p_acl_cb = &btm_cb.acl_cb_.acl_db[acl_idx];
  memset(p_acl_cb->peer_lmp_feature_pages, 0,
         sizeof(p_acl_cb->peer_lmp_feature_pages));

  /* first send read remote supported features HCI command */
  /* because we don't know whether the remote support extended feature command
   */
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    // GD L2cap reads this automatically
    return;
  }
  btsnd_hcic_rmt_features_req(handle);
}

/*******************************************************************************
 *
 * Function         btm_read_remote_ext_features
@@ -948,33 +895,6 @@ void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number) {
  btsnd_hcic_rmt_ext_features(handle, page_number);
}

/*******************************************************************************
 *
 * Function         btm_read_remote_features_complete
 *
 * Description      This function is called when the remote supported features
 *                  complete event is received from the HCI.
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_read_remote_features_complete_raw(uint8_t* p) {
  uint8_t status;
  uint16_t handle;

  STREAM_TO_UINT8(status, p);

  if (status != HCI_SUCCESS) {
    LOG_WARN("Uanble to read remote features status:%s",
             hci_error_code_text(static_cast<tHCI_STATUS>(status)).c_str());
    return;
  }

  STREAM_TO_UINT16(handle, p);

  btm_read_remote_features_complete(handle, p);
}

void btm_read_remote_features_complete(uint16_t handle, uint8_t* features) {
  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
  if (p_acl_cb == nullptr) {
+2 −6
Original line number Diff line number Diff line
@@ -265,15 +265,9 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id,
    case HCI_ENCRYPTION_KEY_REFRESH_COMP_EVT:
      btu_hcif_encryption_key_refresh_cmpl_evt(p);
      break;
    case HCI_READ_RMT_FEATURES_COMP_EVT:
      btm_read_remote_features_complete_raw(p);
      break;
    case HCI_READ_RMT_EXT_FEATURES_COMP_EVT:
      btu_hcif_read_rmt_ext_features_comp_evt(p, hci_evt_len);
      break;
    case HCI_READ_RMT_VERSION_COMP_EVT:
      btm_read_remote_version_complete_raw(p);
      break;
    case HCI_COMMAND_COMPLETE_EVT:
      LOG_ERROR(
          "%s should not have received a command complete event. "
@@ -434,6 +428,8 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id,

      // Events now captured by gd::hci_layer module
    case HCI_CONNECTION_COMP_EVT:  // EventCode::CONNECTION_COMPLETE
    case HCI_READ_RMT_FEATURES_COMP_EVT:  // EventCode::READ_REMOTE_SUPPORTED_FEATURES_COMPLETE
    case HCI_READ_RMT_VERSION_COMP_EVT:  // EventCode::READ_REMOTE_VERSION_INFORMATION_COMPLETE
    default:
      LOG_ERROR(
          "Unexpectedly received event_code:0x%02x that should not be "
+0 −2
Original line number Diff line number Diff line
@@ -57,9 +57,7 @@ void btm_read_remote_ext_features_complete_raw(uint8_t* p, uint8_t evt_len);
void btm_read_remote_ext_features_complete(uint16_t handle, uint8_t page_num,
                                           uint8_t max_page, uint8_t* features);
void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle);
void btm_read_remote_features_complete_raw(uint8_t* p);
void btm_read_remote_features_complete(uint16_t handle, uint8_t* features);
void btm_read_remote_version_complete_raw(uint8_t* p);
void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle,
                                      uint8_t lmp_version,
                                      uint16_t manufacturer,
+0 −12
Original line number Diff line number Diff line
@@ -160,11 +160,7 @@ struct btm_read_remote_ext_features_complete_raw
    btm_read_remote_ext_features_complete_raw;
struct btm_read_remote_ext_features_failed btm_read_remote_ext_features_failed;
struct btm_read_remote_features_complete btm_read_remote_features_complete;
struct btm_read_remote_features_complete_raw
    btm_read_remote_features_complete_raw;
struct btm_read_remote_version_complete btm_read_remote_version_complete;
struct btm_read_remote_version_complete_raw
    btm_read_remote_version_complete_raw;
struct btm_read_rssi_complete btm_read_rssi_complete;
struct btm_read_rssi_timeout btm_read_rssi_timeout;
struct btm_read_tx_power_complete btm_read_tx_power_complete;
@@ -661,10 +657,6 @@ void btm_read_remote_features_complete(uint16_t handle, uint8_t* features) {
  mock_function_count_map[__func__]++;
  test::mock::stack_acl::btm_read_remote_features_complete(handle, features);
}
void btm_read_remote_features_complete_raw(uint8_t* p) {
  mock_function_count_map[__func__]++;
  test::mock::stack_acl::btm_read_remote_features_complete_raw(p);
}
void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle,
                                      uint8_t lmp_version,
                                      uint16_t manufacturer,
@@ -673,10 +665,6 @@ void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle,
  test::mock::stack_acl::btm_read_remote_version_complete(
      status, handle, lmp_version, manufacturer, lmp_subversion);
}
void btm_read_remote_version_complete_raw(uint8_t* p) {
  mock_function_count_map[__func__]++;
  test::mock::stack_acl::btm_read_remote_version_complete_raw(p);
}
void btm_read_rssi_complete(uint8_t* p) {
  mock_function_count_map[__func__]++;
  test::mock::stack_acl::btm_read_rssi_complete(p);
Loading