* check if the string has not been overridden.
*/
if (cdev->manufacturer_override == id)
- str = composite->iManufacturer ?: composite_manufacturer;
- else if (cdev->product_override == id)
- str = composite->iProduct;
- else if (cdev->serial_override == id)
- str = composite->iSerialNumber;
+ str = composite_manufacturer;
else
str = NULL;
if (str) {
/* string overrides */
if (!cdev->desc.iManufacturer) {
- if (!composite->iManufacturer)
- snprintf(composite_manufacturer,
- sizeof composite_manufacturer,
- "%s %s with %s",
- init_utsname()->sysname,
- init_utsname()->release,
- gadget->name);
+ snprintf(composite_manufacturer,
+ sizeof composite_manufacturer,
+ "%s %s with %s",
+ init_utsname()->sysname,
+ init_utsname()->release,
+ gadget->name);
cdev->manufacturer_override =
override_id(cdev, &cdev->desc.iManufacturer);
}
- if (!cdev->desc.iProduct && composite->iProduct)
- cdev->product_override =
- override_id(cdev, &cdev->desc.iProduct);
-
- if (composite->iSerialNumber)
- cdev->serial_override =
- override_id(cdev, &cdev->desc.iSerialNumber);
-
/* has userspace failed to provide a serial number? */
if (composite->needs_serial && !cdev->desc.iSerialNumber)
WARNING(cdev, "userspace failed to provide iSerialNumber\n");
if (!driver->name)
driver->name = "composite";
- if (!driver->iProduct)
- driver->iProduct = driver->name;
driver->gadget_driver = composite_driver_template;
gadget_driver = &driver->gadget_driver;
/* String IDs are assigned dynamically */
static struct usb_string gfs_strings[] = {
[USB_GADGET_MANUFACTURER_IDX].s = "",
- [USB_GADGET_PRODUCT_IDX].s = "",
+ [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
#ifdef CONFIG_USB_FUNCTIONFS_RNDIS
{ .s = "FunctionFS + RNDIS" },
.max_speed = USB_SPEED_HIGH,
.bind = gfs_bind,
.unbind = gfs_unbind,
- .iProduct = DRIVER_DESC,
};
static DEFINE_MUTEX(gfs_lock);
ret = usb_string_ids_tab(cdev, gfs_strings);
if (unlikely(ret < 0))
goto error;
+ gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id;
for (i = func_num; --i; ) {
ret = functionfs_bind(ffs_tab[i].ffs_data, cdev);
static struct usb_string strings_dev[] = {
[USB_GADGET_MANUFACTURER_IDX].s = "",
- [USB_GADGET_PRODUCT_IDX].s = "",
+ [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
};
status = usb_string_ids_tab(cdev, strings_dev);
if (status < 0)
return status;
+ msg_device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
status = usb_add_config(cdev, &msg_config_driver, msg_do_config);
if (status < 0)
static __refdata struct usb_composite_driver msg_driver = {
.name = "g_mass_storage",
.dev = &msg_device_desc,
- .iProduct = DRIVER_DESC,
.max_speed = USB_SPEED_SUPER,
.needs_serial = 1,
.strings = dev_strings,
static struct usb_string strings_dev[] = {
[USB_GADGET_MANUFACTURER_IDX].s = "",
- [USB_GADGET_PRODUCT_IDX].s = "",
+ [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
[MULTI_STRING_RNDIS_CONFIG_IDX].s = "Multifunction with RNDIS",
[MULTI_STRING_CDC_CONFIG_IDX].s = "Multifunction with CDC ECM",
status = usb_string_ids_tab(cdev, strings_dev);
if (unlikely(status < 0))
goto fail2;
+ device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
/* register configurations */
status = rndis_config_register(cdev);
.max_speed = USB_SPEED_HIGH,
.bind = multi_bind,
.unbind = __exit_p(multi_unbind),
- .iProduct = DRIVER_DESC,
.needs_serial = 1,
};
/**
* struct usb_composite_driver - groups configurations into a gadget
* @name: For diagnostics, identifies the driver.
- * @iProduct: Used as iProduct override if @dev->iProduct is not set.
- * If NULL value of @name is taken.
- * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is
- * not set. If NULL a default "<system> <release> with <udc>" value
- * will be used.
- * @iSerialNumber: Used as iSerialNumber override if @dev->iSerialNumber is
- * not set.
* @dev: Template descriptor for the device, including default device
* identifiers.
* @strings: tables of strings, keyed by identifiers assigned during @bind
*/
struct usb_composite_driver {
const char *name;
- const char *iProduct;
- const char *iManufacturer;
- const char *iSerialNumber;
const struct usb_device_descriptor *dev;
struct usb_gadget_strings **strings;
enum usb_device_speed max_speed;
struct usb_composite_driver *driver;
u8 next_string_id;
u8 manufacturer_override;
- u8 product_override;
- u8 serial_override;
/* the gadget driver won't enable the data pullup
* while the deactivation count is nonzero.