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

Commit 158b3383 authored by Stanley Tng's avatar Stanley Tng Committed by Andre Eisenbach
Browse files

Add more logs for Bluetooth connection errors

Test: manual
Change-Id: I63402ee8ffa8f57a70a9c9aaa0370d8ca599bbea
parent 816e399e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -387,6 +387,10 @@ void bta_gattc_open_error(tBTA_GATTC_CLCB* p_clcb,
 ******************************************************************************/
void bta_gattc_open_fail(tBTA_GATTC_CLCB* p_clcb,
                         UNUSED_ATTR tBTA_GATTC_DATA* p_data) {
  APPL_TRACE_WARNING(
      "%s: Cannot establish Connection. conn_id=%d. Return GATT_ERROR(%d).",
      __func__, p_clcb->bta_conn_id, GATT_ERROR);

  bta_gattc_send_open_cback(p_clcb->p_rcb, GATT_ERROR, p_clcb->bda,
                            p_clcb->bta_conn_id, p_clcb->transport, 0);
  /* open failure, remove clcb */
@@ -625,6 +629,9 @@ void bta_gattc_close_fail(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data) {
    cb_data.close.status = GATT_ERROR;
    cb_data.close.reason = BTA_GATT_CONN_NONE;

    APPL_TRACE_WARNING("%s: conn_id=%d. Returns GATT_ERROR (%d).", __func__,
                       cb_data.close.conn_id, GATT_ERROR);

    (*p_clcb->p_rcb->p_cback)(BTA_GATTC_CLOSE_EVT, &cb_data);
  }
}
+9 −3
Original line number Diff line number Diff line
@@ -299,12 +299,15 @@ bool bta_gattc_sm_execute(tBTA_GATTC_CLCB* p_clcb, uint16_t event,
  uint8_t action;
  int i;
  bool rt = true;
#if (BTA_GATT_DEBUG == TRUE)
  tBTA_GATTC_STATE in_state = p_clcb->state;
  uint16_t in_event = event;
  APPL_TRACE_DEBUG("bta_gattc_sm_execute: State 0x%02x [%s], Event 0x%x[%s]",
                   in_state, gattc_state_code(in_state), in_event,
#if (BTA_GATT_DEBUG == TRUE)
  APPL_TRACE_DEBUG("%s: State 0x%02x [%s], Event 0x%x[%s]", __func__, in_state,
                   gattc_state_code(in_state), in_event,
                   gattc_evt_code(in_event));
#else
  APPL_TRACE_VERBOSE("%s: State 0x%02x, Event 0x%x", __func__, in_state,
                     in_event);
#endif

  /* look up the state table for the current state */
@@ -337,6 +340,9 @@ bool bta_gattc_sm_execute(tBTA_GATTC_CLCB* p_clcb, uint16_t event,
                     gattc_state_code(in_state),
                     gattc_state_code(p_clcb->state), gattc_evt_code(in_event));
  }
#else
  APPL_TRACE_DEBUG("%s: GATTC State Change: 0x%02x -> 0x%02x after Event 0x%x",
                   __func__, in_state, p_clcb->state, in_event);
#endif
  return rt;
}
+8 −8
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ extern bt_callbacks_t* bt_hal_cbacks;
#define HAL_CBACK(P_CB, P_CBACK, ...)                              \
  do {                                                             \
    if ((P_CB) && (P_CB)->P_CBACK) {                               \
      BTIF_TRACE_API("HAL %s->%s", #P_CB, #P_CBACK); \
      BTIF_TRACE_API("%s: HAL %s->%s", __func__, #P_CB, #P_CBACK); \
      (P_CB)->P_CBACK(__VA_ARGS__);                                \
    } else {                                                       \
      ASSERTC(0, "Callback is NULL", 0);                           \
+14 −0
Original line number Diff line number Diff line
@@ -588,6 +588,13 @@ static void btu_hcif_connection_comp_evt(uint8_t* p) {

  handle = HCID_GET_HANDLE(handle);

  if (status != HCI_SUCCESS) {
    HCI_TRACE_DEBUG(
        "%s: Connection failed: status=%d, handle=%d, link_type=%d, "
        "enc_mode=%d",
        __func__, status, handle, link_type, enc_mode);
  }

  if (link_type == HCI_LINK_TYPE_ACL) {
    btm_sec_connected(bda, handle, status, enc_mode);

@@ -652,6 +659,13 @@ static void btu_hcif_disconnection_comp_evt(uint8_t* p) {

  handle = HCID_GET_HANDLE(handle);

  if ((reason != HCI_ERR_CONN_CAUSE_LOCAL_HOST) &&
      (reason != HCI_ERR_PEER_USER)) {
    /* Uncommon disconnection reasons */
    HCI_TRACE_DEBUG("%s: Got Disconn Complete Event: reason=%d, handle=%d",
                    __func__, reason, handle);
  }

#if (BTM_SCO_INCLUDED == TRUE)
  /* If L2CAP doesn't know about it, send it to SCO */
  if (!l2c_link_hci_disc_comp(handle, reason)) btm_sco_removed(handle, reason);