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

Commit 15cdb83c authored by xiaoshun.xu's avatar xiaoshun.xu Committed by Chris Manton
Browse files

Add code for two rc reconnect at same time, one rc cannot work

[Description]
Fix is designed to fix two rc reconnect at same time, only one
rc cannot work because of using wrong dev pointer

[Test Report]
Reconnect two RC or mouse concurrently, both RC or mouse
can work well

Test: manual, reconnect 2 devices concurrently
Bug: 136790746

Change-Id: I7646fda0ab6e08404f5a20ffea0fcc9af6d49a01
parent 0a6115c0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -907,10 +907,15 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
void bta_hh_get_dscp_act(tBTA_HH_DEV_CB* p_cb,
                         UNUSED_ATTR const tBTA_HH_DATA* p_data) {
  if (p_cb->is_le_device) {
    if (p_cb->hid_srvc.in_use) {
      p_cb->dscp_info.hid_handle = p_cb->hid_handle;
    }
    bta_hh_le_get_dscp_act(p_cb);
  } else
  } else {
    p_cb->dscp_info.hid_handle = p_cb->hid_handle;
    (*bta_hh_cb.p_cback)(BTA_HH_GET_DSCP_EVT, (tBTA_HH*)&p_cb->dscp_info);
  }
}

/*******************************************************************************
 *
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ typedef struct {

  uint8_t flag;
  tBTA_HH_DEV_DESCR descriptor;
  uint8_t hid_handle;

  std::string ToString() const {
    return base::StringPrintf("%04x::%04x::%04x", vendor_id, product_id,
+0 −1
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ typedef struct {
  btif_hh_device_t devices[BTIF_HH_MAX_HID];
  uint32_t device_num;
  btif_hh_added_device_t added_devices[BTIF_HH_MAX_ADDED_DEV];
  btif_hh_device_t* p_curr_dev;
  bool service_dereg_active;
  RawAddress pending_conn_address;
} btif_hh_cb_t;
+2 −3
Original line number Diff line number Diff line
@@ -811,8 +811,6 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) {
          if (check_cod(&p_data->conn.bda, COD_HID_KEYBOARD) ||
              check_cod(&p_data->conn.bda, COD_HID_COMBO))
            BTA_HhSetIdle(p_data->conn.handle, 0);
          btif_hh_cb.p_curr_dev =
              btif_hh_find_connected_dev_by_handle(p_data->conn.handle);
          BTA_HhGetDscpInfo(p_data->conn.handle);
          p_dev->dev_status = BTHH_CONN_STATE_CONNECTED;
          HAL_CBACK(bt_hh_callbacks, connection_state_cb, &(p_dev->bd_addr),
@@ -956,10 +954,11 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) {
    case BTA_HH_GET_DSCP_EVT:
      len = p_data->dscp_info.descriptor.dl_len;
      BTIF_TRACE_DEBUG("BTA_HH_GET_DSCP_EVT: len = %d", len);
      p_dev = btif_hh_cb.p_curr_dev;
      p_dev = btif_hh_find_connected_dev_by_handle(p_data->dscp_info.hid_handle);
      if (p_dev == NULL) {
        BTIF_TRACE_ERROR(
            "BTA_HH_GET_DSCP_EVT: No HID device is currently connected");
        p_data->dscp_info.hid_handle = BTA_HH_INVALID_HANDLE;
        return;
      }
      if (p_dev->fd < 0) {