Skip to contentSkip to conversation

usb: gadget: Call g_dnl_bind_fixup() before testing g_dnl_serial length

PATCH In review Lukasz Majewski 3 participants 3 messages Jun 26, 2017 – Jun 29, 2017 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: Call g_dnl_bind_fixup() before testing g_dnl_serial length

After the commit SHA1: 842778a091 - the serial number descriptor is only visible when we have non zero length of g_dnl_serial.

However, on some platforms (e.g. Siemens) the serial number is set at g_dnl_bind_fixup(), so with the current code we will always omit the serial (since it is not set).

This commit moves the g_dnl_bind_fixup() call before the g_dnl_serial length test.

---
 drivers/usb/gadget/g_dnl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/g_dnl.c +2 -1
index d4bee9b..0491a0e 100644
@@ -224,6 +224,8 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 	g_dnl_string_defs[1].id = id;
 	device_desc.iProduct = id;
 
+	g_dnl_bind_fixup(&device_desc, cdev->driver->name);
+
 	if (strlen(g_dnl_serial)) {
 		id = usb_string_id(cdev);
 		if (id < 0)
@@ -233,7 +235,6 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.iSerialNumber = id;
 	}
 
-	g_dnl_bind_fixup(&device_desc, cdev->driver->name);
 	ret = g_dnl_config_register(cdev);
 	if (ret)
 		goto error;
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 usb: gadget: Call g_dnl_bind_fixup() before testing g_dnl_serial length

Hello Lukasz,

Am 26.06.2017 um 13:04 schrieb Lukasz Majewski:

Quoted 7 lines

After the commit SHA1: 842778a091 - the serial number descriptor is only visible when we have non zero length of g_dnl_serial.

However, on some platforms (e.g. Siemens) the serial number is set at g_dnl_bind_fixup(), so with the current code we will always omit the serial (since it is not set).

Quoted 8 lines

This commit moves the g_dnl_bind_fixup() call before the g_dnl_serial length test.

---
  drivers/usb/gadget/g_dnl.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Just Tested on the smartweb board. Works fine!

bye,
Heiko

Quoted 23 lines
drivers/usb/gadget/g_dnl.c +2 -1
index d4bee9b..0491a0e 100644
@@ -224,6 +224,8 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
  	g_dnl_string_defs[1].id = id;
  	device_desc.iProduct = id;
 
+	g_dnl_bind_fixup(&device_desc, cdev->driver->name);
+
  	if (strlen(g_dnl_serial)) {
  		id = usb_string_id(cdev);
  		if (id < 0)
@@ -233,7 +235,6 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
  		device_desc.iSerialNumber = id;
  	}
 
-	g_dnl_bind_fixup(&device_desc, cdev->driver->name);
  	ret = g_dnl_config_register(cdev);
  	if (ret)
  		goto error;
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#2 lore raw
In reply to Lukasz Majewski
Quoted 7 lines · Lukasz Majewski

After the commit SHA1: 842778a091 - the serial number descriptor is only visible when we have non zero length of g_dnl_serial.

However, on some platforms (e.g. Siemens) the serial number is set at g_dnl_bind_fixup(), so with the current code we will always omit the serial (since it is not set).

Quoted 6 lines

This commit moves the g_dnl_bind_fixup() call before the g_dnl_serial length test.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170629/8122d511/attachment.sig>