mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] USB: gadget: Add serialnumber device parameter
@ 2020-07-16 13:28 Jules Maselbas
  2020-08-03 21:41 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jules Maselbas @ 2020-07-16 13:28 UTC (permalink / raw)
  To: Barebox List; +Cc: Jules Maselbas

This add the device parameter usbgadget.serialnumber

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 drivers/usb/gadget/multi.c    | 2 ++
 drivers/usb/gadget/udc-core.c | 3 +++
 include/usb/gadget.h          | 1 +
 3 files changed, 6 insertions(+)

diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 445cc3242..95f5b90c8 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -179,8 +179,10 @@ static int multi_bind(struct usb_composite_dev *cdev)
 
 	strings_dev[USB_GADGET_MANUFACTURER_IDX].s = gadget->manufacturer;
 	strings_dev[USB_GADGET_PRODUCT_IDX].s = gadget->productname;
+	strings_dev[USB_GADGET_SERIAL_IDX].s = gadget->serialnumber;
 
 	device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
+	device_desc.iSerialNumber = strings_dev[USB_GADGET_SERIAL_IDX].id;
 
 	config.label          = strings_dev[STRING_DESCRIPTION_IDX].s;
 	config.iConfiguration = strings_dev[STRING_DESCRIPTION_IDX].id;
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 126d76e8b..2516676f8 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -212,6 +212,9 @@ int usb_add_gadget_udc_release(struct device_d *parent, struct usb_gadget *gadge
 	gadget->productname = xstrdup(barebox_get_model());
 	dev_add_param_string(&gadget->dev, "productname", NULL, NULL,
 			&gadget->productname, NULL);
+	gadget->serialnumber = xstrdup("");
+	dev_add_param_string(&gadget->dev, "serialnumber", NULL, NULL,
+			&gadget->serialnumber, NULL);
 
 	dev_set_name(&udc->dev, "udc");
 	udc->dev.id = DEVICE_ID_DYNAMIC;
diff --git a/include/usb/gadget.h b/include/usb/gadget.h
index afa11b2d9..3e1d7153d 100644
--- a/include/usb/gadget.h
+++ b/include/usb/gadget.h
@@ -561,6 +561,7 @@ struct usb_gadget {
 	uint32_t			product_id;
 	char				*manufacturer;
 	char				*productname;
+	char				*serialnumber;
 };
 #define work_to_gadget(w)	(container_of((w), struct usb_gadget, work))
 
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] USB: gadget: Add serialnumber device parameter
  2020-07-16 13:28 [PATCH] USB: gadget: Add serialnumber device parameter Jules Maselbas
@ 2020-08-03 21:41 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-08-03 21:41 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: Barebox List

On Thu, Jul 16, 2020 at 03:28:30PM +0200, Jules Maselbas wrote:
> This add the device parameter usbgadget.serialnumber
> 
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
>  drivers/usb/gadget/multi.c    | 2 ++
>  drivers/usb/gadget/udc-core.c | 3 +++
>  include/usb/gadget.h          | 1 +
>  3 files changed, 6 insertions(+)

Applied, thanks

Sascha


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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-03 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 13:28 [PATCH] USB: gadget: Add serialnumber device parameter Jules Maselbas
2020-08-03 21:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox