]> git.proxmox.com Git - mirror_qemu.git/commitdiff
usb: fix endpoint descriptor ordering
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 28 Jan 2013 14:52:57 +0000 (15:52 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 19 Feb 2013 11:30:05 +0000 (12:30 +0100)
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>
hw/usb/desc.c

index b7c32333d70032a98fdff56f17006ba6e7af9c72..b38938132699f352f151f3a7b04ac57949f82161 100644 (file)
@@ -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;
 }