aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-01-28 15:52:57 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-02-19 12:30:05 +0100
commit2e5df36df8d0c3ffe59de254ef016508b27562bb (patch)
tree870634be834919ba2e0ba334ad1042618933510b
parent6ef3ccd18f881a7bece556ff0fe1b0bf70ac2262 (diff)
downloadqemu-arm-2e5df36df8d0c3ffe59de254ef016508b27562bb.tar.gz
usb: fix endpoint descriptor ordering
Fix the ordering of the endpoint descriptors for superspeed endpoints: The superspeed companion must come first, possible additional descriptors for the endpoint after that. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/desc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/usb/desc.c b/hw/usb/desc.c
index b7c32333d7..b389381326 100644
--- a/hw/usb/desc.c
+++ b/hw/usb/desc.c
@@ -225,12 +225,9 @@ int usb_desc_endpoint(const USBDescEndpoint *ep, int flags,
d->u.endpoint.bRefresh = ep->bRefresh;
d->u.endpoint.bSynchAddress = ep->bSynchAddress;
}
- if (ep->extra) {
- memcpy(dest + bLength, ep->extra, extralen);
- }
if (superlen) {
- USBDescriptor *d = (void *)(dest + bLength + extralen);
+ USBDescriptor *d = (void *)(dest + bLength);
d->bLength = 0x06;
d->bDescriptorType = USB_DT_ENDPOINT_COMPANION;
@@ -243,6 +240,10 @@ int usb_desc_endpoint(const USBDescEndpoint *ep, int flags,
usb_hi(ep->wBytesPerInterval);
}
+ if (ep->extra) {
+ memcpy(dest + bLength + superlen, ep->extra, extralen);
+ }
+
return bLength + extralen + superlen;
}