Re: (Query): [PATCH v4 2/4] usb gadget: Configure endpoint according to gadget speed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 26, 2012 at 10:26 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 26 Jul 2012, Rajaram R wrote:
>
>> Hi Felipe/Alan
>>
>> Any comments for the below query ?
>>
>> On Thu, Jul 12, 2012 at 4:53 PM, Rajaram R <rajaram.officemail@xxxxxxxxx> wrote:
>> > Hi
>> >
>> >
>> > On Thu, Nov 18, 2010 at 6:17 PM, Tatyana Brokhman
>> > <tlinder@xxxxxxxxxxxxxx> wrote:
>> >>
>> >> Add config_ep_by_speed() to configure the endpoint according to the gadget
>> >> speed. Using this function will spare the FDs from handling the endpoint
>> >> chosen descriptor.
>> >>
>> >> Signed-off-by: Tatyana Brokhman <tlinder@xxxxxxxxxxxxxx>
>> >> ---
>> >>  drivers/usb/gadget/composite.c  |   76 +++++++++++++++++++++++++++++++++++++++
>> >>  drivers/usb/gadget/epautoconf.c |    1 +
>> >>  include/linux/usb/composite.h   |   21 +++++++++++
>> >>  include/linux/usb/gadget.h      |    3 ++
>> >>  4 files changed, 101 insertions(+), 0 deletions(-)
>> >>
>> > ---cut---
>> >
>> >> + */
>> >> +int config_ep_by_speed(struct usb_gadget *g,
>> >> +                       struct usb_function *f,
>> >> +                       struct usb_ep *_ep)
>> >> +{
>
> ...
>
>> >> +ep_found:
>> >> +       /* commit results */
>> >> +       _ep->maxpacket = le16_to_cpu(chosen_desc->wMaxPacketSize);
>> >> +       _ep->desc = chosen_desc;
>>
>>  Could you please comment on why do we need to update gadget's ep list
>>  with function's maxpacket ? Will this not affect when we switch
>>  functions ?
>
> The ep list doesn't belong to the gadget driver; it belongs to the UDC
> driver.  The maxpacket has to be adjusted to match the value stored in
> the descriptor so that the UDC will tell the hardware to use the right
> maxpacket value.

The ep list is owned by UDC and thus the function or class should not update it.
This will create problem when we switch functions

For example:

Lets assume the UDC has an interrupt EP in the ep-list with maxpktsize
say 32. When for the 1st time a class a requires interrupt EP, chooses
this EP and adjusts the size to say 8. Then when we switch to a
function that requies an interrupt EP of size say 10. This time though
the UDC is capable of supporting this requirement, EP autoconf will
not be successful.

So IMO, classes should not update eplist. This patch has to be
corrected and pls let me know if I am missing something?

>
> When you switch functions, the new function should call
> config_ep_by_speed().
>
> 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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux