summaryrefslogtreecommitdiffstats
path: root/include/linux/usb/gadget.h
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 21:10:22 +0100
committerFelipe Balbi <balbi@ti.com>2013-01-21 19:52:48 +0100
commit9bb2859f8a8dbc9b42f3100641dd0ae80cfbe86a (patch)
treef40927a9dcdc92325a30261f61b034084d3f6010 /include/linux/usb/gadget.h
parentusb: gadget: export composite's setup & disconnect function (diff)
downloadlinux-9bb2859f8a8dbc9b42f3100641dd0ae80cfbe86a.tar.xz
linux-9bb2859f8a8dbc9b42f3100641dd0ae80cfbe86a.zip
usb: gadget: composite: introduce usb_gstrings_attach()
The USB strings don't (yet) fully work in multiple configs/gadget environment. The string id is assigned to the descriptor and the struct usb_strings. We create a copy of the individual descriptor so we don't clash if we use a function more than once. However, we have only one struct usb_string for each string. Currently each function which is used multiple times checks for "id != 0" and only assigns string ids if it did not happen yet. This works well if we use the same function multiple times as long as we do it within the "one" gadget we have. Trouble starts once we use the same function in a second gadget. In order to solve this I introduce usb_gstrings_attach(). This function will crate a copy all structs except for the strings which are not copied. After the copy it will assign USB ids and attach it to cdev. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to '')
-rw-r--r--include/linux/usb/gadget.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 62156701e4f1..e4c119ee4ebe 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -913,6 +913,11 @@ struct usb_gadget_strings {
struct usb_string *strings;
};
+struct usb_gadget_string_container {
+ struct list_head list;
+ u8 *stash[0];
+};
+
/* put descriptor for string with that id into buf (buflen >= 256) */
int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);