usb: bugfixes

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJeRGbIAAoJEEy22O7T6HE4PZYP/1Drb35WnI+BVyr0sbnDhyLP
 whK0+KAHIy2a3jiwqNO+gpCWAdiERg8qpJCq2ve9tHR10oLBBFHt2TktkvLEUkZx
 ZbxM7jDHzcvvt/0GfWOoP60qF2WGkq/a8x2Qenkn+d/HyfmxNh1C5nwSgVatTcza
 bSQH+M75Ih3iknxfcSrBN1Ib5DHsoI9F1dHjImirG2VbfQKSaF4BMjcOnioDzRr/
 cRgmwKLZSCvUJ/AR3NFhTvvizCmbwhASmIZkgU8/paQx1IFReLi3Ojv6ZBgVyDI/
 IX42qVAoh5Y6waeiiIGpO+80PfDEWQWB6TCX4GgEdJ/SxKnWg1lVP5X83BuNzA5m
 Sl+WSBVmHsN34XvRzENMsZ45Nl0xWio+ZgO0Z2VQq/UhnahcorDXOE1PUiU9wp/z
 SXWrRLU64cXUtPjhg1G+t3MSj2lUAebpS6QnXWUcq/iCXpZgEpmHwwVvTgjIPqez
 BDMz85D+o6l+xF1oYfIHk0r2ktbc94Uz3gYznUqF91rvjV21NwtoG1c0FwGIWRh7
 VbrAOg5FnUGPs7moupspDX+4OlMtdkMQO1+Sf7uIYVhTbQsVSbFTW14QPm7gNozL
 JOC4mznTYgyVztNCsyDpa5vWUUj+Dp05TGslkluxkN/3DtUiudJ42lvV7LHCfMmt
 9xw96bxJQZedd1i8VhnF
 =PlvL
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2020-02-13 14:44:07 +00:00
commit 48f84ab310
2 changed files with 10 additions and 9 deletions

View File

@ -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[]) {
{

View File

@ -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);