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/hid.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/hid.c')
-rw-r--r-- | drivers/usb/gadget/hid.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c index 59fe7eef00da..16caf50e916d 100644 --- a/drivers/usb/gadget/hid.c +++ b/drivers/usb/gadget/hid.c | |||
@@ -91,15 +91,12 @@ static const struct usb_descriptor_header *otg_desc[] = { | |||
91 | 91 | ||
92 | 92 | ||
93 | /* string IDs are assigned dynamically */ | 93 | /* string IDs are assigned dynamically */ |
94 | |||
95 | #define STRING_MANUFACTURER_IDX 0 | ||
96 | #define STRING_PRODUCT_IDX 1 | ||
97 | |||
98 | static char manufacturer[50]; | 94 | static char manufacturer[50]; |
99 | 95 | ||
100 | static struct usb_string strings_dev[] = { | 96 | static struct usb_string strings_dev[] = { |
101 | [STRING_MANUFACTURER_IDX].s = manufacturer, | 97 | [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, |
102 | [STRING_PRODUCT_IDX].s = DRIVER_DESC, | 98 | [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, |
99 | [USB_GADGET_SERIAL_IDX].s = "", | ||
103 | { } /* end of list */ | 100 | { } /* end of list */ |
104 | }; | 101 | }; |
105 | 102 | ||
@@ -181,8 +178,8 @@ static int __init hid_bind(struct usb_composite_dev *cdev) | |||
181 | status = usb_string_ids_tab(cdev, strings_dev); | 178 | status = usb_string_ids_tab(cdev, strings_dev); |
182 | if (status < 0) | 179 | if (status < 0) |
183 | return status; | 180 | return status; |
184 | device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; | 181 | device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; |
185 | device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; | 182 | device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; |
186 | 183 | ||
187 | /* register our configuration */ | 184 | /* register our configuration */ |
188 | status = usb_add_config(cdev, &config_driver, do_config); | 185 | status = usb_add_config(cdev, &config_driver, do_config); |