lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 12 Jul 2012 16:53:20 +0530
From:	Rajaram R <rajaram.officemail@...il.com>
To:	Tatyana Brokhman <tlinder@...eaurora.org>
Cc:	gregkh@...e.de, linux-usb@...r.kernel.org,
	linux-arm-msm@...r.kernel.org,
	David Brownell <dbrownell@...rs.sourceforge.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/4] usb gadget: Configure endpoint according to gadget speed.

Hi


On Thu, Nov 18, 2010 at 6:17 PM, Tatyana Brokhman
<tlinder@...eaurora.org> 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@...eaurora.org>
> ---
>  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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ