Hi Felipe/Tatyana Could you please comment ? 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) >> +{ >> + struct usb_endpoint_descriptor *chosen_desc = NULL; >> + struct usb_descriptor_header **speed_desc = NULL; >> + >> + struct usb_descriptor_header **d_spd; /* cursor for speed desc */ >> + >> + if (!g || !f || !_ep) >> + return -EIO; >> + >> + /* select desired speed */ >> + switch (g->speed) { >> + case USB_SPEED_HIGH: >> + if (gadget_is_dualspeed(g)) { >> + speed_desc = f->hs_descriptors; >> + break; >> + } >> + /* else: fall through */ >> + default: >> + speed_desc = f->descriptors; >> + } >> + /* find descriptors */ >> + for (d_spd = next_ep_desc(speed_desc); d_spd; >> + d_spd = next_ep_desc(d_spd+1)) { >> + chosen_desc = (struct usb_endpoint_descriptor *)*d_spd; >> + if (chosen_desc->bEndpointAddress == _ep->bEndpointAddress) >> + goto ep_found; >> + } >> + return -EIO; >> + >> +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 ? > >> + >> + return 0; >> +} -- 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