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

Commit 765a293b authored by Chris Manton's avatar Chris Manton
Browse files

Re-align read remote version information on legacy

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

Change-Id: I7be1ecba73234431194ad9702ec3ea06b09c60bc
parent efe95cca
Loading
Loading
Loading
Loading
+25 −12
Original line number Original line Diff line number Diff line
@@ -810,13 +810,33 @@ void BTM_default_block_role_switch() {
 * Returns          void
 * Returns          void
 *
 *
 ******************************************************************************/
 ******************************************************************************/
static void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
static void maybe_chain_more_commands_after_read_remote_version_complete(
    uint8_t status, uint16_t handle) {
  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
  if (p_acl_cb == nullptr) {
    LOG_WARN("Received remote version complete for unknown device");
    return;
  }

  switch (p_acl_cb->transport) {
    case BT_TRANSPORT_LE:
      l2cble_notify_le_connection(p_acl_cb->remote_addr);
      l2cble_use_preferred_conn_params(p_acl_cb->remote_addr);
      break;
    case BT_TRANSPORT_BR_EDR:
      if (status == HCI_SUCCESS) {
        internal_.btm_read_remote_features(p_acl_cb->hci_handle);
      }
  }
}

void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
                                         uint8_t lmp_version,
                                         uint8_t lmp_version,
                                         uint16_t manufacturer,
                                         uint16_t manufacturer,
                                         uint16_t lmp_subversion) {
                                         uint16_t lmp_subversion) {
  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
  tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
  if (p_acl_cb == nullptr) {
  if (p_acl_cb == nullptr) {
    LOG_WARN("Received remote version complete for unknown device");
    LOG_WARN("Received remote version complete for unknown acl");
    return;
    return;
  }
  }


@@ -825,19 +845,11 @@ static void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
    p_acl_cb->manufacturer = manufacturer;
    p_acl_cb->manufacturer = manufacturer;
    p_acl_cb->lmp_subversion = lmp_subversion;
    p_acl_cb->lmp_subversion = lmp_subversion;


    if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) {
      internal_.btm_read_remote_features(p_acl_cb->hci_handle);
    }
    bluetooth::common::LogRemoteVersionInfo(handle, status, lmp_version,
    bluetooth::common::LogRemoteVersionInfo(handle, status, lmp_version,
                                            manufacturer, lmp_subversion);
                                            manufacturer, lmp_subversion);
  } else {
  } else {
    bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0);
    bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0);
  }
  }

  if (p_acl_cb->transport == BT_TRANSPORT_LE) {
    l2cble_notify_le_connection(p_acl_cb->remote_addr);
    l2cble_use_preferred_conn_params(p_acl_cb->remote_addr);
  }
}
}


void btm_read_remote_version_complete(uint8_t* p) {
void btm_read_remote_version_complete(uint8_t* p) {
@@ -855,6 +867,7 @@ void btm_read_remote_version_complete(uint8_t* p) {


  btm_process_remote_version_complete(status, handle, lmp_version, manufacturer,
  btm_process_remote_version_complete(status, handle, lmp_version, manufacturer,
                                      lmp_subversion);
                                      lmp_subversion);
  maybe_chain_more_commands_after_read_remote_version_complete(status, handle);
}
}


/*******************************************************************************
/*******************************************************************************