aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/composite.h
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 15:10:22 -0500
committerFelipe Balbi <balbi@ti.com>2013-01-21 13:52:48 -0500
commit9bb2859f8a8dbc9b42f3100641dd0ae80cfbe86a (patch)
treef40927a9dcdc92325a30261f61b034084d3f6010 /include/linux/usb/composite.h
parent2d5a88990260d226a69acddf22c04f47c267b33a (diff)
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 'include/linux/usb/composite.h')
-rw-r--r--include/linux/usb/composite.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index a212ec3e9d69..3c671c1b37f6 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -375,6 +375,7 @@ struct usb_composite_dev {
375 unsigned int suspended:1; 375 unsigned int suspended:1;
376 struct usb_device_descriptor desc; 376 struct usb_device_descriptor desc;
377 struct list_head configs; 377 struct list_head configs;
378 struct list_head gstrings;
378 struct usb_composite_driver *driver; 379 struct usb_composite_driver *driver;
379 u8 next_string_id; 380 u8 next_string_id;
380 char *def_manufacturer; 381 char *def_manufacturer;
@@ -396,6 +397,9 @@ struct usb_composite_dev {
396extern int usb_string_id(struct usb_composite_dev *c); 397extern int usb_string_id(struct usb_composite_dev *c);
397extern int usb_string_ids_tab(struct usb_composite_dev *c, 398extern int usb_string_ids_tab(struct usb_composite_dev *c,
398 struct usb_string *str); 399 struct usb_string *str);
400extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev,
401 struct usb_gadget_strings **sp, unsigned n_strings);
402
399extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); 403extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
400 404
401extern void composite_disconnect(struct usb_gadget *gadget); 405extern void composite_disconnect(struct usb_gadget *gadget);