RE: [PATCH] usb: gadget: f_fs: report error if excess data received
From: Du, Changbin
Date: Wed May 18 2016 - 22:31:11 EST
> >> thanks Alan Stern and Michal.
> >> Here just have a comment - the buffered data need be dropped when
> the
> >> epfile is closed, because it means the session is terminated.
> >
> > I blame that on sleep deprivation. Another issue is what to do when
> > endpoint is disabled. Should the buffer be cleared as soon as the
> > endpoint is disabled? Or maybe when the endpoint is enabled again? Or
> > maybe it should never be cleared?
> >
> > If the buffer is cleared when endpoint is disabled, we again silently
> > drop data. On the other hand, if we donât do that, read() on the
> > endpoint will may succeed even if the configuration is disabled which
> > may be surprising for users.
>
> tough decision... but seems like clearing the buffer as soon as ep is
> disabled is the way to go.
>
> --
> Balbi
I agree with Balbi, seems it is not easy to maintain the excess buffer... I was to
implement it at the beginning but I am not confident everything is done correctly.