All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: Dan Vacura <w36195@motorola.com>
Cc: linux-usb@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Felipe Balbi <balbi@kernel.org>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Carlos Bilbao <bilbao@vt.edu>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v2] usb: gadget: uvc: allow changing interface name via configfs
Date: Sat, 2 Apr 2022 12:24:23 +0100	[thread overview]
Message-ID: <YkgyZ6BrSX/7pDry@donbot> (raw)
In-Reply-To: <20220401160447.5919-1-w36195@motorola.com>

On Fri, Apr 01, 2022 at 11:04:45AM -0500, Dan Vacura wrote:
> Add a configfs entry, "function_name", to change the iInterface field
> for VideoControl. This name is used on host devices for user selection,
> useful when multiple cameras are present. The default will remain "UVC
> Camera".

> diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
> index 71bb5e477dba..50e6e7a58b41 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -44,7 +44,7 @@ MODULE_PARM_DESC(trace, "Trace level bitmask");
>  #define UVC_STRING_STREAMING_IDX		1
>  
>  static struct usb_string uvc_en_us_strings[] = {
> -	[UVC_STRING_CONTROL_IDX].s = "UVC Camera",
> +	/* [UVC_STRING_CONTROL_IDX].s = DYNAMIC, */
>  	[UVC_STRING_STREAMING_IDX].s = "Video Streaming",
>  	{  }
>  };
> @@ -676,6 +676,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
>  	uvc_hs_streaming_ep.bEndpointAddress = uvc->video.ep->address;
>  	uvc_ss_streaming_ep.bEndpointAddress = uvc->video.ep->address;
>  
> +	uvc_en_us_strings[UVC_STRING_CONTROL_IDX].s = opts->function_name;
>  	us = usb_gstrings_attach(cdev, uvc_function_strings,
>  				 ARRAY_SIZE(uvc_en_us_strings));
>  	if (IS_ERR(us)) {
> @@ -866,6 +867,7 @@ static struct usb_function_instance *uvc_alloc_inst(void)
>  
>  	opts->streaming_interval = 1;
>  	opts->streaming_maxpacket = 1024;
> +	snprintf(opts->function_name, sizeof(opts->function_name), "UVC Camera");

This only allows a single language to be specified.  I know that's what
the existing string uses, but for other strings which can be set by
userspace multiple languages are supported.

Should we be making USB_CONFIG_STRINGS_LANG more generic so that it can
be used by functions as well as the core configfs code?

  reply	other threads:[~2022-04-02 11:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 16:04 [PATCH v2] usb: gadget: uvc: allow changing interface name via configfs Dan Vacura
2022-04-02 11:24 ` John Keeping [this message]
2022-04-04 21:52   ` Dan Vacura
2022-04-03  6:13 ` Bagas Sanjaya
2022-04-04 20:17   ` Dan Vacura

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=YkgyZ6BrSX/7pDry@donbot \
    --to=john@metanate.com \
    --cc=balbi@kernel.org \
    --cc=bilbao@vt.edu \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=w36195@motorola.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.