From 6110ce59af199194ef63cb31ec722487df3f42fe Mon Sep 17 00:00:00 2001 From: Lin Ma Date: Wed, 24 Jun 2015 13:40:11 +0800 Subject: [PATCH] Re-attach usb device to kernel while usb_host_open fails Signed-off-by: Lin Ma Reviewed-by: Gonglei Signed-off-by: Gerd Hoffmann --- hw/usb/host-libusb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index bc2944c6b2..11429f5e73 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -889,6 +889,9 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev) fail: trace_usb_host_open_failure(bus_num, addr); if (s->dh != NULL) { + usb_host_release_interfaces(s); + libusb_reset_device(s->dh); + usb_host_attach_kernel(s); libusb_close(s->dh); s->dh = NULL; s->dev = NULL;