All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Paul Elder <paul.elder@ideasonboard.com>,
	linux-usb@vger.kernel.org, balbi@kernel.org,
	Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: usb: gadget: uvc: Utilise instance name in video name
Date: Tue, 22 May 2018 22:05:35 +0300	[thread overview]
Message-ID: <1989145.WBc39oRrPU@avalon> (raw)

Hi Kieran,

Thank you for the patch.

On Tuesday, 22 May 2018 18:29:49 EEST Kieran Bingham wrote:
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> With multiple UVC gadgets on a composite device, the device names become
> indistinguishable from one another.
> 
> Extend the gadget video name to incorporate the function instance name,
> along side the existing UDC controller name.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  drivers/usb/gadget/function/f_uvc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_uvc.c
> b/drivers/usb/gadget/function/f_uvc.c index 1affa8e3a974..65454a31ad68
> 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -433,7 +433,9 @@ uvc_register_video(struct uvc_device *uvc)
>  	uvc->vdev.release = video_device_release_empty;
>  	uvc->vdev.vfl_dir = VFL_DIR_TX;
>  	uvc->vdev.lock = &uvc->video.mutex;
> -	strlcpy(uvc->vdev.name, cdev->gadget->name, sizeof(uvc->vdev.name));
> +
> +	snprintf(uvc->vdev.name, sizeof(uvc->vdev.name), "%s:%s",
> +		 cdev->gadget->name, uvc->func.fi->group.cg_item.ci_name);

If the function is instantiated from the legacy g_webcam, the whole group 
structure will be zero, so ci_name will be empty. I think you should omit the 
":" in that case.

I also wonder whether the vdev.name field will always be long enough. If we 
can't guarantee that, would it make sense to instead expose the config item 
name through a custom sysfs property for the video device ?

>  	video_set_drvdata(&uvc->vdev, uvc);

             reply	other threads:[~2018-05-22 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 19:05 Laurent Pinchart [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-22 15:29 usb: gadget: uvc: Utilise instance name in video name Kieran Bingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1989145.WBc39oRrPU@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=balbi@kernel.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=paul.elder@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.