summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/printer.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-09-06 20:11:21 +0200
committerFelipe Balbi <balbi@ti.com>2012-09-10 16:13:00 +0300
commit276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91 (patch)
tree5a3d0689815314e2fab55a8c9e0a99d6853c31bd /drivers/usb/gadget/printer.c
parent7d16e8d3eb704f5f6eb5a271d5758b495634e8e6 (diff)
downloadop-kernel-dev-276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91.zip
op-kernel-dev-276e2e4f1f3e07a0ad891bf757dbcfd655ff5f91.tar.gz
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/printer.c')
-rw-r--r--drivers/usb/gadget/printer.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 3fa4d80..f02434a 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -139,10 +139,6 @@ module_param(qlen, uint, S_IRUGO|S_IWUSR);
* descriptors are built on demand.
*/
-#define STRING_MANUFACTURER 0
-#define STRING_PRODUCT 1
-#define STRING_SERIALNUM 2
-
/* holds our biggest descriptor */
#define USB_DESC_BUFSIZE 256
#define USB_BUFSIZE 8192
@@ -250,9 +246,9 @@ static char pnp_string [1024] =
/* static strings, in UTF-8 */
static struct usb_string strings [] = {
- [STRING_MANUFACTURER].s = manufacturer,
- [STRING_PRODUCT].s = product_desc,
- [STRING_SERIALNUM].s = serial_num,
+ [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_PRODUCT_IDX].s = product_desc,
+ [USB_GADGET_SERIAL_IDX].s = serial_num,
{ } /* end of list */
};
@@ -1261,9 +1257,9 @@ static int __init printer_bind(struct usb_composite_dev *cdev)
ret = usb_string_ids_tab(cdev, strings);
if (ret < 0)
return ret;
- device_desc.iManufacturer = strings[STRING_MANUFACTURER].id;
- device_desc.iProduct = strings[STRING_PRODUCT].id;
- device_desc.iSerialNumber = strings[STRING_SERIALNUM].id;
+ device_desc.iManufacturer = strings[USB_GADGET_MANUFACTURER_IDX].id;
+ device_desc.iProduct = strings[USB_GADGET_PRODUCT_IDX].id;
+ device_desc.iSerialNumber = strings[USB_GADGET_SERIAL_IDX].id;
ret = usb_add_config(cdev, &printer_cfg_driver, printer_bind_config);
if (ret)
OpenPOWER on IntegriCloud