Sebastian Andrzej Siewior <bige...@linutronix.de> writes:
> 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.
>
> Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>

Acked-by: Michal Nazarewicz <min...@mina86.com>

> diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
> index 7651e5b..367bbb6 100644
> --- a/include/linux/usb/composite.h
> +++ b/include/linux/usb/composite.h
> @@ -248,6 +248,12 @@ int usb_add_config(struct usb_composite_dev *,
>  void usb_remove_config(struct usb_composite_dev *,
>               struct usb_configuration *);
>  
> +/* predefined index for usb_composite_driver */
> +#define USB_GADGET_MANUFACTURER_IDX  0
> +#define USB_GADGET_PRODUCT_IDX               1
> +#define USB_GADGET_SERIAL_IDX                2
> +#define USB_GADGET_FIRST_AVAIL_IDX   3

enum perhaps?

> +
>  /**
>   * struct usb_composite_driver - groups configurations into a gadget
>   * @name: For diagnostics, identifies the driver.
> @@ -261,7 +267,9 @@ void usb_remove_config(struct usb_composite_dev *,
>   * @dev: Template descriptor for the device, including default device
>   *   identifiers.
>   * @strings: tables of strings, keyed by identifiers assigned during @bind
> - *   and language IDs provided in control requests
> + *   and language IDs provided in control requests. Note: The first entries
> + *   are predefined. The first entry that may be used is
> + *   USB_GADGET_FIRST_AVAIL_IDX
>   * @max_speed: Highest speed the driver supports.
>   * @needs_serial: set to 1 if the gadget needs userspace to provide
>   *   a serial number.  If one is not provided, warning will be printed.

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: m...@google.com>--------------ooO--(_)--Ooo--

Attachment: pgpGf6RB3e8V7.pgp
Description: PGP signature

Reply via email to