Skip to contentSkip to conversation

Re-attach usb device to kernel while usb_host_open fails

PATCH Superseded Lin Ma 2 participants 3 messages Jun 24, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lin Ma

author
#0 lore raw

PATCH 1/1 Re-attach usb device to kernel while usb_host_open fails

Changes in V1:
For avoiding regression issue, Dont remove the usb device from global hostdevs list while usb speed mismatch occurs.

---
 hw/usb/host-libusb.c | 3 +++
 1 file changed, 3 insertions(+)
hw/usb/host-libusb.c +3 -0
index bc2944c..11429f5 100644
@@ -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;
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Lin Ma

Changes in V1:
For avoiding regression issue, Dont remove the usb device from global hostdevs list while usb speed mismatch occurs.

---

The changing remarks should be lay up here,
and use v2 suffix instead of v1.

If you do this, you can add my R-by.

Please refer to:
http://wiki.qemu.org/Contribute/SubmitAPatch

Regards,
-Gonglei

Quoted 18 lines
 hw/usb/host-libusb.c | 3 +++
 1 file changed, 3 insertions(+)
hw/usb/host-libusb.c +3 -0
index bc2944c..11429f5 100644
@@ -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;
author
#2 lore raw
Quoted 10 lines · Gonglei
Quoted 6 lines · Lin Ma

Changes in V1:
For avoiding regression issue, Dont remove the usb device from global hostdevs list while usb speed mismatch occurs.

---

The changing remarks should be lay up here,
and use v2 suffix instead of v1.

Quoted 8 lines

If you do this, you can add my R-by.

Please refer to:
http://wiki.qemu.org/Contribute/SubmitAPatch

Regards,
-Gonglei

I must be getting tired, Sorry about that.

Quoted 21 lines
Quoted 18 lines
  hw/usb/host-libusb.c | 3 +++
  1 file changed, 3 insertions(+)
hw/usb/host-libusb.c +3 -0
index bc2944c..11429f5 100644
@@ -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;