On Wed, May 27, 2015 at 07:50:05PM +0800, Li Jun wrote:
> From: Macpaul Lin <macp...@gmail.com>
> 
> Copy usb_otg_descriptor from config's descriptor if host requests USB_DT_OTG.
> 
> Signed-off-by: Macpaul Lin <macp...@gmail.com>
> Signed-off-by: Li Jun <jun...@freescale.com>
> ---
>  drivers/usb/gadget/composite.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 707959c..81a2061 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -1565,6 +1565,24 @@ composite_setup(struct usb_gadget *gadget, const 
> struct usb_ctrlrequest *ctrl)
>                               value = min(w_length, (u16) value);
>                       }
>                       break;
> +             case USB_DT_OTG:
> +                     if (gadget_is_otg(gadget)) {
> +                             struct usb_configuration *config;
> +
> +                             if (cdev->config)
> +                                     config = cdev->config;
> +                             else
> +                                     config = list_first_entry(
> +                                                     &cdev->configs,
> +                                             struct usb_configuration, list);
> +                             if (!config)
> +                                     goto done;
> +
> +                             value = min_t(int, w_length,
> +                                     sizeof(struct usb_otg_descriptor));
> +                             memcpy(req->buf, config->descriptors[0], value);
> +                     }
> +                     break;
>               }
>               break;
>  
> -- 
> 1.9.1
> 

Acked-by: Peter Chen <peter.c...@freescale.com>

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to