[PATCH v2 1/2] usb: gadget: initialize serialnumber

Sascha Hauer sha at pengutronix.de
Wed Nov 1 01:50:50 PDT 2023


On Thu, Oct 26, 2023 at 04:43:24PM +0200, Marco Felsch wrote:
> Windows hosts do require the serial number to be set to any ascii string
> to enumerate correctly. Set the serial number if provided or to "unset"
> if not to provide a sane default which works for both hosts.
> 
> Reported-by: Andrey Zhizhikin <andrey.zhizhikin at leica-geosystems.com>
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
> ---
> Changelog
> 
> v2:
> - adapt commit message
> - use barebox_get_serial_number() and "unset"
> 

Applied, thanks

Sascha

>  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..e7cfa0d5d836 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(barebox_get_serial_number() ? : "unset");
>  	dev_add_param_string(&gadget->dev, "serialnumber", NULL, NULL,
>  			     &gadget->serialnumber, NULL);
>  
> -- 
> 2.39.2
> 
> 
> 

-- 
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 |



More information about the barebox mailing list