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

Commit b9017176 authored by Ivan Podogov's avatar Ivan Podogov Committed by android-build-merger
Browse files

HID: Fix forced disconnection flow.

am: 1bbba112

Change-Id: Ia72cfb5979735bdb2b091291719ac895331bba7e
parents 364d1b60 1bbba112
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -305,11 +305,11 @@ extern void bta_hd_disconnect_act(UNUSED_ATTR tBTA_HD_DATA* p_data) {
    return;
  }

  bdcpy(cback_data.conn.bda, bta_hd_cb.bd_addr);
  if (HID_DevGetDevice(&cback_data.conn.bda) == HID_SUCCESS) {
    cback_data.conn.status = BTHD_CONN_STATE_DISCONNECTING;

    bta_hd_cb.p_cback(BTA_HD_CONN_STATE_EVT, &cback_data);
  }
}

/*******************************************************************************
 *
+2 −2
Original line number Diff line number Diff line
@@ -122,14 +122,14 @@ const uint8_t bta_hd_st_idle[][BTA_HD_NUM_COLS] = {
    /* BTA_HD_API_REGISTER_APP_EVT   */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_API_UNREGISTER_APP_EVT */ {BTA_HD_UNREGISTER_ACT, BTA_HD_INIT_ST},
    /* BTA_HD_API_CONNECT_EVT        */ {BTA_HD_CONNECT_ACT, BTA_HD_IDLE_ST},
    /* BTA_HD_API_DISCONNECT_EVT     */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_API_DISCONNECT_EVT     */ {BTA_HD_DISCONNECT_ACT, BTA_HD_IDLE_ST},
    /* BTA_HD_API_ADD_DEVICE_EVT     */ {BTA_HD_ADD_DEVICE_ACT, BTA_HD_IDLE_ST},
    /* BTA_HD_API_REMOVE_DEVICE_EVT  */ {BTA_HD_REMOVE_DEVICE_ACT, BTA_HD_IDLE_ST},
    /* BTA_HD_API_SEND_REPORT_EVT    */ {BTA_HD_SEND_REPORT_ACT, BTA_HD_IDLE_ST},
    /* BTA_HD_API_REPORT_ERROR_EVT   */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_API_VC_UNPLUG_EVT      */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_INT_OPEN_EVT           */ {BTA_HD_OPEN_ACT, BTA_HD_CONN_ST},
    /* BTA_HD_INT_CLOSE_EVT          */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_INT_CLOSE_EVT          */ {BTA_HD_CLOSE_ACT, BTA_HD_IDLE_ST},
    /* BTA_HD_INT_INTR_DATA_EVT      */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_INT_GET_REPORT_EVT     */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
    /* BTA_HD_INT_SET_REPORT_EVT     */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
+8 −0
Original line number Diff line number Diff line
@@ -496,6 +496,14 @@ tHID_STATUS HID_DevDisconnect(void) {
  }

  if (hd_cb.device.state == HIDD_DEV_NO_CONN) {
    /* If we are still trying to connect, just close the connection. */
    if (hd_cb.device.conn.conn_state != HID_CONN_STATE_UNUSED) {
      tHID_STATUS ret = hidd_conn_disconnect();
      hd_cb.device.conn.conn_state = HID_CONN_STATE_UNUSED;
      hd_cb.callback(hd_cb.device.addr, HID_DHOST_EVT_CLOSE,
                     HID_ERR_DISCONNECTING, NULL);
      return ret;
    }
    return HID_ERR_NO_CONNECTION;
  }

+2 −2
Original line number Diff line number Diff line
@@ -373,8 +373,8 @@ static void hidd_l2cif_config_ind(uint16_t cid, tL2CAP_CFG_INFO* p_cfg) {
      p_hcon->disc_reason = HID_L2CAP_CONN_FAIL;
      if ((p_hcon->intr_cid =
               L2CA_ConnectReq(HID_PSM_INTERRUPT, hd_cb.device.addr)) == 0) {
        p_hcon->conn_state = HID_CONN_STATE_UNUSED;
        hidd_conn_disconnect();
        p_hcon->conn_state = HID_CONN_STATE_UNUSED;

        HIDD_TRACE_WARNING("%s: could not start L2CAP connection for INTR",
                           __func__);
@@ -456,8 +456,8 @@ static void hidd_l2cif_config_cfm(uint16_t cid, tL2CAP_CFG_INFO* p_cfg) {
      p_hcon->disc_reason = HID_L2CAP_CONN_FAIL;
      if ((p_hcon->intr_cid =
               L2CA_ConnectReq(HID_PSM_INTERRUPT, hd_cb.device.addr)) == 0) {
        p_hcon->conn_state = HID_CONN_STATE_UNUSED;
        hidd_conn_disconnect();
        p_hcon->conn_state = HID_CONN_STATE_UNUSED;

        HIDD_TRACE_WARNING("%s: could not start L2CAP connection for INTR",
                           __func__);