summaryrefslogtreecommitdiffstats
path: root/include/linux/usb/gadget.h
diff options
context:
space:
mode:
authorDaniel Scally <dan.scally@ideasonboard.com>2023-02-06 16:17:57 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-07 08:46:36 +0100
commit15a7cf8caabee4613764abe7814dd3162cb64137 (patch)
tree1152eea6bfffa3025c5cd354c064138ddce46b84 /include/linux/usb/gadget.h
parent6e2a512d9532c51889a2601cba338c4673a09374 (diff)
downloadlinux-stable-15a7cf8caabee4613764abe7814dd3162cb64137.tar.gz
linux-stable-15a7cf8caabee4613764abe7814dd3162cb64137.tar.bz2
linux-stable-15a7cf8caabee4613764abe7814dd3162cb64137.zip
usb: gadget: configfs: Support arbitrary string descriptors
Add a framework to allow users to define arbitrary string descriptors for a USB Gadget. This is modelled as a new type of config item rather than as hardcoded attributes so as to be as flexible as possible. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Link: https://lore.kernel.org/r/20230206161802.892954-7-dan.scally@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb/gadget.h')
-rw-r--r--include/linux/usb/gadget.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index dc3092cea99e..00750f7020f3 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -15,6 +15,7 @@
#ifndef __LINUX_USB_GADGET_H
#define __LINUX_USB_GADGET_H
+#include <linux/configfs.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/init.h>
@@ -821,6 +822,16 @@ int usb_gadget_get_string(const struct usb_gadget_strings *table, int id, u8 *bu
/* check if the given language identifier is valid */
bool usb_validate_langid(u16 langid);
+struct gadget_string {
+ struct config_item item;
+ struct list_head list;
+ char string[USB_MAX_STRING_LEN];
+ struct usb_string usb_string;
+};
+
+#define to_gadget_string(str_item)\
+container_of(str_item, struct gadget_string, item)
+
/*-------------------------------------------------------------------------*/
/* utility to simplify managing config descriptors */