On Fri, Aug 28 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> Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx> > --- > 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) > + % 63)) > continue; > break; > } > @@ -532,7 +533,7 @@ static void reinit_write_data(struct usb_ep *ep, struct usb_request *req) > break; > case 1: > for (i = 0; i < req->length; i++) > - *buf++ = (u8) (i % 63); > + *buf++ = (u8) ((i % ep->desc->wMaxPacketSize) % 63); > break; > case 2: > break; > -- > 1.9.1 > -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, ミハウ “mina86” ナザレヴイツ (o o) ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>-----ooO--(_)--Ooo-- -- 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