aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/serial.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-09-06 14:11:21 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-10 09:13:00 -0400
commit276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91 (patch)
tree5a3d0689815314e2fab55a8c9e0a99d6853c31bd /drivers/usb/gadget/serial.c
parent7d16e8d3eb704f5f6eb5a271d5758b495634e8e6 (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/serial.c')
-rw-r--r--drivers/usb/gadget/serial.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 27b5ce939bdb..768a38e896f7 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -59,15 +59,14 @@ USB_GADGET_COMPOSITE_OPTIONS();
59 59
60/* string IDs are assigned dynamically */ 60/* string IDs are assigned dynamically */
61 61
62#define STRING_MANUFACTURER_IDX 0 62#define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX
63#define STRING_PRODUCT_IDX 1
64#define STRING_DESCRIPTION_IDX 2
65 63
66static char manufacturer[50]; 64static char manufacturer[50];
67 65
68static struct usb_string strings_dev[] = { 66static struct usb_string strings_dev[] = {
69 [STRING_MANUFACTURER_IDX].s = manufacturer, 67 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
70 [STRING_PRODUCT_IDX].s = GS_VERSION_NAME, 68 [USB_GADGET_PRODUCT_IDX].s = GS_VERSION_NAME,
69 [USB_GADGET_SERIAL_IDX].s = "",
71 [STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */, 70 [STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */,
72 { } /* end of list */ 71 { } /* end of list */
73}; 72};
@@ -179,8 +178,8 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
179 status = usb_string_ids_tab(cdev, strings_dev); 178 status = usb_string_ids_tab(cdev, strings_dev);
180 if (status < 0) 179 if (status < 0)
181 goto fail; 180 goto fail;
182 device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; 181 device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
183 device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; 182 device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
184 status = strings_dev[STRING_DESCRIPTION_IDX].id; 183 status = strings_dev[STRING_DESCRIPTION_IDX].id;
185 serial_config_driver.iConfiguration = status; 184 serial_config_driver.iConfiguration = status;
186 185