p_data->dev_status.status, p_data->dev_status.handle);
p_dev = btif_hh_find_connected_dev_by_handle(p_data->dev_status.handle);
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));
+ /* 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) {
bta_hh_co_destroy(p_dev->fd);
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);
}
else {
if( (dev_handle >= HID_HOST_MAX_DEVICES) || (!hh_cb.devices[dev_handle].in_use) )
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 )
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;
return hidh_conn_disconnect( dev_handle );
}