All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Scally <dan.scally@ideasonboard.com>
To: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
	laurent.pinchart@ideasonboard.com
Cc: mgr@pengutronix.de, balbi@kernel.org,
	kieran.bingham@ideasonboard.com, torleiv@huddly.com,
	stern@rowland.harvard.edu,
	Daniel Scally <dan.scally@ideasonboard.com>
Subject: [PATCH v4 09/11] usb: gadget: uvc: Pick up custom string descriptor IDs
Date: Thu,  2 Feb 2023 13:55:06 +0000	[thread overview]
Message-ID: <20230202135508.447109-10-dan.scally@ideasonboard.com> (raw)
In-Reply-To: <20230202135508.447109-1-dan.scally@ideasonboard.com>

If any custom string descriptors have been linked to from the
extension unit, pick up the string ID that was returned when
the strings were attached to the composite dev and use it to
set the iExtension field of the Extension Unit Descriptor.

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
Changes in v4:

	- None

Changes in v3:

	- New patch

 drivers/usb/gadget/function/f_uvc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 45a17ecc2ad0..14e1aed52124 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -644,6 +644,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
 {
 	struct usb_composite_dev *cdev = c->cdev;
 	struct uvc_device *uvc = to_uvc(f);
+	struct uvcg_extension *xu;
 	struct usb_string *us;
 	unsigned int max_packet_mult;
 	unsigned int max_packet_size;
@@ -736,6 +737,14 @@ 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;
 
+	/*
+	 * XUs can have an arbitrary string descriptor describing them. If they
+	 * have one pick up the ID.
+	 */
+	list_for_each_entry(xu, &opts->extension_units, list)
+		if (xu->string_descriptor_index)
+			xu->desc.iExtension = cdev->usb_strings[xu->string_descriptor_index].id;
+
 	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));
-- 
2.34.1


  parent reply	other threads:[~2023-02-02 13:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 13:54 [PATCH v4 00/11] Add XU support to UVC Gadget Daniel Scally
2023-02-02 13:54 ` [PATCH v4 01/11] usb: gadget: uvc: Make bSourceID read/write Daniel Scally
2023-02-02 13:54 ` [PATCH v4 02/11] usb: gadget: uvc: Generalise helper functions for reuse Daniel Scally
2023-02-02 13:55 ` [PATCH v4 03/11] usb: gadget: uvc: Allow definition of XUs in configfs Daniel Scally
2023-02-02 13:55 ` [PATCH v4 04/11] usb: gadget: uvc: Copy XU descriptors during .bind() Daniel Scally
2023-02-02 13:55 ` [PATCH v4 05/11] usb: gadget: configfs: Rename struct gadget_strings Daniel Scally
2023-02-02 13:55 ` [PATCH v4 06/11] usb: gadget: configfs: Support arbitrary string descriptors Daniel Scally
2023-02-02 13:55 ` [PATCH v4 07/11] usb: gadget: configfs: Attach arbitrary strings to cdev Daniel Scally
2023-02-02 13:55 ` [PATCH v4 08/11] usb: gadget: uvc: Allow linking XUs to string descriptors Daniel Scally
2023-02-02 13:55 ` Daniel Scally [this message]
2023-02-02 13:55 ` [PATCH v4 10/11] usb: gadget: uvc: Allow linking function to string descs Daniel Scally
2023-02-02 13:55 ` [PATCH v4 11/11] usb: gadget: uvc: Use custom strings if available Daniel Scally
2023-02-06 10:02 ` [PATCH v4 00/11] Add XU support to UVC Gadget Greg KH
2023-02-06 10:24   ` Dan Scally
2023-02-06 10:29     ` Greg KH
2023-02-06 10:54       ` Dan Scally

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=20230202135508.447109-10-dan.scally@ideasonboard.com \
    --to=dan.scally@ideasonboard.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mgr@pengutronix.de \
    --cc=stern@rowland.harvard.edu \
    --cc=torleiv@huddly.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.