diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-09-06 22:11:21 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 17:13:00 +0400 |
commit | 276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91 (patch) | |
tree | 5a3d0689815314e2fab55a8c9e0a99d6853c31bd /drivers/usb/gadget/acm_ms.c | |
parent | 7d16e8d3eb704f5f6eb5a271d5758b495634e8e6 (diff) | |
download | linux-276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91.tar.xz |
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/acm_ms.c')
-rw-r--r-- | drivers/usb/gadget/acm_ms.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index 7bd6b71af5d3..35db6aa57281 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -90,14 +90,12 @@ static const struct usb_descriptor_header *otg_desc[] = { /* string IDs are assigned dynamically */ -#define STRING_MANUFACTURER_IDX 0 -#define STRING_PRODUCT_IDX 1 - static char manufacturer[50]; static struct usb_string strings_dev[] = { - [STRING_MANUFACTURER_IDX].s = manufacturer, - [STRING_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_SERIAL_IDX].s = "", { } /* end of list */ }; @@ -196,8 +194,8 @@ static int __init acm_ms_bind(struct usb_composite_dev *cdev) status = usb_string_ids_tab(cdev, strings_dev); if (status < 0) goto fail1; - device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; - device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; + device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; + device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; /* register our configuration */ status = usb_add_config(cdev, &acm_ms_config_driver, acm_ms_do_config); |