On Fri, 28 Aug 2015, Peter Chen wrote: > Since the host and gadget can't agree with transfer length before > each transfer, but they agree with max packet size for each > endpoint, we use max packet size to format data pattern. > > Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx> > --- > drivers/usb/gadget/function/f_sourcesink.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c > index cbfaf86..21dced2 100644 > --- a/drivers/usb/gadget/function/f_sourcesink.c > +++ b/drivers/usb/gadget/function/f_sourcesink.c > @@ -510,7 +510,8 @@ static int check_read_data(struct f_sourcesink *ss, struct usb_request *req) > * stutter for any reason, including buffer duplication...) > */ > case 1: > - if (*buf == (u8)(i % 63)) > + if (*buf == (u8)((i % ss->out_ep->desc->wMaxPacketSize) You need a le16_to_cpu() in here, because the descriptor value is always stored in little-endian format. And the same thing below. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html