qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Re-attach usb device to kernel while usb_host_open


From: Lin Ma
Subject: [Qemu-devel] [PATCH] Re-attach usb device to kernel while usb_host_open fails
Date: Tue, 23 Jun 2015 12:24:23 +0800

Signed-off-by: Lin Ma <address@hidden>
---
 hw/usb/host-libusb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 10f4735..7258c4d 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -888,6 +888,11 @@ static int usb_host_open(USBHostDevice *s, libusb_device 
*dev)
 fail:
     trace_usb_host_open_failure(bus_num, addr);
     if (s->dh != NULL) {
+        qemu_remove_exit_notifier(&s->exit);
+        QTAILQ_REMOVE(&hostdevs, s, next);
+        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;
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]