summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Ma <lma@suse.com>2015-06-24 13:40:11 +0800
committerGerd Hoffmann <kraxel@redhat.com>2015-07-16 17:39:13 +0200
commit6110ce59af199194ef63cb31ec722487df3f42fe (patch)
tree26e7c9aab9501d44723b998467a711cb4c6adbef
parent2d5ee9e7a7dd495d233cf9613a865f63f88e3375 (diff)
downloadqemu-6110ce59af199194ef63cb31ec722487df3f42fe.tar.gz
Re-attach usb device to kernel while usb_host_open fails
Signed-off-by: Lin Ma <lma@suse.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/host-libusb.c3
1 files changed, 3 insertions, 0 deletions
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;