summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/webcam.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-09-06 22:11:21 +0400
committerFelipe Balbi <balbi@ti.com>2012-09-10 17:13:00 +0400
commit276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91 (patch)
tree5a3d0689815314e2fab55a8c9e0a99d6853c31bd /drivers/usb/gadget/webcam.c
parent7d16e8d3eb704f5f6eb5a271d5758b495634e8e6 (diff)
downloadlinux-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/webcam.c')
-rw-r--r--drivers/usb/gadget/webcam.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c
index 306006419f38..03591194b17a 100644
--- a/drivers/usb/gadget/webcam.c
+++ b/drivers/usb/gadget/webcam.c
@@ -45,13 +45,12 @@ static char webcam_config_label[] = "Video";
/* string IDs are assigned dynamically */
-#define STRING_MANUFACTURER_IDX 0
-#define STRING_PRODUCT_IDX 1
-#define STRING_DESCRIPTION_IDX 2
+#define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX
static struct usb_string webcam_strings[] = {
- [STRING_MANUFACTURER_IDX].s = webcam_vendor_label,
- [STRING_PRODUCT_IDX].s = webcam_product_label,
+ [USB_GADGET_MANUFACTURER_IDX].s = webcam_vendor_label,
+ [USB_GADGET_PRODUCT_IDX].s = webcam_product_label,
+ [USB_GADGET_SERIAL_IDX].s = "",
[STRING_DESCRIPTION_IDX].s = webcam_config_label,
{ }
};
@@ -360,9 +359,9 @@ webcam_bind(struct usb_composite_dev *cdev)
if (ret < 0)
goto error;
webcam_device_descriptor.iManufacturer =
- webcam_strings[STRING_MANUFACTURER_IDX].id;
+ webcam_strings[USB_GADGET_MANUFACTURER_IDX].id;
webcam_device_descriptor.iProduct =
- webcam_strings[STRING_PRODUCT_IDX].id;
+ webcam_strings[USB_GADGET_PRODUCT_IDX].id;
webcam_config_driver.iConfiguration =
webcam_strings[STRING_DESCRIPTION_IDX].id;