aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/composite.c20
-rw-r--r--include/linux/usb/composite.h7
2 files changed, 17 insertions, 10 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 5642b2170541..482cf8cf301d 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -32,10 +32,6 @@
32 * published in the device descriptor, either numbers or strings or both. 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). 33 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
34 */ 34 */
35static char *iManufacturer;
36module_param(iManufacturer, charp, S_IRUGO);
37MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string");
38
39static char *iProduct; 35static char *iProduct;
40module_param(iProduct, charp, S_IRUGO); 36module_param(iProduct, charp, S_IRUGO);
41MODULE_PARM_DESC(iProduct, "USB Product string"); 37MODULE_PARM_DESC(iProduct, "USB Product string");
@@ -916,8 +912,7 @@ static int get_string(struct usb_composite_dev *cdev,
916 * check if the string has not been overridden. 912 * check if the string has not been overridden.
917 */ 913 */
918 if (cdev->manufacturer_override == id) 914 if (cdev->manufacturer_override == id)
919 str = iManufacturer ?: composite->iManufacturer ?: 915 str = composite->iManufacturer ?: composite_manufacturer;
920 composite_manufacturer;
921 else if (cdev->product_override == id) 916 else if (cdev->product_override == id)
922 str = iProduct ?: composite->iProduct; 917 str = iProduct ?: composite->iProduct;
923 else if (cdev->serial_override == id) 918 else if (cdev->serial_override == id)
@@ -1408,6 +1403,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1408 __le16 idProduct; 1403 __le16 idProduct;
1409 __le16 bcdDevice; 1404 __le16 bcdDevice;
1410 u8 iSerialNumber; 1405 u8 iSerialNumber;
1406 u8 iManufacturer;
1411 1407
1412 /* 1408 /*
1413 * these variables may have been set in 1409 * these variables may have been set in
@@ -1417,6 +1413,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1417 idProduct = new->idProduct; 1413 idProduct = new->idProduct;
1418 bcdDevice = new->bcdDevice; 1414 bcdDevice = new->bcdDevice;
1419 iSerialNumber = new->iSerialNumber; 1415 iSerialNumber = new->iSerialNumber;
1416 iManufacturer = new->iManufacturer;
1420 1417
1421 *new = *old; 1418 *new = *old;
1422 if (idVendor) 1419 if (idVendor)
@@ -1427,6 +1424,8 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
1427 new->bcdDevice = bcdDevice; 1424 new->bcdDevice = bcdDevice;
1428 if (iSerialNumber) 1425 if (iSerialNumber)
1429 new->iSerialNumber = iSerialNumber; 1426 new->iSerialNumber = iSerialNumber;
1427 if (iManufacturer)
1428 new->iManufacturer = iManufacturer;
1430} 1429}
1431 1430
1432static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv) 1431static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv)
@@ -1487,9 +1486,8 @@ static int composite_bind(struct usb_gadget *gadget,
1487 update_unchanged_dev_desc(&cdev->desc, composite->dev); 1486 update_unchanged_dev_desc(&cdev->desc, composite->dev);
1488 1487
1489 /* string overrides */ 1488 /* string overrides */
1490 if (iManufacturer || !cdev->desc.iManufacturer) { 1489 if (!cdev->desc.iManufacturer) {
1491 if (!iManufacturer && !composite->iManufacturer && 1490 if (!composite->iManufacturer)
1492 !*composite_manufacturer)
1493 snprintf(composite_manufacturer, 1491 snprintf(composite_manufacturer,
1494 sizeof composite_manufacturer, 1492 sizeof composite_manufacturer,
1495 "%s %s with %s", 1493 "%s %s with %s",
@@ -1706,4 +1704,8 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
1706 desc->iSerialNumber = dev_str[USB_GADGET_SERIAL_IDX].id; 1704 desc->iSerialNumber = dev_str[USB_GADGET_SERIAL_IDX].id;
1707 dev_str[USB_GADGET_SERIAL_IDX].s = covr->serial_number; 1705 dev_str[USB_GADGET_SERIAL_IDX].s = covr->serial_number;
1708 } 1706 }
1707 if (covr->manufacturer) {
1708 desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
1709 dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer;
1710 }
1709} 1711}
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 9d068a4be778..86553c8c3e8b 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -401,6 +401,7 @@ struct usb_composite_overwrite {
401 u16 idProduct; 401 u16 idProduct;
402 u16 bcdDevice; 402 u16 bcdDevice;
403 char *serial_number; 403 char *serial_number;
404 char *manufacturer;
404}; 405};
405#define USB_GADGET_COMPOSITE_OPTIONS() \ 406#define USB_GADGET_COMPOSITE_OPTIONS() \
406 static struct usb_composite_overwrite coverwrite; \ 407 static struct usb_composite_overwrite coverwrite; \
@@ -416,7 +417,11 @@ struct usb_composite_overwrite {
416 \ 417 \
417 module_param_named(iSerialNumber, coverwrite.serial_number, charp, \ 418 module_param_named(iSerialNumber, coverwrite.serial_number, charp, \
418 S_IRUGO); \ 419 S_IRUGO); \
419 MODULE_PARM_DESC(iSerialNumber, "SerialNumber string") 420 MODULE_PARM_DESC(iSerialNumber, "SerialNumber string"); \
421 \
422 module_param_named(iManufacturer, coverwrite.manufacturer, charp, \
423 S_IRUGO); \
424 MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string")
420 425
421void usb_composite_overwrite_options(struct usb_composite_dev *cdev, 426void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
422 struct usb_composite_overwrite *covr); 427 struct usb_composite_overwrite *covr);