aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ncm.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/ncm.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/ncm.c')
-rw-r--r--drivers/usb/gadget/ncm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/usb/gadget/ncm.c b/drivers/usb/gadget/ncm.c
index 8537cd9c6aff..1a26452ce4ca 100644
--- a/drivers/usb/gadget/ncm.c
+++ b/drivers/usb/gadget/ncm.c
@@ -97,15 +97,12 @@ static const struct usb_descriptor_header *otg_desc[] = {
97 97
98 98
99/* string IDs are assigned dynamically */ 99/* string IDs are assigned dynamically */
100
101#define STRING_MANUFACTURER_IDX 0
102#define STRING_PRODUCT_IDX 1
103
104static char manufacturer[50]; 100static char manufacturer[50];
105 101
106static struct usb_string strings_dev[] = { 102static struct usb_string strings_dev[] = {
107 [STRING_MANUFACTURER_IDX].s = manufacturer, 103 [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
108 [STRING_PRODUCT_IDX].s = DRIVER_DESC, 104 [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
105 [USB_GADGET_SERIAL_IDX].s = "",
109 { } /* end of list */ 106 { } /* end of list */
110}; 107};
111 108
@@ -184,8 +181,8 @@ static int __init gncm_bind(struct usb_composite_dev *cdev)
184 status = usb_string_ids_tab(cdev, strings_dev); 181 status = usb_string_ids_tab(cdev, strings_dev);
185 if (status < 0) 182 if (status < 0)
186 goto fail; 183 goto fail;
187 device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; 184 device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
188 device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; 185 device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
189 186
190 status = usb_add_config(cdev, &ncm_config_driver, 187 status = usb_add_config(cdev, &ncm_config_driver,
191 ncm_do_config); 188 ncm_do_config);