public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/5] usb, g_dnl: make iSerialNumber board configurable
Date: Mon, 04 Nov 2013 12:05:23 +0100	[thread overview]
Message-ID: <20131104120523.441bcea5@amdc308.digital.local> (raw)
In-Reply-To: <1383548559-8233-4-git-send-email-hs@denx.de>

Hi Heiko,

> add the possibility to set the iSerialNumber board specific.
> Default value for iSerialNumber is 0x0. This value can
> changed board specific through the new function
> g_dnl_set_serialnumber() which must be called from the
> board specific function g_dnl_bind_fixup().
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> 

I tried to apply the patch to the newest origin/master (SHA1:
509dca7a11aad394d781a9d31a7bfa6692562741).

Unfortunately it failed due to some previous patches applied to g_dnl.c
file.

Please rebase on top of origin/master

> ---
> changes for v2:
> - as Lukasz Majewski suggested, remove CONFIG_G_DNL_SERIAL_STRING
>   define
> ---
>  drivers/usb/gadget/g_dnl.c | 20 ++++++++++++++++++++
>  include/g_dnl.h            |  1 +
>  2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index 40868c0..7a3d507 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -32,6 +32,9 @@
>  #define STRING_PRODUCT 2
>  /* Index of String Descriptor describing this configuration */
>  #define STRING_USBDOWN 2
> +/* Index of String serial */
> +#define STRING_SERIAL  3
> +#define MAX_STRING_SERIAL	32
>  /* Number of supported configurations */
>  #define CONFIGURATION_NUMBER 1
>  
> @@ -39,8 +42,16 @@
>  
>  static const char shortname[] = "usb_dnl_";
>  static const char product[] = "USB download gadget";
> +static char g_dnl_serial[MAX_STRING_SERIAL];
>  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
>  
> +void g_dnl_set_serialnumber(char *s)
> +{
> +	memset(g_dnl_serial, 0, MAX_STRING_SERIAL);
> +	if (strlen(s) < MAX_STRING_SERIAL)
> +		strncpy(g_dnl_serial, s, strlen(s));
> +}
> +
>  static struct usb_device_descriptor device_desc = {
>  	.bLength = sizeof device_desc,
>  	.bDescriptorType = USB_DT_DEVICE,
> @@ -52,6 +63,7 @@ static struct usb_device_descriptor device_desc = {
>  	.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
>  	.idProduct =
> __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM), .iProduct =
> STRING_PRODUCT,
> +	.iSerialNumber = STRING_SERIAL,
>  	.bNumConfigurations = 1,
>  };
>  
> @@ -62,6 +74,7 @@ static struct usb_device_descriptor device_desc = {
>  static struct usb_string g_dnl_string_defs[] = {
>  	{.s = manufacturer},
>  	{.s = product},
> +	{.s = g_dnl_serial},
>  	{ }		/* end of list */
>  };
>  
> @@ -145,6 +158,13 @@ static int g_dnl_bind(struct usb_composite_dev
> *cdev) g_dnl_string_defs[1].id = id;
>  	device_desc.iProduct = id;
>  
> +	id = usb_string_id(cdev);
> +	if (id < 0)
> +		return id;
> +
> +	g_dnl_string_defs[2].id = id;
> +	device_desc.iSerialNumber = id;
> +
>  	g_dnl_bind_fixup(&device_desc);
>  	ret = g_dnl_config_register(cdev);
>  	if (ret)
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 2b2f11a..be3114f 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -13,6 +13,7 @@
>  int g_dnl_bind_fixup(struct usb_device_descriptor *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
> +void g_dnl_set_serialnumber(char *);
>  
>  /* USB initialization declaration - board specific */
>  void board_usb_init(void);



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2013-11-04 11:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04  7:02 [U-Boot] [PATCH v2 0/5] arm, am33xx: update for the am33xx based siemens boards Heiko Schocher
2013-11-04  7:02 ` [U-Boot] [PATCH v2 1/5] bootcount: store bootcount var in environment Heiko Schocher
2013-11-04  7:02 ` [U-Boot] [PATCH v2 2/5] arm, am33x: make RTC32K OSC enable configurable Heiko Schocher
2013-11-04  7:02 ` [U-Boot] [PATCH v2 3/5] usb, g_dnl: make iSerialNumber board configurable Heiko Schocher
2013-11-04 11:05   ` Lukasz Majewski [this message]
2013-11-04  7:02 ` [U-Boot] [PATCH v2 4/5] usb, g_dnl: make bcdDevice value configurable Heiko Schocher
2013-11-04  7:02 ` [U-Boot] [PATCH v2 5/5] arm, am335x: update for the siemens boards Heiko Schocher
2013-11-04 12:45 ` [U-Boot] [PATCH v2 0/5] arm, am33xx: update for the am33xx based " Vaibhav Bedia
2013-11-04 13:15   ` Heiko Schocher
2013-11-04 13:24     ` Vaibhav Bedia
2013-11-04 17:34       ` Marek Vasut
2013-11-04 19:45         ` Vaibhav Bedia
2013-11-05  3:30           ` Heiko Schocher
2013-11-06 12:18             ` Vaibhav Bedia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131104120523.441bcea5@amdc308.digital.local \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox