Skip to contentSkip to conversation

usb:dfu:g_dnl: Change number of exported configurations at composite gadget

PATCH New Lukasz Majewski 3 participants 6 messages Aug 19, 2013 – Aug 21, 2013 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb:dfu:g_dnl: Change number of exported configurations at composite gadget

USB composite gadget (g_dnl) supports only one configuration. Due to that the corresponding field - bConfigurationValue has been changed.

Moreover more descriptive names were chosen for relevant fields.

Windows XP setup:
- Thesyscon USB Descriptor Dumper
- zadig_xp program for WinUSB installation (which is required by dfu-util)
- dfu-util for windows (version 0.6)
- TRATS target connected via USB hub to test Win XP machine.

Tested at: Trats - Exynos4210

Cc Marek Vasut <[email protected]>
Cc "Egli, Samuel" <[email protected]>
---
 drivers/usb/gadget/g_dnl.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/gadget/g_dnl.c +4 -2
index cbfcb2d..3cb7302 100644
@@ -31,8 +31,10 @@
 
 #define STRING_MANUFACTURER 25
 #define STRING_PRODUCT 2
+/* Index of String Descriptor describing this configuration */
 #define STRING_USBDOWN 2
-#define CONFIG_USBDOWNLOADER 2
+/* Number of supported configurations */
+#define CONFIGURATION_NUMBER 1
 
 #define DRIVER_VERSION		"usb_dnl 2.0"
 
@@ -104,7 +106,7 @@ static int g_dnl_config_register(struct usb_composite_dev *cdev)
 	static struct usb_configuration config = {
 		.label = "usb_dnload",
 		.bmAttributes =	USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
-		.bConfigurationValue =	CONFIG_USBDOWNLOADER,
+		.bConfigurationValue =	CONFIGURATION_NUMBER,
 		.iConfiguration =	STRING_USBDOWN,
 
 		.bind = g_dnl_do_config,
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 usb:dfu:g_dnl: Refactoring the string definition code for g_dnl driver

The manufacturer and product IDs are dynamically assigned when gadget is bind.
Now the IDs aren't assigned at struct g_dnl_string_defs definition.

Cc Marek Vasut <[email protected]>
Cc "Egli, Samuel" <[email protected]>
---
 drivers/usb/gadget/g_dnl.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/usb/gadget/g_dnl.c +7 -4
index 3cb7302..a3e05a8 100644
@@ -56,11 +56,14 @@ static struct usb_device_descriptor device_desc = {
 	.bNumConfigurations = 1,
 };
 
-/* static strings, in UTF-8 */
+/*
+ * static strings, in UTF-8
+ * IDs for those strings are assigned dynamically at g_dnl_bind()
+ */
 static struct usb_string g_dnl_string_defs[] = {
-	{ 0, manufacturer, },
-	{ 1, product, },
-	{  }		/* end of list */
+	{.s = manufacturer},
+	{.s = product},
+	{ }		/* end of list */
 };
 
 static struct usb_gadget_strings g_dnl_string_tab = {
Signature · 1 line
1.7.10.4
Applied
#2 lore raw

PATCH 1/2 usb:dfu:g_dnl: Change number of exported configurations at composite gadget

In reply to Lukasz Majewski

Dear Lukasz Majewski,

Quoted 10 lines

USB composite gadget (g_dnl) supports only one configuration. Due to that the corresponding field - bConfigurationValue has been changed.

Moreover more descriptive names were chosen for relevant fields.

Windows XP setup:
- Thesyscon USB Descriptor Dumper
- zadig_xp program for WinUSB installation (which is required by dfu-util)
- dfu-util for windows (version 0.6)
- TRATS target connected via USB hub to test Win XP machine.

Applied both, thanks.

Best regards,
Marek Vasut

#3 lore raw

PATCH 1/2 usb:dfu:g_dnl: Change number of exported configurations at composite gadget

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 14 lines

-----Original Message-----
From: Lukasz Majewski [mailto:l.majewski at samsung.com]
Sent: Montag, 19. August 2013 17:17
To: u-boot at lists.denx.de
Cc: Lukasz Majewski; Heiko Schocher; Tormod Volden; Lukasz Majewski; Marek Vasut; Egli, Samuel
Subject: [PATCH 1/2] usb:dfu:g_dnl: Change number of exported configurations at composite gadget

USB composite gadget (g_dnl) supports only one configuration. Due to that the corresponding field - bConfigurationValue has been changed.

Moreover more descriptive names were chosen for relevant fields.

Quoted 8 lines

Windows XP setup:
- Thesyscon USB Descriptor Dumper
- zadig_xp program for WinUSB installation (which is required by dfu- util)
- dfu-util for windows (version 0.6)
- TRATS target connected via USB hub to test Win XP machine.

Tested at: Trats - Exynos4210

I applied both patches and tested download from windows 7 with dfu-util 0.7 and it worked all fine. Thanks!

Best

Sam

#4 lore raw

PATCH 1/2 usb:dfu:g_dnl: Change number of exported configurations at composite gadget

Dear Egli, Samuel,

Quoted 23 lines

Hi Lukasz,

Quoted 21 lines

-----Original Message-----
From: Lukasz Majewski [mailto:l.majewski at samsung.com]
Sent: Montag, 19. August 2013 17:17
To: u-boot at lists.denx.de
Cc: Lukasz Majewski; Heiko Schocher; Tormod Volden; Lukasz Majewski; Marek Vasut; Egli, Samuel
Subject: [PATCH 1/2] usb:dfu:g_dnl: Change number of exported configurations at composite gadget

USB composite gadget (g_dnl) supports only one configuration. Due to that the corresponding field - bConfigurationValue has been changed.

Moreover more descriptive names were chosen for relevant fields.

Windows XP setup:
- Thesyscon USB Descriptor Dumper
- zadig_xp program for WinUSB installation (which is required by dfu- util)
- dfu-util for windows (version 0.6)
- TRATS target connected via USB hub to test Win XP machine.

Quoted 4 lines
Quoted 1 line

Tested at: Trats - Exynos4210

I applied both patches and tested download from windows 7 with dfu-util 0.7 and it worked all fine. Thanks!

Will it also work with my playstation and/or other game loaders ? (lol)

Best regards,
Marek Vasut

#5 lore raw

PATCH 1/2 usb:dfu:g_dnl: Change number of exported configurations at composite gadget

On Wed, 21 Aug 2013 05:16:46 +0200 Marek Vasut marex at denx.de wrote,

Quoted 26 lines

Dear Egli, Samuel,

Quoted 24 lines

Hi Lukasz,

Quoted 22 lines

-----Original Message-----
From: Lukasz Majewski [mailto:l.majewski at samsung.com]
Sent: Montag, 19. August 2013 17:17
To: u-boot at lists.denx.de
Cc: Lukasz Majewski; Heiko Schocher; Tormod Volden; Lukasz Majewski; Marek Vasut; Egli, Samuel
Subject: [PATCH 1/2] usb:dfu:g_dnl: Change number of exported configurations at composite gadget

USB composite gadget (g_dnl) supports only one configuration. Due to that the corresponding field - bConfigurationValue has been changed.

Moreover more descriptive names were chosen for relevant fields.

Windows XP setup:
- Thesyscon USB Descriptor Dumper
- zadig_xp program for WinUSB installation (which is required by dfu- util)
- dfu-util for windows (version 0.6)
- TRATS target connected via USB hub to test Win XP machine.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Tested at: Trats - Exynos4210

I applied both patches and tested download from windows 7 with dfu-util 0.7 and it worked all fine. Thanks!

Will it also work with my playstation and/or other game loaders ? (lol)

I'm not very familiar with PS, but yes it is possible to setup working DFU connection from Windows now.
The only thing you need to remember is to install the WinUSB (via zadig program) for the vendor:device supporting DFU.

Quoted 3 lines

Best regards,
Marek Vasut

Signature · 5 lines
Best regards,

Lukasz Majewski

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