[U-Boot] [PATCH] dfu, usb: set usb descriptor to values defined in dfu spec 1.1

Heiko Schocher hs at denx.de
Thu Sep 4 12:21:40 CEST 2014


set bDeviceClass, bDeviceSubClass and bcdUSB to the values
defined in dfu spec 1.1 chapter 4.2.1 found here:

http://www.usb.org/developers/devclass_docs/DFU_1.1.pdf

Signed-off-by: Heiko Schocher <hs at denx.de>
Cc: Lukasz Majewski <l.majewski at samsung.com>
Cc: Marek Vasut <marex at denx.de>
Cc: Roger Meier <r.meier at siemens.com>

---

before this patch, "dfu-util -l" showed:

Bus 002 Device 114: ID 0908:02c5 Siemens AG
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         2 Abstract (modem)
  bDeviceProtocol         0 None
  bMaxPacketSize0        64
  idVendor           0x0908 Siemens AG
  idProduct          0x02c5
  bcdDevice            0.00
  iManufacturer           1 Siemens AG

with this patch:

Bus 002 Device 089: ID 0908:02c5 Siemens AG
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0908 Siemens AG
  idProduct          0x02c5
  bcdDevice            0.00
  iManufacturer           1 Siemens AG
  iProduct                2 USB download gadget

which fits for "bcdUSB", "bDeviceClass" and "bDeviceSubClass" with
the DFU spezifikation.
---
 drivers/usb/gadget/f_dfu.c | 5 +++--
 drivers/usb/gadget/g_dnl.c | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 9128add..9429e50 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -83,8 +83,9 @@ static struct usb_descriptor_header *dfu_runtime_descs[] = {
 static const struct usb_qualifier_descriptor dev_qualifier = {
 	.bLength =		sizeof dev_qualifier,
 	.bDescriptorType =	USB_DT_DEVICE_QUALIFIER,
-	.bcdUSB =		__constant_cpu_to_le16(0x0200),
-	.bDeviceClass =		USB_CLASS_VENDOR_SPEC,
+	.bcdUSB =		__constant_cpu_to_le16(0x0110),
+	.bDeviceClass =		USB_CLASS_PER_INTERFACE,
+	.bDeviceSubClass =	0x00,
 	.bNumConfigurations =	1,
 };
 
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..bcca965 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -57,9 +57,9 @@ static struct usb_device_descriptor device_desc = {
 	.bLength = sizeof device_desc,
 	.bDescriptorType = USB_DT_DEVICE,
 
-	.bcdUSB = __constant_cpu_to_le16(0x0200),
-	.bDeviceClass = USB_CLASS_COMM,
-	.bDeviceSubClass = 0x02, /*0x02:CDC-modem , 0x00:CDC-serial*/
+	.bcdUSB = __constant_cpu_to_le16(0x0110),
+	.bDeviceClass = USB_CLASS_PER_INTERFACE,
+	.bDeviceSubClass = 0x00, /*0x02:CDC-modem , 0x00:CDC-serial*/
 
 	.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
 	.idProduct = __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM),
-- 
1.8.3.1



More information about the U-Boot mailing list