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>
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index fa3137e..b56d57d 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -2210,9 +2210,9 @@
};
static struct usb_string usbg_us_strings[] = {
- [USB_G_STR_MANUFACTOR].s = "Target Manufactor",
- [USB_G_STR_PRODUCT].s = "Target Product",
- [USB_G_STR_SERIAL].s = "000000000001",
+ [USB_GADGET_MANUFACTURER_IDX].s = "Target Manufactor",
+ [USB_GADGET_PRODUCT_IDX].s = "Target Product",
+ [USB_GADGET_SERIAL_IDX].s = "000000000001",
[USB_G_STR_CONFIG].s = "default config",
[USB_G_STR_INT_UAS].s = "USB Attached SCSI",
[USB_G_STR_INT_BBB].s = "Bulk Only Transport",
@@ -2431,9 +2431,10 @@
return ret;
usbg_device_desc.iManufacturer =
- usbg_us_strings[USB_G_STR_MANUFACTOR].id;
- usbg_device_desc.iProduct = usbg_us_strings[USB_G_STR_PRODUCT].id;
- usbg_device_desc.iSerialNumber = usbg_us_strings[USB_G_STR_SERIAL].id;
+ usbg_us_strings[USB_GADGET_MANUFACTURER_IDX].id;
+ usbg_device_desc.iProduct = usbg_us_strings[USB_GADGET_PRODUCT_IDX].id;
+ usbg_device_desc.iSerialNumber =
+ usbg_us_strings[USB_GADGET_SERIAL_IDX].id;
usbg_config_driver.iConfiguration =
usbg_us_strings[USB_G_STR_CONFIG].id;