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

Commit bff46f68 authored by Zhihai Xu's avatar Zhihai Xu Committed by Android Git Automerger
Browse files

am 3a126c85: am 25430d98: DO NOT MERGE trouble syncing with fitbit and can\'t turn off bluetooth.

* commit '3a126c85':
  DO NOT MERGE trouble syncing with fitbit and can't turn off bluetooth.
parents e3a08c68 3a126c85
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1563,8 +1563,29 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len)
        role = HCI_ROLE_UNKNOWN;

        if (status == HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT)
        {
            btm_ble_dir_adv_tout();
        }
        /* this is to work around broadcom firmware problem to handle
         * unsolicited command complete event for HCI_LE_Create_Connection_Cancel
         * and LE connection complete event with status error code (0x2)
         * unknown connection identifier from bluetooth controller
         * the workaround is to release the HCI connection to avoid out of sync
         * with bluetooth controller, which cause BT can't be turned off.
        */
        else if ((status == HCI_ERR_NO_CONNECTION) &&
                 (btm_ble_get_conn_st() != BLE_CONN_CANCEL))
        {
            tL2C_LCB    *p_lcb;
            handle = HCID_GET_HANDLE (handle);
            p_lcb = l2cu_find_lcb_by_handle (handle);
            if (p_lcb != NULL)
            {
                l2c_link_hci_disc_comp (handle, HCI_ERR_PEER_USER);
                btm_sec_disconnected (handle, HCI_ERR_PEER_USER);
            }
        }
    }

    btm_ble_set_conn_st(BLE_CONN_IDLE);