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

Commit 4c7e525d authored by Sonny Sasaka's avatar Sonny Sasaka
Browse files

Floss: Disable ReadFailedContactCounter

Intel controllers don't handle ReadFailedContactCounter correctly but
instead sends back Hardware Error event which crashes Floss daemon.

Ideally Intel firmware should fix this but in the meantime we need to
avoid crash so this patch disables the HCI Read Failed Contact Counter
for Floss targets.

Bug: 249876976
Tag: #floss
Test: Build Floss on Chrome OS and Linux

Change-Id: I99817ea2a085c470b93be96d6c1366216b41f194
parent a6d175f2
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -1015,12 +1015,22 @@ static bool btif_a2dp_source_enqueue_callback(BT_HDR* p_buf, size_t frames_n,
    if (status != BTM_CMD_STARTED) {
    if (status != BTM_CMD_STARTED) {
      LOG_WARN("%s: Cannot read RSSI: status %d", __func__, status);
      LOG_WARN("%s: Cannot read RSSI: status %d", __func__, status);
    }
    }

    // Intel controllers don't handle ReadFailedContactCounter very well, it
    // sends back Hardware Error event which will crash the daemon. So
    // temporarily disable this for Floss.
    // TODO(b/249876976): Intel controllers to handle this command correctly.
    // And if the need for disabling metrics-related HCI call grows, consider
    // creating a framework to avoid ifdefs.
#ifndef TARGET_FLOSS
    status = BTM_ReadFailedContactCounter(peer_bda,
    status = BTM_ReadFailedContactCounter(peer_bda,
                                          btm_read_failed_contact_counter_cb);
                                          btm_read_failed_contact_counter_cb);
    if (status != BTM_CMD_STARTED) {
    if (status != BTM_CMD_STARTED) {
      LOG_WARN("%s: Cannot read Failed Contact Counter: status %d", __func__,
      LOG_WARN("%s: Cannot read Failed Contact Counter: status %d", __func__,
               status);
               status);
    }
    }
#endif

    status =
    status =
        BTM_ReadTxPower(peer_bda, BT_TRANSPORT_BR_EDR, btm_read_tx_power_cb);
        BTM_ReadTxPower(peer_bda, BT_TRANSPORT_BR_EDR, btm_read_tx_power_cb);
    if (status != BTM_CMD_STARTED) {
    if (status != BTM_CMD_STARTED) {