[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140827191756.GF6347@saruman.home>
Date: Wed, 27 Aug 2014 14:17:56 -0500
From: Felipe Balbi <balbi@...com>
To: Robert Baldyga <r.baldyga@...sung.com>
CC: <balbi@...com>, <gregkh@...uxfoundation.org>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<mina86@...a86.com>, <m.szyprowski@...sung.com>,
<andrzej.p@...sung.com>, <k.opasiak@...sung.com>
Subject: Re: [PATCH v6 2/3] usb: gadget: f_fs: add ioctl returning ep
descriptor
Hi,
On Mon, Aug 25, 2014 at 11:16:28AM +0200, Robert Baldyga wrote:
> This patch introduces ioctl named FUNCTIONFS_ENDPOINT_DESC, which
> returns endpoint descriptor to userspace. It works only if function
> is active.
>
> Signed-off-by: Robert Baldyga <r.baldyga@...sung.com>
> Acked-by: Michal Nazarewicz <mina86@...a86.com>
> ---
> drivers/usb/gadget/function/f_fs.c | 23 +++++++++++++++++++++++
> include/uapi/linux/usb/functionfs.h | 6 ++++++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index 0dc3552d..6edf7e4 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -1032,6 +1032,29 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
> case FUNCTIONFS_ENDPOINT_REVMAP:
> ret = epfile->ep->num;
> break;
> + case FUNCTIONFS_ENDPOINT_DESC:
> + {
> + int desc_idx;
> + struct usb_endpoint_descriptor *desc;
> +
> + switch (epfile->ffs->gadget->speed) {
> + case USB_SPEED_SUPER:
> + desc_idx = 2;
> + break;
> + case USB_SPEED_HIGH:
> + desc_idx = 1;
> + break;
> + default:
> + desc_idx = 0;
> + }
> + desc = epfile->ep->descs[desc_idx];
> +
> + spin_unlock_irq(&epfile->ffs->eps_lock);
> + ret = copy_to_user((void *)value, desc, sizeof(*desc));
> + if (ret)
> + ret = -EFAULT;
> + return;
should return a value here. Have you tested this at all ?
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists