Re: [PATCH 1/2] usb: gadget: initialize serialnumber as empty string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Marco,

On 26.10.23 14:46, Marco Felsch wrote:
> Windows hosts do require the serial number to be set to any ascii string
> to enumerate correctly. Set the serial number to "empty" to provide a
> sane default which works for both hosts. Users can still override this
> via the gadget.serialnumber variable.
> 
> Reported-by: Andrey Zhizhikin <andrey.zhizhikin@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/udc/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index b58498680ad1..dc5d1daa14bf 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -1204,7 +1204,7 @@ int usb_add_gadget(struct usb_gadget *gadget)
>  	gadget->productname = xstrdup(barebox_get_model());
>  	dev_add_param_string(&gadget->dev, "productname", NULL, NULL,
>  			     &gadget->productname, NULL);
> -	gadget->serialnumber = xstrdup("");
> +	gadget->serialnumber = xstrdup("empty");

Given that we initialize productname to model, it makes sense to initialize
serialnumber to global.serial_number now that we have that generic variable.

If that's unset, you can use a fixed value, I'd prefer "unset" though
instead of "empty".

Cheers,
Ahmad

>  	dev_add_param_string(&gadget->dev, "serialnumber", NULL, NULL,
>  			     &gadget->serialnumber, NULL);
>  

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux