aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/gmidi.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/gmidi.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/gmidi.c')
-rw-r--r--drivers/usb/gadget/gmidi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index 01b31e2d03af..2ee3a74056c9 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -84,9 +84,7 @@ MODULE_PARM_DESC(out_ports, "Number of MIDI output ports");
84 84
85/* string IDs are assigned dynamically */ 85/* string IDs are assigned dynamically */
86 86
87#define STRING_MANUFACTURER_IDX 0 87#define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX
88#define STRING_PRODUCT_IDX 1
89#define STRING_DESCRIPTION_IDX 2
90 88
91static struct usb_device_descriptor device_desc = { 89static struct usb_device_descriptor device_desc = {
92 .bLength = USB_DT_DEVICE_SIZE, 90 .bLength = USB_DT_DEVICE_SIZE,
@@ -101,8 +99,9 @@ static struct usb_device_descriptor device_desc = {
101}; 99};
102 100
103static struct usb_string strings_dev[] = { 101static struct usb_string strings_dev[] = {
104 [STRING_MANUFACTURER_IDX].s = "Grey Innovation", 102 [USB_GADGET_MANUFACTURER_IDX].s = "Grey Innovation",
105 [STRING_PRODUCT_IDX].s = "MIDI Gadget", 103 [USB_GADGET_PRODUCT_IDX].s = "MIDI Gadget",
104 [USB_GADGET_SERIAL_IDX].s = "",
106 [STRING_DESCRIPTION_IDX].s = "MIDI", 105 [STRING_DESCRIPTION_IDX].s = "MIDI",
107 { } /* end of list */ 106 { } /* end of list */
108}; 107};
@@ -145,8 +144,8 @@ static int __init midi_bind(struct usb_composite_dev *cdev)
145 status = usb_string_ids_tab(cdev, strings_dev); 144 status = usb_string_ids_tab(cdev, strings_dev);
146 if (status < 0) 145 if (status < 0)
147 return status; 146 return status;
148 device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; 147 device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
149 device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; 148 device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
150 midi_config.iConfiguration = strings_dev[STRING_DESCRIPTION_IDX].id; 149 midi_config.iConfiguration = strings_dev[STRING_DESCRIPTION_IDX].id;
151 150
152 gcnum = usb_gadget_controller_number(gadget); 151 gcnum = usb_gadget_controller_number(gadget);