From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Peter Boström" <pbos@google.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v4] [media] uvcvideo: Add iFunction or iInterface to device names.
Date: Thu, 20 Apr 2017 00:42:42 +0300 [thread overview]
Message-ID: <4928224.bcUm3SHKWn@avalon> (raw)
In-Reply-To: <20170419204527.113504-1-pbos@google.com>
Hi Peter,
Thank you for the patch.
On Wednesday 19 Apr 2017 16:45:27 Peter Boström wrote:
> Permits distinguishing between two /dev/videoX entries from the same
> physical UVC device (that naturally share the same iProduct name).
>
> This change matches current Windows behavior by prioritizing iFunction
> over iInterface, but unlike Windows it displays both iProduct and
> iFunction/iInterface strings when both are available.
>
> Signed-off-by: Peter Boström <pbos@google.com>
> ---
> drivers/media/usb/uvc/uvc_driver.c | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c
> b/drivers/media/usb/uvc/uvc_driver.c index 04bf35063c4c..ae22fcf0a529
> 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1998,6 +1998,7 @@ static int uvc_probe(struct usb_interface *intf,
> {
> struct usb_device *udev = interface_to_usbdev(intf);
> struct uvc_device *dev;
> + int function;
> int ret;
>
> if (id->idVendor && id->idProduct)
> @@ -2029,9 +2030,26 @@ static int uvc_probe(struct usb_interface *intf,
> strlcpy(dev->name, udev->product, sizeof dev->name);
> else
> snprintf(dev->name, sizeof dev->name,
> - "UVC Camera (%04x:%04x)",
> - le16_to_cpu(udev->descriptor.idVendor),
> - le16_to_cpu(udev->descriptor.idProduct));
> + "UVC Camera (%04x:%04x)",
> + le16_to_cpu(udev->descriptor.idVendor),
> + le16_to_cpu(udev->descriptor.idProduct));
> +
> + /*
> + * Add iFunction or iInterface to names when available as additional
> + * distinguishers between interfaces. iFunction is prioritized over
> + * iInterface which matches Windows behavior at the point of writing.
> + */
> + function = intf->cur_altsetting->desc.iInterface;
> + if (intf->intf_assoc && intf->intf_assoc->iFunction != 0)
> + function = intf->intf_assoc->iFunction;
Nitpicking, I'd prefer writing this as
if (intf->intf_assoc && intf->intf_assoc->iFunction != 0)
function = intf->intf_assoc->iFunction;
else
function = intf->cur_altsetting->desc.iInterface;
to clearly show what is the preferred case and what is the fallback. I'll fix
that when applying, no need to resubmit the patch.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + if (function != 0) {
> + size_t len;
> +
> + strlcat(dev->name, ": ", sizeof(dev->name));
> + len = strlen(dev->name);
> + usb_string(udev, function, dev->name + len,
> + sizeof(dev->name) - len);
> + }
>
> /* Parse the Video Class control descriptor. */
> if (uvc_parse_control(dev) < 0) {
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2017-04-19 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 20:45 [PATCH v4] [media] uvcvideo: Add iFunction or iInterface to device names Peter Boström
2017-04-19 21:42 ` Laurent Pinchart [this message]
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=4928224.bcUm3SHKWn@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=pbos@google.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.