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

Marek Vasut marex at denx.de
Fri Sep 5 00:42:24 CEST 2014


On Thursday, September 04, 2014 at 12:21:40 PM, Heiko Schocher wrote:

Hi Heiko,

I'll just rant a bit, but please wait until Lukasz does a proper runthrough.

> 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

This URL gives me a website with:
"
Resource not found.
Please check the URL and try again.
"

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

This patch doesn't seem fully right, let me explain below please.

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

See [1] and look for first and second instance of 'bcdUsb' there please. Quote 
of the second one:

'
The bcdUSB field reports the highest version of USB the device supports. The 
value is in binary coded decimal with a format of 0xJJMN where JJ is the major 
version number, M is the minor version number and N is the sub minor version 
number. e.g. USB 2.0 is reported as 0x0200, USB 1.1 as 0x0110 and USB 1.0 as 
0x0100.
'

So this should be configured dynamically based on what the highest mode the 
controller supports is, no?

> +	.bDeviceClass =		USB_CLASS_PER_INTERFACE,

This might be OK.

> +	.bDeviceSubClass =	0x00,

But this is not, the device definitelly isn't CDC-serial.

[...]

[1] http://www.beyondlogic.org/usbnutshell/usb5.shtml



More information about the U-Boot mailing list