diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-09-06 14:11:21 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 09:13:00 -0400 |
commit | 276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91 (patch) | |
tree | 5a3d0689815314e2fab55a8c9e0a99d6853c31bd /drivers/usb/gadget/g_ffs.c | |
parent | 7d16e8d3eb704f5f6eb5a271d5758b495634e8e6 (diff) |
usb: gadget: make sure each gadget is using same index for Product, Serial,…
The index in usb_string array is defined by the gadget. The gadget can
choose which index entry it assigns for the serial number and which the
product name. The gadget has just to ensure that the descriptor contains
the proper string id which is assigned by composite.
If the composite layer knows the index of the "default" information
which will be overwritten by module parameters, it can be used later to
overwrite it.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/g_ffs.c')
-rw-r--r-- | drivers/usb/gadget/g_ffs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index a44ed661c16b..16d18873ebeb 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -116,6 +116,9 @@ static const struct usb_descriptor_header *gfs_otg_desc[] = { | |||
116 | 116 | ||
117 | /* String IDs are assigned dynamically */ | 117 | /* String IDs are assigned dynamically */ |
118 | static struct usb_string gfs_strings[] = { | 118 | static struct usb_string gfs_strings[] = { |
119 | [USB_GADGET_MANUFACTURER_IDX].s = "", | ||
120 | [USB_GADGET_PRODUCT_IDX].s = "", | ||
121 | [USB_GADGET_SERIAL_IDX].s = "", | ||
119 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS | 122 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS |
120 | { .s = "FunctionFS + RNDIS" }, | 123 | { .s = "FunctionFS + RNDIS" }, |
121 | #endif | 124 | #endif |
@@ -369,9 +372,10 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
369 | 372 | ||
370 | for (i = 0; i < ARRAY_SIZE(gfs_configurations); ++i) { | 373 | for (i = 0; i < ARRAY_SIZE(gfs_configurations); ++i) { |
371 | struct gfs_configuration *c = gfs_configurations + i; | 374 | struct gfs_configuration *c = gfs_configurations + i; |
375 | int sid = USB_GADGET_FIRST_AVAIL_IDX + i; | ||
372 | 376 | ||
373 | c->c.label = gfs_strings[i].s; | 377 | c->c.label = gfs_strings[sid].s; |
374 | c->c.iConfiguration = gfs_strings[i].id; | 378 | c->c.iConfiguration = gfs_strings[sid].id; |
375 | c->c.bConfigurationValue = 1 + i; | 379 | c->c.bConfigurationValue = 1 + i; |
376 | c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; | 380 | c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; |
377 | 381 | ||