diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2020-02-13 14:44:07 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2020-02-13 14:44:07 +0000 |
| commit | 48f84ab310317db091810789f98f282c8e58388e (patch) | |
| tree | af5d881325dbaa78c8929403d1535a25b6bde276 | |
| parent | 81f49abaaac2b88062bd1b07f451d9527ed1c9ce (diff) | |
| parent | 8ddcc43592f215a7523774704df6c60d12d9f647 (diff) | |
| download | focaccia-qemu-48f84ab310317db091810789f98f282c8e58388e.tar.gz focaccia-qemu-48f84ab310317db091810789f98f282c8e58388e.zip | |
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200212-pull-request' into staging
usb: bugfixes # gpg: Signature made Wed 12 Feb 2020 20:57:44 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20200212-pull-request: uas: fix super speed bMaxPacketSize0 usb-host: wait for cancel complete Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| -rw-r--r-- | hw/usb/dev-uas.c | 2 | ||||
| -rw-r--r-- | hw/usb/host-libusb.c | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index 9825ec37d0..11a8684cc2 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -303,7 +303,7 @@ static const USBDescDevice desc_device_high = { static const USBDescDevice desc_device_super = { .bcdUSB = 0x0300, - .bMaxPacketSize0 = 64, + .bMaxPacketSize0 = 9, .bNumConfigurations = 1, .confs = (USBDescConfig[]) { { diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 2594700901..2ac7a936fb 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -354,9 +354,7 @@ static USBHostRequest *usb_host_req_alloc(USBHostDevice *s, USBPacket *p, static void usb_host_req_free(USBHostRequest *r) { - if (r->host) { - QTAILQ_REMOVE(&r->host->requests, r, next); - } + QTAILQ_REMOVE(&r->host->requests, r, next); libusb_free_transfer(r->xfer); g_free(r->buffer); g_free(r); @@ -468,12 +466,7 @@ static void usb_host_req_abort(USBHostRequest *r) usb_packet_complete(USB_DEVICE(s), r->p); } r->p = NULL; - } - - QTAILQ_REMOVE(&r->host->requests, r, next); - r->host = NULL; - if (inflight) { libusb_cancel_transfer(r->xfer); } } @@ -962,6 +955,13 @@ static void usb_host_abort_xfers(USBHostDevice *s) QTAILQ_FOREACH_SAFE(r, &s->requests, next, rtmp) { usb_host_req_abort(r); } + + while (QTAILQ_FIRST(&s->requests) != NULL) { + struct timeval tv; + memset(&tv, 0, sizeof(tv)); + tv.tv_usec = 2500; + libusb_handle_events_timeout(ctx, &tv); + } } static int usb_host_close(USBHostDevice *s) @@ -1011,6 +1011,7 @@ static void usb_host_exit_notifier(struct Notifier *n, void *data) USBHostDevice *s = container_of(n, USBHostDevice, exit); if (s->dh) { + usb_host_abort_xfers(s); usb_host_release_interfaces(s); libusb_reset_device(s->dh); usb_host_attach_kernel(s); |