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

Commit 2ed0c6c2 authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

HID: Remove bond for device in case Virtual unplug is ongoing

am: 25704c5a

* commit '25704c5a':
  HID: Remove bond for device in case Virtual unplug is ongoing
parents 48d5edb1 25704c5a
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -794,14 +794,24 @@ static void btif_hh_upstreams_evt(UINT16 event, char* p_param)
            p_data->dev_status.status, p_data->dev_status.handle);
            p_data->dev_status.status, p_data->dev_status.handle);
            p_dev = btif_hh_find_connected_dev_by_handle(p_data->dev_status.handle);
            p_dev = btif_hh_find_connected_dev_by_handle(p_data->dev_status.handle);
            if (p_dev != NULL) {
            if (p_dev != NULL) {
                BTIF_TRACE_DEBUG("%s: uhid fd = %d", __FUNCTION__, p_dev->fd);
                BTIF_TRACE_DEBUG("%s: uhid fd=%d local_vup=%d", __func__, p_dev->fd, p_dev->local_vup);
                btif_hh_stop_vup_timer(&(p_dev->bd_addr));
                btif_hh_stop_vup_timer(&(p_dev->bd_addr));
                /* If this is a locally initiated VUP, remove the bond as ACL got
                 *  disconnected while VUP being processed.
                 */
                if (p_dev->local_vup)
                {
                    p_dev->local_vup = FALSE;
                    BTA_DmRemoveDevice((UINT8 *)p_dev->bd_addr.address);
                }

                btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
                p_dev->dev_status = BTHH_CONN_STATE_DISCONNECTED;

                if (p_dev->fd >= 0) {
                if (p_dev->fd >= 0) {
                    bta_hh_co_destroy(p_dev->fd);
                    bta_hh_co_destroy(p_dev->fd);
                    p_dev->fd = -1;
                    p_dev->fd = -1;
                }
                }
                btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
                p_dev->dev_status = BTHH_CONN_STATE_DISCONNECTED;
                HAL_CBACK(bt_hh_callbacks, connection_state_cb,&(p_dev->bd_addr), p_dev->dev_status);
                HAL_CBACK(bt_hh_callbacks, connection_state_cb,&(p_dev->bd_addr), p_dev->dev_status);
            }
            }
            else {
            else {
+1 −3
Original line number Original line Diff line number Diff line
@@ -491,12 +491,10 @@ tHID_STATUS HID_HostCloseDev( UINT8 dev_handle )
    if( (dev_handle >= HID_HOST_MAX_DEVICES) || (!hh_cb.devices[dev_handle].in_use) )
    if( (dev_handle >= HID_HOST_MAX_DEVICES) || (!hh_cb.devices[dev_handle].in_use) )
        return HID_ERR_INVALID_PARAM;
        return HID_ERR_INVALID_PARAM;


    hh_cb.devices[dev_handle].conn_tries = HID_HOST_MAX_CONN_RETRY+1;
    alarm_cancel(hh_cb.devices[dev_handle].conn.process_repage_timer);

    if( hh_cb.devices[dev_handle].state != HID_DEV_CONNECTED )
    if( hh_cb.devices[dev_handle].state != HID_DEV_CONNECTED )
        return HID_ERR_NO_CONNECTION;
        return HID_ERR_NO_CONNECTION;


    alarm_cancel(hh_cb.devices[dev_handle].conn.process_repage_timer);
    hh_cb.devices[dev_handle].conn_tries = HID_HOST_MAX_CONN_RETRY+1;
    hh_cb.devices[dev_handle].conn_tries = HID_HOST_MAX_CONN_RETRY+1;
    return hidh_conn_disconnect( dev_handle );
    return hidh_conn_disconnect( dev_handle );
}
}