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>
This commit is contained in:
		
							parent
							
								
									6ef3ccd18f
								
							
						
					
					
						commit
						2e5df36df8
					
				@ -225,12 +225,9 @@ int usb_desc_endpoint(const USBDescEndpoint *ep, int flags,
 | 
				
			|||||||
        d->u.endpoint.bRefresh      = ep->bRefresh;
 | 
					        d->u.endpoint.bRefresh      = ep->bRefresh;
 | 
				
			||||||
        d->u.endpoint.bSynchAddress = ep->bSynchAddress;
 | 
					        d->u.endpoint.bSynchAddress = ep->bSynchAddress;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (ep->extra) {
 | 
					 | 
				
			||||||
        memcpy(dest + bLength, ep->extra, extralen);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (superlen) {
 | 
					    if (superlen) {
 | 
				
			||||||
        USBDescriptor *d = (void *)(dest + bLength + extralen);
 | 
					        USBDescriptor *d = (void *)(dest + bLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        d->bLength                       = 0x06;
 | 
					        d->bLength                       = 0x06;
 | 
				
			||||||
        d->bDescriptorType               = USB_DT_ENDPOINT_COMPANION;
 | 
					        d->bDescriptorType               = USB_DT_ENDPOINT_COMPANION;
 | 
				
			||||||
@ -243,6 +240,10 @@ int usb_desc_endpoint(const USBDescEndpoint *ep, int flags,
 | 
				
			|||||||
            usb_hi(ep->wBytesPerInterval);
 | 
					            usb_hi(ep->wBytesPerInterval);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ep->extra) {
 | 
				
			||||||
 | 
					        memcpy(dest + bLength + superlen, ep->extra, extralen);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return bLength + extralen + superlen;
 | 
					    return bLength + extralen + superlen;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user