aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-09-10 09:01:56 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-10 09:13:01 -0400
commit2d35ee47aaafac152bc4bc5020660ffa1753ab02 (patch)
treeea95206a5e772602b3e46de8e486d2c6a934db40 /drivers/usb/gadget/composite.c
parent03de9bf69c589b71c43aa52b838690cb477903c9 (diff)
usb: gadget: push iProduct into gadgets
This patch pushes the iProduct module argument from composite into each gadget. 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/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 482cf8cf301d..47b9130968bc 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -28,14 +28,6 @@
28 * with the relevant device-wide data. 28 * with the relevant device-wide data.
29 */ 29 */
30 30
31/* Some systems will need runtime overrides for the product identifiers
32 * published in the device descriptor, either numbers or strings or both.
33 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
34 */
35static char *iProduct;
36module_param(iProduct, charp, S_IRUGO);
37MODULE_PARM_DESC(iProduct, "USB Product string");
38
39static char composite_manufacturer[50]; 31static char composite_manufacturer[50];
40 32
41/*-------------------------------------------------------------------------*/ 33/*-------------------------------------------------------------------------*/
@@ -914,7 +906,7 @@ static int get_string(struct usb_composite_dev *cdev,
914 if (cdev->manufacturer_override == id) 906 if (cdev->manufacturer_override == id)
915 str = composite->iManufacturer ?: composite_manufacturer; 907 str = composite->iManufacturer ?: composite_manufacturer;
916 else if (cdev->product_override == id) 908 else if (cdev->product_override == id)
917 str = iProduct ?: composite->iProduct; 909 str = composite->iProduct;
918 else if (cdev->serial_override == id) 910 else if (cdev->serial_override == id)
919 str = composite->iSerialNumber; 911 str = composite->iSerialNumber;
920 else 912 else
@@ -1404,6 +1396,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1404 __le16 bcdDevice; 1396 __le16 bcdDevice;
1405 u8 iSerialNumber; 1397 u8 iSerialNumber;
1406 u8 iManufacturer; 1398 u8 iManufacturer;
1399 u8 iProduct;
1407 1400
1408 /* 1401 /*
1409 * these variables may have been set in 1402 * these variables may have been set in
@@ -1414,6 +1407,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1414 bcdDevice = new->bcdDevice; 1407 bcdDevice = new->bcdDevice;
1415 iSerialNumber = new->iSerialNumber; 1408 iSerialNumber = new->iSerialNumber;
1416 iManufacturer = new->iManufacturer; 1409 iManufacturer = new->iManufacturer;
1410 iProduct = new->iProduct;
1417 1411
1418 *new = *old; 1412 *new = *old;
1419 if (idVendor) 1413 if (idVendor)
@@ -1426,6 +1420,8 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1426 new->iSerialNumber = iSerialNumber; 1420 new->iSerialNumber = iSerialNumber;
1427 if (iManufacturer) 1421 if (iManufacturer)
1428 new->iManufacturer = iManufacturer; 1422 new->iManufacturer = iManufacturer;
1423 if (iProduct)
1424 new->iProduct = iProduct;
1429} 1425}
1430 1426
1431static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv) 1427static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv)
@@ -1499,7 +1495,7 @@ static int composite_bind(struct usb_gadget *gadget,
1499 override_id(cdev, &cdev->desc.iManufacturer); 1495 override_id(cdev, &cdev->desc.iManufacturer);
1500 } 1496 }
1501 1497
1502 if (iProduct || (!cdev->desc.iProduct && composite->iProduct)) 1498 if (!cdev->desc.iProduct && composite->iProduct)
1503 cdev->product_override = 1499 cdev->product_override =
1504 override_id(cdev, &cdev->desc.iProduct); 1500 override_id(cdev, &cdev->desc.iProduct);
1505 1501
@@ -1708,4 +1704,9 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
1708 desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id; 1704 desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
1709 dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer; 1705 dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer;
1710 } 1706 }
1707
1708 if (covr->product) {
1709 desc->iProduct = dev_str[USB_GADGET_PRODUCT_IDX].id;
1710 dev_str[USB_GADGET_PRODUCT_IDX].s = covr->product;
1711 }
1711} 1712}