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

Commit 536f1958 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I32c92511,I1a3d841d,Ibc688eac

* changes:
  legacy: Add HACK to set legacy SM4 from gd_acl
  gd: Re-introduce read remote supported features
  BTM_history: Add dev states to stack hid host profile
parents 8dddc875 415bfc38
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -817,10 +817,12 @@ void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
  tBTA_HH_CONN conn_dat;
  tBTA_HH_CBDATA disc_dat = {BTA_HH_OK, 0};
  uint32_t reason = p_data->hid_cback.data; /* Reason for closing (32-bit) */

  // TODO Fix use proper types
  tHID_STATUS hid_status = static_cast<tHID_STATUS>(reason);
  uint32_t reason = p_data->hid_cback.data; /* Reason for closing (32-bit) */
  const bool l2cap_conn_fail = reason & HID_L2CAP_CONN_FAIL;
  const bool l2cap_req_fail = reason & HID_L2CAP_REQ_FAIL;
  const bool l2cap_cfg_fail = reason & HID_L2CAP_CFG_FAIL;
  const tHID_STATUS hid_status = static_cast<tHID_STATUS>(reason & 0xff);

  /* if HID_HDEV_EVT_VC_UNPLUG was received, report BTA_HH_VC_UNPLUG_EVT */
  uint16_t event = p_cb->vp ? BTA_HH_VC_UNPLUG_EVT : BTA_HH_CLOSE_EVT;
@@ -828,6 +830,16 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
  disc_dat.handle = p_cb->hid_handle;
  disc_dat.status = to_bta_hh_status(p_data->hid_cback.data);

  std::string overlay_fail =
      base::StringPrintf("%s %s %s", (l2cap_conn_fail) ? "l2cap_conn_fail" : "",
                         (l2cap_req_fail) ? "l2cap_req_fail" : "",
                         (l2cap_cfg_fail) ? "l2cap_cfg_fail" : "");
  BTM_LogHistory(kBtmLogTag, p_cb->addr, "Closed",
                 base::StringPrintf("%s reason %s %s",
                                    (p_cb->is_le_device) ? "le" : "classic",
                                    hid_status_text(hid_status).c_str(),
                                    overlay_fail.c_str()));

  /* Check reason for closing */
  if ((reason & (HID_L2CAP_CONN_FAIL |
                 HID_L2CAP_REQ_FAIL)) || /* Failure to initialize connection
@@ -851,11 +863,6 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) {
  }
  /* otherwise report CLOSE/VC_UNPLUG event */
  else {
    BTM_LogHistory(kBtmLogTag, p_cb->addr, "Closed",
                   base::StringPrintf("%s reason %s",
                                      (p_cb->is_le_device) ? "le" : "classic",
                                      hid_status_text(hid_status).c_str()));

    /* finaliza device driver */
    bta_hh_co_close(p_cb->hid_handle, p_cb->app_id);
    /* inform role manager */
+3 −0
Original line number Diff line number Diff line
@@ -287,6 +287,9 @@ void acl_link_segments_xmitted(BT_HDR_RIGID* p_msg) {
void acl_packets_completed(uint16_t handle, uint16_t credits) {
  mock_function_count_map[__func__]++;
}
void acl_process_supported_features(uint16_t handle, uint64_t features) {
  mock_function_count_map[__func__]++;
}
void acl_process_extended_features(uint16_t handle, uint8_t current_page_number,
                                   uint8_t max_page_number, uint64_t features) {
  mock_function_count_map[__func__]++;
+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ class AclConnectionTracker : public ConnectionManagementCallbacks {
        connection_handle_, static_cast<uint8_t>(hci_status), lmp_version, manufacturer_name, sub_version);
    SAVE_OR_CALL(OnReadRemoteVersionInformationComplete, hci_status, lmp_version, manufacturer_name, sub_version);
  }
  void OnReadRemoteSupportedFeaturesComplete(uint64_t features) override {
    SAVE_OR_CALL(OnReadRemoteSupportedFeaturesComplete, features);
  }
  void OnReadRemoteExtendedFeaturesComplete(uint8_t page_number, uint8_t max_page_number, uint64_t features) override {
    SAVE_OR_CALL(OnReadRemoteExtendedFeaturesComplete, page_number, max_page_number, features);
  }
+1 −7
Original line number Diff line number Diff line
@@ -578,13 +578,7 @@ struct classic_impl : public security::ISecurityManagerListener {
      ASSERT(!crash_on_unknown_handle_);
      return;
    }

    bool is_remote_support_extended_features = view.GetLmpFeatures() & (0x1ULL << 63);
    if (controller_->IsSupported(OpCode::READ_LOCAL_EXTENDED_FEATURES) && is_remote_support_extended_features) {
      callbacks->OnReadRemoteExtendedFeaturesComplete(0, 1, view.GetLmpFeatures());
    } else {
      callbacks->OnReadRemoteExtendedFeaturesComplete(0, 0, view.GetLmpFeatures());
    }
    callbacks->OnReadRemoteSupportedFeaturesComplete(view.GetLmpFeatures());
  }

  void on_read_remote_extended_features_complete(EventView packet) {
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ class ConnectionManagementCallbacks {
  // Invoked when controller sends Read Remote Version Information Complete
  virtual void OnReadRemoteVersionInformationComplete(
      hci::ErrorCode hci_status, uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) = 0;
  // Invoked when controller sends Read Remote Supported Features Complete
  virtual void OnReadRemoteSupportedFeaturesComplete(uint64_t features) = 0;
  // Invoked when controller sends Read Remote Extended Features Complete
  virtual void OnReadRemoteExtendedFeaturesComplete(
      uint8_t page_number, uint8_t max_page_number, uint64_t features) = 0;
Loading