Skip to content

Commit 982555f

Browse files
Peter ChenFelipe Balbi
authored andcommitted
usb: gadget: fix request length error for isoc transfer
For isoc endpoint descriptor, the wMaxPacketSize is not real max packet size (see Table 9-13. Standard Endpoint Descriptor, USB 2.0 specifcation), it may contain the number of packet, so the real max packet should be ep->desc->wMaxPacketSize && 0x7ff. Cc: Felipe F. Tonello <eu@felipetonello.com> Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Fixes: 16b114a ("usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_aligna") Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
1 parent dbf499c commit 982555f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/linux/usb/gadget.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
429429
*/
430430
static inline size_t usb_ep_align(struct usb_ep *ep, size_t len)
431431
{
432-
return round_up(len, (size_t)le16_to_cpu(ep->desc->wMaxPacketSize));
432+
int max_packet_size = (size_t)usb_endpoint_maxp(ep->desc) & 0x7ff;
433+
434+
return round_up(len, max_packet_size);
433435
}
434436

435437
/**

0 commit comments

Comments
 (0)