mbox

[U-Boot,PULL] u-boot-usb/master

Message ID 201212151737.04038.marex@denx.de
State Rejected
Delegated to: Tom Rini
Headers show

Pull-request

git://git.denx.de/u-boot-usb.git master

Message

Marek Vasut Dec. 15, 2012, 4:37 p.m. UTC
This set contains mostly fixes, but also the DFU (which was submitted before 
RC). That's why I'd like it in master if possible. If not, apply to next.

The following changes since commit ebbf0d20aa85f623c49b7ed3349ebfea450c152d:

  Prepare v2013.01-rc2 (2012-12-14 14:43:22 -0700)

are available in the git repository at:

  git://git.denx.de/u-boot-usb.git master

for you to fetch changes up to 1b9bf5c3c99d990d6c88b39c5df82179b7c6028f:

  usb: Fix bug when both DFU & ETHER are defined (2012-12-15 17:34:43 +0100)

----------------------------------------------------------------
Lukasz Dalek (2):
      pxa25x_udc: Remove usbdescriptors.h
      h2200: Add USB CDC ethernet support

Milind Choudhary (1):
      usb: Clean up newly allocated device nodes in case of configuration 
failure

Nikita Kiryanov (3):
      twl4030: add gpio register offsets
      cm-t35: add USB host support
      cm_t35: use new low level interface for usb ehci

Pantelis Antoniou (9):
      g_dnl: Issue connect/disconnect as appropriate
      g_dnl: Properly terminate string list.
      dfu: Only perform DFU board_usb_init() for TRATS
      dfu: Fix crash when wrong number of arguments given
      dfu: Send correct DFU response from composite_setup
      dfu: Properly zero out timeout value
      dfu: Add a partition type target
      dfu: Support larger than memory transfers.
      usb: Fix bug when both DFU & ETHER are defined

Richard Genoud (1):
      usb documentation: fix typo

Vincent Palatin (2):
      usb: ehci: Add 64-bit controller support
      usb: properly detect empty mass storage media reader

Vipin Kumar (1):
      usbh/ehci: Increase timeout for enumeration

 board/cm_t35/cm_t35.c           |   77 ++++++++++++++++++++++++++++
 board/h2200/h2200.c             |   11 ++++
 common/cmd_dfu.c                |    5 +-
 common/usb.c                    |   12 +++++
 common/usb_hub.c                |   35 +++++++++++--
 common/usb_storage.c            |   10 ++++
 doc/README.usb                  |    2 +-
 drivers/dfu/dfu.c               |  244 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
 drivers/dfu/dfu_mmc.c           |  109 ++++++++++++++++++++++++++++++---------
 drivers/usb/gadget/Makefile     |   10 +++-
 drivers/usb/gadget/composite.c  |   27 ++++++++++
 drivers/usb/gadget/ep0.c        |    1 +
 drivers/usb/gadget/f_dfu.c      |    9 +++-
 drivers/usb/gadget/g_dnl.c      |   12 ++++-
 drivers/usb/gadget/pxa25x_udc.c |    1 -
 drivers/usb/host/ehci-hcd.c     |    3 ++
 include/configs/cm_t35.h        |    8 ++-
 include/configs/h2200.h         |   25 +++++++++
 include/dfu.h                   |   21 ++++++--
 include/twl4030.h               |   44 ++++++++++++++++
 include/usb.h                   |    1 +
 21 files changed, 572 insertions(+), 95 deletions(-)

Comments

Łukasz Majewski Dec. 17, 2012, 11 a.m. UTC | #1
Hi Marek,

> Pantelis Antoniou (9):
>       g_dnl: Issue connect/disconnect as appropriate
>       g_dnl: Properly terminate string list.
>       dfu: Only perform DFU board_usb_init() for TRATS
>       dfu: Fix crash when wrong number of arguments given
>       dfu: Send correct DFU response from composite_setup
>       dfu: Properly zero out timeout value
>       dfu: Add a partition type target
>       dfu: Support larger than memory transfers.
>       usb: Fix bug when both DFU & ETHER are defined

Can we wait with pulling DFU related patches? 

I didn't received tcpdump from Pantelis, so I don't know what is going
on (or how to tackle the DFU problem).
Pantelis Antoniou Dec. 17, 2012, 11:01 a.m. UTC | #2
Lukasz,

I'll sent the dump in a couple of hours.
Been busy with other work items...

Regards

-- Pantelis

On Dec 17, 2012, at 1:00 PM, Lukasz Majewski wrote:

> Hi Marek,
> 
>> Pantelis Antoniou (9):
>>      g_dnl: Issue connect/disconnect as appropriate
>>      g_dnl: Properly terminate string list.
>>      dfu: Only perform DFU board_usb_init() for TRATS
>>      dfu: Fix crash when wrong number of arguments given
>>      dfu: Send correct DFU response from composite_setup
>>      dfu: Properly zero out timeout value
>>      dfu: Add a partition type target
>>      dfu: Support larger than memory transfers.
>>      usb: Fix bug when both DFU & ETHER are defined
> 
> Can we wait with pulling DFU related patches? 
> 
> I didn't received tcpdump from Pantelis, so I don't know what is going
> on (or how to tackle the DFU problem).
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group
Tom Rini Dec. 17, 2012, 2:08 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/17/12 06:00, Lukasz Majewski wrote:
> Hi Marek,
> 
>> Pantelis Antoniou (9): g_dnl: Issue connect/disconnect as
>> appropriate g_dnl: Properly terminate string list. dfu: Only
>> perform DFU board_usb_init() for TRATS dfu: Fix crash when wrong
>> number of arguments given dfu: Send correct DFU response from
>> composite_setup dfu: Properly zero out timeout value dfu: Add a
>> partition type target dfu: Support larger than memory transfers. 
>> usb: Fix bug when both DFU & ETHER are defined
> 
> Can we wait with pulling DFU related patches?

Agreed, thanks.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQzydFAAoJENk4IS6UOR1WZBcQAIe9W7xcMiRb0w6NSif1t3Z/
vkm9Wx5aWdAa2URRz8f3vzLn0Yj6zYzP+SVRmWRb1Cj2TLJstOtHknY0ni0qem6W
AAaGd5bYYJryO3gp0qRR4YnlQv+xwTWPMG7QBbNCM8mqKPxoWBPSpnfN5Qu11bwm
uuF4NQYcZopUvVEzFb1D4cElAr/VlOdp+Yh1kJ3nJvsRqv9mANriPSd4clRLFIM+
v/sWcAsWttHWO+F7fS4ZWqb/l29afBRTS06SsxfHoXrhfq2Z3IC+NANw+xyPktNe
dRwJ09asublBqMbnfA7/C2Dl4qzr0ItZstoHnkCm5rDxVgh5XR46ero3d+9IIsmy
MXGNQg7TdcFxqeiWCuAdz/MQew1ZNOMXXHDuL5Gm7j+EtgNg7Zhz1rgrjlgAVt86
uCS8gJ3FhSnpRsbER+9Dv3/QLiKdPZyhnaPI/7LgudOTI2CUIRWMuF81EXsn6Pkd
BCtUZMXFHwR8Etmx2fEbfL2mY+BCbHyfud/lNjhhAchhYCJwai+u0+BeIBLqiIRx
VGza3V0stlz22pN/4+8FjOjKrnecFP5ZTr+9ieVJcaOaj5nD5MUNLzx2DincICzc
cdoNiuyRq+TxlhTghKTJisLCj2iWWk8tMXiuC0mFk4rkQ8OUpjfi7rO8VjjvWtXv
3fCwL41xPJ+wh0fljnEH
=FZUT
-----END PGP SIGNATURE-----
Pantelis Antoniou Dec. 17, 2012, 2:38 p.m. UTC | #4
Hi Lukasz,

Sorry for the slight delay, setting up the usb capture took a bit longer.

So we have two captures; one named bad (which is the tip of our internal tree
with the commit reverted.

cee8b859fdb9edc68c67624b2fa1c97a65d121e7 
"dfu: Send correct DFU response from composite_setup"

With the commit reverted we get this:

> panto@sles11esa:~/ti/stuff/dfu-util$ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
> dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 0403:bd00
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> Opening DFU USB Device...
> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
> Claiming USB DFU Interface...
> Setting Alternate Setting #6 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> **** DUMP of func_dfu ****
> 	bLength         = 0
> 	bDescriptorType = 0
> 	bmAttributes    = 0x00
> 	wDetachTimeOut  = 0
> 	wTransferSize   = 0
> 	bcdDFUVersion   = 0x0000
> Error obtaining DFU functional descriptor
> Please report this as a bug!
> Warning: Assuming DFU version 1.0
> Warning: Transfer size can not be detected
> DFU mode device DFU version 0100
> Error: Transfer size must be specified
> 

Looking at the capture file (usb-capture-bad-filter.pcap) we see the culprit at
packet 171 at bad capture and packet 169 at the good.

> USB URB
>     URB id: 0xffff88032d9cbdc0
>     URB type: URB_SUBMIT ('S')
>     URB transfer type: URB_CONTROL (0x02)
>     Endpoint: 0x80, Direction: IN
>         1... .... = Direction: IN (1)
>         .000 0000 = Endpoint value: 0
>     Device: 34
>     URB bus id: 3
>     Device setup request: relevant (0)
>     Data: not present ('<')
>     URB sec: 1355753000
>     URB usec: 572483
>     URB status: Operation now in progress (-EINPROGRESS) (-115)
>     URB length [bytes]: 9
>     Data length [bytes]: 0
>     [Response in: 172]
> URB setup
>     bmRequestType: 0x80
>         1... .... = Direction: Device-to-host
>         .00. .... = Type: Standard (0x00)
>         ...0 0000 = Recipient: Device (0x00)
>     bRequest: GET DESCRIPTOR (6)
>     Descriptor Index: 0x00
>     bDescriptorType: HID (33)
>     Language Id: no language specified (0x0000)
>     wLength: 9
> 
> 0000  c0 eb 99 28 03 88 ff ff 53 02 80 20 03 00 00 3c   ...(....S.. ...<
> 0010  d6 0e cf 50 00 00 00 00 a3 bf 0a 00 8d ff ff ff   ...P............
> 0020  09 00 00 00 00 00 00 00 80 06 00 21 00 00 09 00   ...........!....
> 0030  00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00   ................
> 


The response generated when the fix is applied is correct:
 
> USB URB
>     URB id: 0xffff88032899ebc0
>     URB type: URB_COMPLETE ('C')
>     URB transfer type: URB_CONTROL (0x02)
>     Endpoint: 0x80, Direction: IN
>         1... .... = Direction: IN (1)
>         .000 0000 = Endpoint value: 0
>     Device: 32
>     URB bus id: 3
>     Device setup request: not relevant ('-')
>     Data: present (0)
>     URB sec: 1355747030
>     URB usec: 704533
>     URB status: Success (0)
>     URB length [bytes]: 9
>     Data length [bytes]: 9
>     [Request in: 169]
>     [Time from request: 0.000114000 seconds]
>     [bInterfaceClass: Unknown (0xffff)]
> GET DESCRIPTOR data (unknown descriptor type 33)
> 
> 0000  c0 eb 99 28 03 88 ff ff 43 02 80 20 03 00 2d 00   ...(....C.. ..-.
> 0010  d6 0e cf 50 00 00 00 00 15 c0 0a 00 00 00 00 00   ...P............
> 0020  09 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00   ................
> 0030  00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00   ................
> 0040  09 21 0f 00 00 00 10 10 01                        .!.......

 
Note that wireshark can't decode it - no DFU dissector.

And the dfu-util side:

> $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
> dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 0403:bd00
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> Opening DFU USB Device...
> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
> Claiming USB DFU Interface...
> Setting Alternate Setting #6 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> **** DUMP of func_dfu ****
> 	bLength         = 9
> 	bDescriptorType = 33
> 	bmAttributes    = 0x0f
> 	wDetachTimeOut  = 0
> 	wTransferSize   = 4096
> 	bcdDFUVersion   = 0x0110
> DFU mode device DFU version 0110
> Device returned transfer size 4096
> No valid DFU suffix signature
> Warning: File has no DFU suffix
> bytes_per_hash=335554
> Copying data from PC to DFU device
> Starting download: [##################################################] finished!
> Sent a total of 16777728 bytes
> state(2) = dfuIDLE, status(0) = No error condition is present
> Done!
> 
> 


The response is malformed without the fix in the bad capture:

> USB URB
>     URB id: 0xffff88032d9cbdc0
>     URB type: URB_COMPLETE ('C')
>     URB transfer type: URB_CONTROL (0x02)
>     Endpoint: 0x80, Direction: IN
>         1... .... = Direction: IN (1)
>         .000 0000 = Endpoint value: 0
>     Device: 34
>     URB bus id: 3
>     Device setup request: not relevant ('-')
>     Data: present (0)
>     URB sec: 1355753000
>     URB usec: 572591
>     URB status: Broken pipe (-EPIPE) (-32)
>     URB length [bytes]: 0
>     Data length [bytes]: 0
>     [Request in: 171]
>     [Time from request: 0.000108000 seconds]
>     [bInterfaceClass: Unknown (0xffff)]
> [Malformed Packet: USB]
>     [Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
>         [Message: Malformed Packet (Exception occurred)]
>         [Severity level: Error]
>         [Group: Malformed]
> 
> 0000  c0 bd 9c 2d 03 88 ff ff 43 02 80 22 03 00 2d 00   ...-....C.."..-.
> 0010  28 26 cf 50 00 00 00 00 af bc 08 00 e0 ff ff ff   (&.P............
> 0020  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
> 0030  00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00   ................


And the dfu-util side at the host complains and fails:

> $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
> dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 0403:bd00
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> Opening DFU USB Device...
> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
> Claiming USB DFU Interface...
> Setting Alternate Setting #6 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> **** DUMP of func_dfu ****
> 	bLength         = 0
> 	bDescriptorType = 0
> 	bmAttributes    = 0x00
> 	wDetachTimeOut  = 0
> 	wTransferSize   = 0
> 	bcdDFUVersion   = 0x0000
> Error obtaining DFU functional descriptor
> Please report this as a bug!
> Warning: Assuming DFU version 1.0
> Warning: Transfer size can not be detected
> DFU mode device DFU version 0100
> Error: Transfer size must be specified



The full set of captures (pcap format) is at 

dfu - https://docs.google.com/folder/d/0B7yJhZ55fi8FOFR3TnVGdTBfbHM/edit

As to why it works for you Lukasz, I'm puzzled; maybe some difference 
in the usb gadget peripheral? I would bet that it might refuse to send
a malformed response, dfu-util will eventually time out and then
the transfer can continue with some fail-safe defaults.

In either way, that's bad, and is a bug that the patchset fixes correctly.

Regards

-- Pantelis



On Dec 17, 2012, at 1:00 PM, Lukasz Majewski wrote:

> Hi Marek,
> 
>> Pantelis Antoniou (9):
>>      g_dnl: Issue connect/disconnect as appropriate
>>      g_dnl: Properly terminate string list.
>>      dfu: Only perform DFU board_usb_init() for TRATS
>>      dfu: Fix crash when wrong number of arguments given
>>      dfu: Send correct DFU response from composite_setup
>>      dfu: Properly zero out timeout value
>>      dfu: Add a partition type target
>>      dfu: Support larger than memory transfers.
>>      usb: Fix bug when both DFU & ETHER are defined
> 
> Can we wait with pulling DFU related patches? 
> 
> I didn't received tcpdump from Pantelis, so I don't know what is going
> on (or how to tackle the DFU problem).
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group
Marek Vasut Dec. 17, 2012, 2:40 p.m. UTC | #5
Dear Tom Rini,

> On 12/17/12 06:00, Lukasz Majewski wrote:
> > Hi Marek,
> > 
> >> Pantelis Antoniou (9): g_dnl: Issue connect/disconnect as
> >> appropriate g_dnl: Properly terminate string list. dfu: Only
> >> perform DFU board_usb_init() for TRATS dfu: Fix crash when wrong
> >> number of arguments given dfu: Send correct DFU response from
> >> composite_setup dfu: Properly zero out timeout value dfu: Add a
> >> partition type target dfu: Support larger than memory transfers.
> >> usb: Fix bug when both DFU & ETHER are defined
> > 
> > Can we wait with pulling DFU related patches?
> 
> Agreed, thanks.

Ok, I'll schedule it for next then. I'll rebuild the fixes and reissue a pullRQ.

Best regards,
Marek Vasut
Łukasz Majewski Dec. 17, 2012, 5:32 p.m. UTC | #6
Hi Pantelis,


Thanks for logs. I will go through them and let you know.

First thing, which I see, that needs to be done is upgrading dfu-util
(from dfu-util version 0.1+svnexported to dfu-util 0.7)

> Hi Lukasz,
> 
> Sorry for the slight delay, setting up the usb capture took a bit
> longer.
> 
> So we have two captures; one named bad (which is the tip of our
> internal tree with the commit reverted.
> 
> cee8b859fdb9edc68c67624b2fa1c97a65d121e7 
> "dfu: Send correct DFU response from composite_setup"
> 
> With the commit reverted we get this:
> 
> > panto@sles11esa:~/ti/stuff/dfu-util$ sudo ./src/dfu-util -v -D
> > ~/test.img -a rootfs dfu-util 0.7
> > 
> > Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> > Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> > This program is Free Software and has ABSOLUTELY NO WARRANTY
> > Please report bugs to dfu-util@lists.gnumonks.org
> > 
> > Opening DFU capable USB device... ID 0403:bd00
> > Did not find cached descriptor
> > WARNING: Can not find cached DFU functional descriptor
> > Warning: Assuming DFU version 1.0
> > Run-time device DFU version 0100
> > Claiming USB DFU Runtime Interface...
> > Determining device status: state = appIDLE, status = 0
> > Device really in Runtime Mode, send DFU detach request...
> > Resetting USB...
> > Opening DFU USB Device...
> > Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
> > Claiming USB DFU Interface...
> > Setting Alternate Setting #6 ...
> > Determining device status: state = dfuIDLE, status = 0
> > dfuIDLE, continuing
> > Did not find cached descriptor
> > Error obtaining cached DFU functional descriptor
> > **** DUMP of func_dfu ****
> > 	bLength         = 0
> > 	bDescriptorType = 0
> > 	bmAttributes    = 0x00
> > 	wDetachTimeOut  = 0
> > 	wTransferSize   = 0
> > 	bcdDFUVersion   = 0x0000
> > Error obtaining DFU functional descriptor
> > Please report this as a bug!
> > Warning: Assuming DFU version 1.0
> > Warning: Transfer size can not be detected
> > DFU mode device DFU version 0100
> > Error: Transfer size must be specified
> > 
> 
> Looking at the capture file (usb-capture-bad-filter.pcap) we see the
> culprit at packet 171 at bad capture and packet 169 at the good.
> 
> > USB URB
> >     URB id: 0xffff88032d9cbdc0
> >     URB type: URB_SUBMIT ('S')
> >     URB transfer type: URB_CONTROL (0x02)
> >     Endpoint: 0x80, Direction: IN
> >         1... .... = Direction: IN (1)
> >         .000 0000 = Endpoint value: 0
> >     Device: 34
> >     URB bus id: 3
> >     Device setup request: relevant (0)
> >     Data: not present ('<')
> >     URB sec: 1355753000
> >     URB usec: 572483
> >     URB status: Operation now in progress (-EINPROGRESS) (-115)
> >     URB length [bytes]: 9
> >     Data length [bytes]: 0
> >     [Response in: 172]
> > URB setup
> >     bmRequestType: 0x80
> >         1... .... = Direction: Device-to-host
> >         .00. .... = Type: Standard (0x00)
> >         ...0 0000 = Recipient: Device (0x00)
> >     bRequest: GET DESCRIPTOR (6)
> >     Descriptor Index: 0x00
> >     bDescriptorType: HID (33)
> >     Language Id: no language specified (0x0000)
> >     wLength: 9
> > 
> > 0000  c0 eb 99 28 03 88 ff ff 53 02 80 20 03 00 00
> > 3c   ...(....S.. ...< 0010  d6 0e cf 50 00 00 00 00 a3 bf 0a 00 8d
> > ff ff ff   ...P............ 0020  09 00 00 00 00 00 00 00 80 06 00
> > 21 00 00 09 00   ...........!.... 0030  00 00 00 00 00 00 00 00 00
> > 02 00 00 00 00 00 00   ................
> > 
> 
> 
> The response generated when the fix is applied is correct:
>  
> > USB URB
> >     URB id: 0xffff88032899ebc0
> >     URB type: URB_COMPLETE ('C')
> >     URB transfer type: URB_CONTROL (0x02)
> >     Endpoint: 0x80, Direction: IN
> >         1... .... = Direction: IN (1)
> >         .000 0000 = Endpoint value: 0
> >     Device: 32
> >     URB bus id: 3
> >     Device setup request: not relevant ('-')
> >     Data: present (0)
> >     URB sec: 1355747030
> >     URB usec: 704533
> >     URB status: Success (0)
> >     URB length [bytes]: 9
> >     Data length [bytes]: 9
> >     [Request in: 169]
> >     [Time from request: 0.000114000 seconds]
> >     [bInterfaceClass: Unknown (0xffff)]
> > GET DESCRIPTOR data (unknown descriptor type 33)
> > 
> > 0000  c0 eb 99 28 03 88 ff ff 43 02 80 20 03 00 2d
> > 00   ...(....C.. ..-. 0010  d6 0e cf 50 00 00 00 00 15 c0 0a 00 00
> > 00 00 00   ...P............ 0020  09 00 00 00 09 00 00 00 00 00 00
> > 00 00 00 00 00   ................ 0030  00 00 00 00 00 00 00 00 00
> > 02 00 00 00 00 00 00   ................ 0040  09 21 0f 00 00 00 10
> > 10 01                        .!.......
> 
>  
> Note that wireshark can't decode it - no DFU dissector.
> 
> And the dfu-util side:
> 
> > $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
> > dfu-util 0.7
> > 
> > Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> > Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> > This program is Free Software and has ABSOLUTELY NO WARRANTY
> > Please report bugs to dfu-util@lists.gnumonks.org
> > 
> > Opening DFU capable USB device... ID 0403:bd00
> > Did not find cached descriptor
> > WARNING: Can not find cached DFU functional descriptor
> > Warning: Assuming DFU version 1.0
> > Run-time device DFU version 0100
> > Claiming USB DFU Runtime Interface...
> > Determining device status: state = appIDLE, status = 0
> > Device really in Runtime Mode, send DFU detach request...
> > Resetting USB...
> > Opening DFU USB Device...
> > Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
> > Claiming USB DFU Interface...
> > Setting Alternate Setting #6 ...
> > Determining device status: state = dfuIDLE, status = 0
> > dfuIDLE, continuing
> > Did not find cached descriptor
> > Error obtaining cached DFU functional descriptor
> > **** DUMP of func_dfu ****
> > 	bLength         = 9
> > 	bDescriptorType = 33
> > 	bmAttributes    = 0x0f
> > 	wDetachTimeOut  = 0
> > 	wTransferSize   = 4096
> > 	bcdDFUVersion   = 0x0110
> > DFU mode device DFU version 0110
> > Device returned transfer size 4096
> > No valid DFU suffix signature
> > Warning: File has no DFU suffix
> > bytes_per_hash=335554
> > Copying data from PC to DFU device
> > Starting download:
> > [##################################################] finished! Sent
> > a total of 16777728 bytes state(2) = dfuIDLE, status(0) = No error
> > condition is present Done!
> > 
> > 
> 
> 
> The response is malformed without the fix in the bad capture:
> 
> > USB URB
> >     URB id: 0xffff88032d9cbdc0
> >     URB type: URB_COMPLETE ('C')
> >     URB transfer type: URB_CONTROL (0x02)
> >     Endpoint: 0x80, Direction: IN
> >         1... .... = Direction: IN (1)
> >         .000 0000 = Endpoint value: 0
> >     Device: 34
> >     URB bus id: 3
> >     Device setup request: not relevant ('-')
> >     Data: present (0)
> >     URB sec: 1355753000
> >     URB usec: 572591
> >     URB status: Broken pipe (-EPIPE) (-32)
> >     URB length [bytes]: 0
> >     Data length [bytes]: 0
> >     [Request in: 171]
> >     [Time from request: 0.000108000 seconds]
> >     [bInterfaceClass: Unknown (0xffff)]
> > [Malformed Packet: USB]
> >     [Expert Info (Error/Malformed): Malformed Packet (Exception
> > occurred)] [Message: Malformed Packet (Exception occurred)]
> >         [Severity level: Error]
> >         [Group: Malformed]
> > 
> > 0000  c0 bd 9c 2d 03 88 ff ff 43 02 80 22 03 00 2d
> > 00   ...-....C.."..-. 0010  28 26 cf 50 00 00 00 00 af bc 08 00 e0
> > ff ff ff   (&.P............ 0020  00 00 00 00 00 00 00 00 00 00 00
> > 00 00 00 00 00   ................ 0030  00 00 00 00 00 00 00 00 00
> > 02 00 00 00 00 00 00   ................
> 
> 
> And the dfu-util side at the host complains and fails:
> 
> > $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
> > dfu-util 0.7
> > 
> > Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> > Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> > This program is Free Software and has ABSOLUTELY NO WARRANTY
> > Please report bugs to dfu-util@lists.gnumonks.org
> > 
> > Opening DFU capable USB device... ID 0403:bd00
> > Did not find cached descriptor
> > WARNING: Can not find cached DFU functional descriptor
> > Warning: Assuming DFU version 1.0
> > Run-time device DFU version 0100
> > Claiming USB DFU Runtime Interface...
> > Determining device status: state = appIDLE, status = 0
> > Device really in Runtime Mode, send DFU detach request...
> > Resetting USB...
> > Opening DFU USB Device...
> > Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
> > Claiming USB DFU Interface...
> > Setting Alternate Setting #6 ...
> > Determining device status: state = dfuIDLE, status = 0
> > dfuIDLE, continuing
> > Did not find cached descriptor
> > Error obtaining cached DFU functional descriptor
> > **** DUMP of func_dfu ****
> > 	bLength         = 0
> > 	bDescriptorType = 0
> > 	bmAttributes    = 0x00
> > 	wDetachTimeOut  = 0
> > 	wTransferSize   = 0
> > 	bcdDFUVersion   = 0x0000
> > Error obtaining DFU functional descriptor
> > Please report this as a bug!
> > Warning: Assuming DFU version 1.0
> > Warning: Transfer size can not be detected
> > DFU mode device DFU version 0100
> > Error: Transfer size must be specified
> 
> 
> 
> The full set of captures (pcap format) is at 
> 
> dfu -
> https://docs.google.com/folder/d/0B7yJhZ55fi8FOFR3TnVGdTBfbHM/edit
> 
> As to why it works for you Lukasz, I'm puzzled; maybe some difference 
> in the usb gadget peripheral? I would bet that it might refuse to send
> a malformed response, dfu-util will eventually time out and then
> the transfer can continue with some fail-safe defaults.
> 
> In either way, that's bad, and is a bug that the patchset fixes
> correctly.
> 
> Regards
> 
> -- Pantelis
> 
> 
> 
> On Dec 17, 2012, at 1:00 PM, Lukasz Majewski wrote:
> 
> > Hi Marek,
> > 
> >> Pantelis Antoniou (9):
> >>      g_dnl: Issue connect/disconnect as appropriate
> >>      g_dnl: Properly terminate string list.
> >>      dfu: Only perform DFU board_usb_init() for TRATS
> >>      dfu: Fix crash when wrong number of arguments given
> >>      dfu: Send correct DFU response from composite_setup
> >>      dfu: Properly zero out timeout value
> >>      dfu: Add a partition type target
> >>      dfu: Support larger than memory transfers.
> >>      usb: Fix bug when both DFU & ETHER are defined
> > 
> > Can we wait with pulling DFU related patches? 
> > 
> > I didn't received tcpdump from Pantelis, so I don't know what is
> > going on (or how to tackle the DFU problem).
> > 
> > 
> > -- 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > Samsung Poland R&D Center | Linux Platform Group
>
Pantelis Antoniou Dec. 17, 2012, 5:46 p.m. UTC | #7
Hi Lukasz,

Absolutely no chance with a different version of dfu-util:

> $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
> dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 0403:bd00
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> Opening DFU USB Device...
> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=1, name="rootfs"
> Claiming USB DFU Interface...
> Setting Alternate Setting #1 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> Error obtaining DFU functional descriptor
> Please report this as a bug!
> Warning: Assuming DFU version 1.0
> Warning: Transfer size can not be detected
> DFU mode device DFU version 0100
> Error: Transfer size must be specified
> 

Can you paste the log of your dfu-util session? Are you supplying a transfer size for example?

Regards

-- Pantelis

On Dec 17, 2012, at 7:32 PM, Lukasz Majewski wrote:

> Hi Pantelis,
> 
> 
> Thanks for logs. I will go through them and let you know.
> 
> First thing, which I see, that needs to be done is upgrading dfu-util
> (from dfu-util version 0.1+svnexported to dfu-util 0.7)
> 
>> Hi Lukasz,
>> 
>> Sorry for the slight delay, setting up the usb capture took a bit
>> longer.
>> 
>> So we have two captures; one named bad (which is the tip of our
>> internal tree with the commit reverted.
>> 
>> cee8b859fdb9edc68c67624b2fa1c97a65d121e7 
>> "dfu: Send correct DFU response from composite_setup"
>> 
>> With the commit reverted we get this:
>> 
>>> panto@sles11esa:~/ti/stuff/dfu-util$ sudo ./src/dfu-util -v -D
>>> ~/test.img -a rootfs dfu-util 0.7
>>> 
>>> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
>>> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
>>> This program is Free Software and has ABSOLUTELY NO WARRANTY
>>> Please report bugs to dfu-util@lists.gnumonks.org
>>> 
>>> Opening DFU capable USB device... ID 0403:bd00
>>> Did not find cached descriptor
>>> WARNING: Can not find cached DFU functional descriptor
>>> Warning: Assuming DFU version 1.0
>>> Run-time device DFU version 0100
>>> Claiming USB DFU Runtime Interface...
>>> Determining device status: state = appIDLE, status = 0
>>> Device really in Runtime Mode, send DFU detach request...
>>> Resetting USB...
>>> Opening DFU USB Device...
>>> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
>>> Claiming USB DFU Interface...
>>> Setting Alternate Setting #6 ...
>>> Determining device status: state = dfuIDLE, status = 0
>>> dfuIDLE, continuing
>>> Did not find cached descriptor
>>> Error obtaining cached DFU functional descriptor
>>> **** DUMP of func_dfu ****
>>> 	bLength         = 0
>>> 	bDescriptorType = 0
>>> 	bmAttributes    = 0x00
>>> 	wDetachTimeOut  = 0
>>> 	wTransferSize   = 0
>>> 	bcdDFUVersion   = 0x0000
>>> Error obtaining DFU functional descriptor
>>> Please report this as a bug!
>>> Warning: Assuming DFU version 1.0
>>> Warning: Transfer size can not be detected
>>> DFU mode device DFU version 0100
>>> Error: Transfer size must be specified
>>> 
>> 
>> Looking at the capture file (usb-capture-bad-filter.pcap) we see the
>> culprit at packet 171 at bad capture and packet 169 at the good.
>> 
>>> USB URB
>>>    URB id: 0xffff88032d9cbdc0
>>>    URB type: URB_SUBMIT ('S')
>>>    URB transfer type: URB_CONTROL (0x02)
>>>    Endpoint: 0x80, Direction: IN
>>>        1... .... = Direction: IN (1)
>>>        .000 0000 = Endpoint value: 0
>>>    Device: 34
>>>    URB bus id: 3
>>>    Device setup request: relevant (0)
>>>    Data: not present ('<')
>>>    URB sec: 1355753000
>>>    URB usec: 572483
>>>    URB status: Operation now in progress (-EINPROGRESS) (-115)
>>>    URB length [bytes]: 9
>>>    Data length [bytes]: 0
>>>    [Response in: 172]
>>> URB setup
>>>    bmRequestType: 0x80
>>>        1... .... = Direction: Device-to-host
>>>        .00. .... = Type: Standard (0x00)
>>>        ...0 0000 = Recipient: Device (0x00)
>>>    bRequest: GET DESCRIPTOR (6)
>>>    Descriptor Index: 0x00
>>>    bDescriptorType: HID (33)
>>>    Language Id: no language specified (0x0000)
>>>    wLength: 9
>>> 
>>> 0000  c0 eb 99 28 03 88 ff ff 53 02 80 20 03 00 00
>>> 3c   ...(....S.. ...< 0010  d6 0e cf 50 00 00 00 00 a3 bf 0a 00 8d
>>> ff ff ff   ...P............ 0020  09 00 00 00 00 00 00 00 80 06 00
>>> 21 00 00 09 00   ...........!.... 0030  00 00 00 00 00 00 00 00 00
>>> 02 00 00 00 00 00 00   ................
>>> 
>> 
>> 
>> The response generated when the fix is applied is correct:
>> 
>>> USB URB
>>>    URB id: 0xffff88032899ebc0
>>>    URB type: URB_COMPLETE ('C')
>>>    URB transfer type: URB_CONTROL (0x02)
>>>    Endpoint: 0x80, Direction: IN
>>>        1... .... = Direction: IN (1)
>>>        .000 0000 = Endpoint value: 0
>>>    Device: 32
>>>    URB bus id: 3
>>>    Device setup request: not relevant ('-')
>>>    Data: present (0)
>>>    URB sec: 1355747030
>>>    URB usec: 704533
>>>    URB status: Success (0)
>>>    URB length [bytes]: 9
>>>    Data length [bytes]: 9
>>>    [Request in: 169]
>>>    [Time from request: 0.000114000 seconds]
>>>    [bInterfaceClass: Unknown (0xffff)]
>>> GET DESCRIPTOR data (unknown descriptor type 33)
>>> 
>>> 0000  c0 eb 99 28 03 88 ff ff 43 02 80 20 03 00 2d
>>> 00   ...(....C.. ..-. 0010  d6 0e cf 50 00 00 00 00 15 c0 0a 00 00
>>> 00 00 00   ...P............ 0020  09 00 00 00 09 00 00 00 00 00 00
>>> 00 00 00 00 00   ................ 0030  00 00 00 00 00 00 00 00 00
>>> 02 00 00 00 00 00 00   ................ 0040  09 21 0f 00 00 00 10
>>> 10 01                        .!.......
>> 
>> 
>> Note that wireshark can't decode it - no DFU dissector.
>> 
>> And the dfu-util side:
>> 
>>> $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
>>> dfu-util 0.7
>>> 
>>> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
>>> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
>>> This program is Free Software and has ABSOLUTELY NO WARRANTY
>>> Please report bugs to dfu-util@lists.gnumonks.org
>>> 
>>> Opening DFU capable USB device... ID 0403:bd00
>>> Did not find cached descriptor
>>> WARNING: Can not find cached DFU functional descriptor
>>> Warning: Assuming DFU version 1.0
>>> Run-time device DFU version 0100
>>> Claiming USB DFU Runtime Interface...
>>> Determining device status: state = appIDLE, status = 0
>>> Device really in Runtime Mode, send DFU detach request...
>>> Resetting USB...
>>> Opening DFU USB Device...
>>> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
>>> Claiming USB DFU Interface...
>>> Setting Alternate Setting #6 ...
>>> Determining device status: state = dfuIDLE, status = 0
>>> dfuIDLE, continuing
>>> Did not find cached descriptor
>>> Error obtaining cached DFU functional descriptor
>>> **** DUMP of func_dfu ****
>>> 	bLength         = 9
>>> 	bDescriptorType = 33
>>> 	bmAttributes    = 0x0f
>>> 	wDetachTimeOut  = 0
>>> 	wTransferSize   = 4096
>>> 	bcdDFUVersion   = 0x0110
>>> DFU mode device DFU version 0110
>>> Device returned transfer size 4096
>>> No valid DFU suffix signature
>>> Warning: File has no DFU suffix
>>> bytes_per_hash=335554
>>> Copying data from PC to DFU device
>>> Starting download:
>>> [##################################################] finished! Sent
>>> a total of 16777728 bytes state(2) = dfuIDLE, status(0) = No error
>>> condition is present Done!
>>> 
>>> 
>> 
>> 
>> The response is malformed without the fix in the bad capture:
>> 
>>> USB URB
>>>    URB id: 0xffff88032d9cbdc0
>>>    URB type: URB_COMPLETE ('C')
>>>    URB transfer type: URB_CONTROL (0x02)
>>>    Endpoint: 0x80, Direction: IN
>>>        1... .... = Direction: IN (1)
>>>        .000 0000 = Endpoint value: 0
>>>    Device: 34
>>>    URB bus id: 3
>>>    Device setup request: not relevant ('-')
>>>    Data: present (0)
>>>    URB sec: 1355753000
>>>    URB usec: 572591
>>>    URB status: Broken pipe (-EPIPE) (-32)
>>>    URB length [bytes]: 0
>>>    Data length [bytes]: 0
>>>    [Request in: 171]
>>>    [Time from request: 0.000108000 seconds]
>>>    [bInterfaceClass: Unknown (0xffff)]
>>> [Malformed Packet: USB]
>>>    [Expert Info (Error/Malformed): Malformed Packet (Exception
>>> occurred)] [Message: Malformed Packet (Exception occurred)]
>>>        [Severity level: Error]
>>>        [Group: Malformed]
>>> 
>>> 0000  c0 bd 9c 2d 03 88 ff ff 43 02 80 22 03 00 2d
>>> 00   ...-....C.."..-. 0010  28 26 cf 50 00 00 00 00 af bc 08 00 e0
>>> ff ff ff   (&.P............ 0020  00 00 00 00 00 00 00 00 00 00 00
>>> 00 00 00 00 00   ................ 0030  00 00 00 00 00 00 00 00 00
>>> 02 00 00 00 00 00 00   ................
>> 
>> 
>> And the dfu-util side at the host complains and fails:
>> 
>>> $ sudo ./src/dfu-util -v -D ~/test.img -a rootfs
>>> dfu-util 0.7
>>> 
>>> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
>>> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
>>> This program is Free Software and has ABSOLUTELY NO WARRANTY
>>> Please report bugs to dfu-util@lists.gnumonks.org
>>> 
>>> Opening DFU capable USB device... ID 0403:bd00
>>> Did not find cached descriptor
>>> WARNING: Can not find cached DFU functional descriptor
>>> Warning: Assuming DFU version 1.0
>>> Run-time device DFU version 0100
>>> Claiming USB DFU Runtime Interface...
>>> Determining device status: state = appIDLE, status = 0
>>> Device really in Runtime Mode, send DFU detach request...
>>> Resetting USB...
>>> Opening DFU USB Device...
>>> Found DFU: [0403:bd00] devnum=0, cfg=2, intf=0, alt=6, name="rootfs"
>>> Claiming USB DFU Interface...
>>> Setting Alternate Setting #6 ...
>>> Determining device status: state = dfuIDLE, status = 0
>>> dfuIDLE, continuing
>>> Did not find cached descriptor
>>> Error obtaining cached DFU functional descriptor
>>> **** DUMP of func_dfu ****
>>> 	bLength         = 0
>>> 	bDescriptorType = 0
>>> 	bmAttributes    = 0x00
>>> 	wDetachTimeOut  = 0
>>> 	wTransferSize   = 0
>>> 	bcdDFUVersion   = 0x0000
>>> Error obtaining DFU functional descriptor
>>> Please report this as a bug!
>>> Warning: Assuming DFU version 1.0
>>> Warning: Transfer size can not be detected
>>> DFU mode device DFU version 0100
>>> Error: Transfer size must be specified
>> 
>> 
>> 
>> The full set of captures (pcap format) is at 
>> 
>> dfu -
>> https://docs.google.com/folder/d/0B7yJhZ55fi8FOFR3TnVGdTBfbHM/edit
>> 
>> As to why it works for you Lukasz, I'm puzzled; maybe some difference 
>> in the usb gadget peripheral? I would bet that it might refuse to send
>> a malformed response, dfu-util will eventually time out and then
>> the transfer can continue with some fail-safe defaults.
>> 
>> In either way, that's bad, and is a bug that the patchset fixes
>> correctly.
>> 
>> Regards
>> 
>> -- Pantelis
>> 
>> 
>> 
>> On Dec 17, 2012, at 1:00 PM, Lukasz Majewski wrote:
>> 
>>> Hi Marek,
>>> 
>>>> Pantelis Antoniou (9):
>>>>     g_dnl: Issue connect/disconnect as appropriate
>>>>     g_dnl: Properly terminate string list.
>>>>     dfu: Only perform DFU board_usb_init() for TRATS
>>>>     dfu: Fix crash when wrong number of arguments given
>>>>     dfu: Send correct DFU response from composite_setup
>>>>     dfu: Properly zero out timeout value
>>>>     dfu: Add a partition type target
>>>>     dfu: Support larger than memory transfers.
>>>>     usb: Fix bug when both DFU & ETHER are defined
>>> 
>>> Can we wait with pulling DFU related patches? 
>>> 
>>> I didn't received tcpdump from Pantelis, so I don't know what is
>>> going on (or how to tackle the DFU problem).
>>> 
>>> 
>>> -- 
>>> Best regards,
>>> 
>>> Lukasz Majewski
>>> 
>>> Samsung Poland R&D Center | Linux Platform Group
>> 
> 
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group
Łukasz Majewski Dec. 18, 2012, 11:25 a.m. UTC | #8
Hi Pantelis,

> Can you paste the log of your dfu-util session? Are you supplying a
> transfer size for example?
> 
> Regards

u-boot-denx/master (denx.de) repository

SHA1: fd4d564b3c80b111f18c93adb14233a6a7ddb0e9

(without Pantelis patches)

dfu-util version 0.7 (not working):

lukma@amdc308:~/work/u-boot-denx(master)$ ../dfu-util/src/dfu-util -V
-v -t 0x1000 -a0 -D u-boot.bin dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Opening DFU capable USB device... ID 04e8:6601
Did not find cached descriptor
WARNING: Can not find cached DFU functional descriptor
Warning: Assuming DFU version 1.0
Run-time device DFU version 0100
Found DFU: [04e8:6601] devnum=0, cfg=2, intf=0, alt=0, name="u-boot"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Did not find cached descriptor
Error obtaining cached DFU functional descriptor
Error obtaining DFU functional descriptor
Please report this as a bug!
Warning: Assuming DFU version 1.0
Warning: Transfer size can not be detected
DFU mode device DFU version 0100
Error: Transfer size must be specified

Broken.

dfu-util version.  0.1+svnexported (available at debian repository
(0.0+r4067-3.1))

lukma@amdc308:~/work/u-boot-denx(master)$ dfu-util -v -t 0x1000 -a0 -D
u-boot.bin dfu-util - (C) 2007 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY

Opening USB Device 0x0000:0x0000...
Found Runtime: [0x04e8:0x6601] devnum=77, cfg=0, intf=0, alt=0,
name="u-boot" Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Error obtaining DFU functional descriptor: error sending control
message: Broken pipe Transfer Size = 0x1000
bytes_per_hash=5591
Starting download: [##################################################]
finished! state(2) = dfuIDLE, status(0) = No error condition is present
Done!

WORKS.

Ok, so world has went forward..... And I've left behind :-/. 


With Pantelis Patches: 

lukma@amdc308:~/work/u-boot-denx(NEW_DFU)$ ../dfu-util/src/dfu-util -V
-v -t 0x1000 -a0 -D u-boot.bin dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Opening DFU capable USB device... ID 04e8:6601
Did not find cached descriptor
WARNING: Can not find cached DFU functional descriptor
Warning: Assuming DFU version 1.0
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = appIDLE, status = 0
Device really in Runtime Mode, send DFU detach request...
Resetting USB...
Opening DFU USB Device...
Found DFU: [04e8:6601] devnum=0, cfg=2, intf=0, alt=0, name="u-boot"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Did not find cached descriptor
Error obtaining cached DFU functional descriptor
DFU mode device DFU version 0110
Device returned transfer size 4096
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=6280
Copying data from PC to DFU device
Starting download: [##################################################]
finished! Sent a total of 314004 bytes
state(2) = dfuIDLE, status(0) = No error condition is present
Done!


Ok, so it seems to work (CRC is correct, system boots). The reason
of the turmoil from my side was the VERY OLD version of dfu-utils,
which I've used for testing. 

I will thoroughly test this and let you know about the result. 
The only thing, which I see as a problem (in this patch series) is:

+
+#ifdef CONFIG_DFU_FUNCTION
+		/* DFU is mighty weird */
+		case DFU_DT_FUNC:

at ./gadget/composite.c

Since I now know how to reproduce/test the problem I will try to
remove this #ifdef.

After all this I have a huge "moral hangover".....
Pantelis Antoniou Dec. 18, 2012, 12:01 p.m. UTC | #9
Hi Lukasz,

Mystery solved then :)

On Dec 18, 2012, at 1:25 PM, Lukasz Majewski wrote:

> Hi Pantelis,
> 
>> Can you paste the log of your dfu-util session? Are you supplying a
>> transfer size for example?
>> 
>> Regards
> 
> u-boot-denx/master (denx.de) repository
> 
> SHA1: fd4d564b3c80b111f18c93adb14233a6a7ddb0e9
> 
> (without Pantelis patches)
> 
> dfu-util version 0.7 (not working):
> 
> lukma@amdc308:~/work/u-boot-denx(master)$ ../dfu-util/src/dfu-util -V
> -v -t 0x1000 -a0 -D u-boot.bin dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 04e8:6601
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Found DFU: [04e8:6601] devnum=0, cfg=2, intf=0, alt=0, name="u-boot"
> Claiming USB DFU Interface...
> Setting Alternate Setting #0 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> Error obtaining DFU functional descriptor
> Please report this as a bug!
> Warning: Assuming DFU version 1.0
> Warning: Transfer size can not be detected
> DFU mode device DFU version 0100
> Error: Transfer size must be specified
> 
> Broken.
> 

Newer version appears to expect the transfer size to be supplied by
the device in order to work.

> dfu-util version.  0.1+svnexported (available at debian repository
> (0.0+r4067-3.1))
> 
> lukma@amdc308:~/work/u-boot-denx(master)$ dfu-util -v -t 0x1000 -a0 -D
> u-boot.bin dfu-util - (C) 2007 by OpenMoko Inc.
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> 
> Opening USB Device 0x0000:0x0000...
> Found Runtime: [0x04e8:0x6601] devnum=77, cfg=0, intf=0, alt=0,
> name="u-boot" Claiming USB DFU Interface...
> Setting Alternate Setting ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Error obtaining DFU functional descriptor: error sending control
> message: Broken pipe Transfer Size = 0x1000
> bytes_per_hash=5591
> Starting download: [##################################################]
> finished! state(2) = dfuIDLE, status(0) = No error condition is present
> Done!
> 
> WORKS.
> 

I bet it only works because you supply the transfer size. Try omitting it
and see what happens.

> Ok, so world has went forward..... And I've left behind :-/. 
> 
> 
> With Pantelis Patches: 
> 
> lukma@amdc308:~/work/u-boot-denx(NEW_DFU)$ ../dfu-util/src/dfu-util -V
> -v -t 0x1000 -a0 -D u-boot.bin dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 04e8:6601
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> Opening DFU USB Device...
> Found DFU: [04e8:6601] devnum=0, cfg=2, intf=0, alt=0, name="u-boot"
> Claiming USB DFU Interface...
> Setting Alternate Setting #0 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> DFU mode device DFU version 0110
^ correct DFU version detected
> Device returned transfer size 4096
^ and optimal transfer size

> No valid DFU suffix signature
> Warning: File has no DFU suffix
> bytes_per_hash=6280
> Copying data from PC to DFU device
> Starting download: [##################################################]
> finished! Sent a total of 314004 bytes
> state(2) = dfuIDLE, status(0) = No error condition is present
> Done!
> 
> 
> Ok, so it seems to work (CRC is correct, system boots). The reason
> of the turmoil from my side was the VERY OLD version of dfu-utils,
> which I've used for testing. 
> 
> I will thoroughly test this and let you know about the result. 
> The only thing, which I see as a problem (in this patch series) is:
> 
> +
> +#ifdef CONFIG_DFU_FUNCTION
> +		/* DFU is mighty weird */
> +		case DFU_DT_FUNC:
> 
> at ./gadget/composite.c
> 

It is weird. Wireshark for example decodes this as an HID class transfer, which
is certainly not. I don't know the exact details of the DFU protocol, but it is
possible that they didn't bother obtaining a real ID from the usb forum.

> Since I now know how to reproduce/test the problem I will try to
> remove this #ifdef.
> 
> After all this I have a huge "moral hangover".....
> 

No harm done. There is no such thing as a polite _and_ good engineer.
You always have to choose, and IMHO it's better to be a good one,
never mind the ruffled feathers :)

Cheers!

-- Pantelis

> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group
Stefan Schmidt Dec. 21, 2012, 6:55 p.m. UTC | #10
Hello.

On Tue, 2012-12-18 at 12:25, Lukasz Majewski wrote:
> 
> > Can you paste the log of your dfu-util session? Are you supplying a
> > transfer size for example?
> > 
> > Regards
> 
> u-boot-denx/master (denx.de) repository
> 
> SHA1: fd4d564b3c80b111f18c93adb14233a6a7ddb0e9
> 
> (without Pantelis patches)
> 
> dfu-util version 0.7 (not working):
> 
> lukma@amdc308:~/work/u-boot-denx(master)$ ../dfu-util/src/dfu-util -V
> -v -t 0x1000 -a0 -D u-boot.bin dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 04e8:6601
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Found DFU: [04e8:6601] devnum=0, cfg=2, intf=0, alt=0, name="u-boot"
> Claiming USB DFU Interface...
> Setting Alternate Setting #0 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> Error obtaining DFU functional descriptor
> Please report this as a bug!
> Warning: Assuming DFU version 1.0
> Warning: Transfer size can not be detected
> DFU mode device DFU version 0100
> Error: Transfer size must be specified
> 
> Broken.
> 
> dfu-util version.  0.1+svnexported (available at debian repository
> (0.0+r4067-3.1))
> 
> lukma@amdc308:~/work/u-boot-denx(master)$ dfu-util -v -t 0x1000 -a0 -D
> u-boot.bin dfu-util - (C) 2007 by OpenMoko Inc.
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> 
> Opening USB Device 0x0000:0x0000...
> Found Runtime: [0x04e8:0x6601] devnum=77, cfg=0, intf=0, alt=0,
> name="u-boot" Claiming USB DFU Interface...
> Setting Alternate Setting ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Error obtaining DFU functional descriptor: error sending control
> message: Broken pipe Transfer Size = 0x1000
> bytes_per_hash=5591
> Starting download: [##################################################]
> finished! state(2) = dfuIDLE, status(0) = No error condition is present
> Done!
> 
> WORKS.
> 
> Ok, so world has went forward..... And I've left behind :-/. 
> 
> 
> With Pantelis Patches: 
> 
> lukma@amdc308:~/work/u-boot-denx(NEW_DFU)$ ../dfu-util/src/dfu-util -V
> -v -t 0x1000 -a0 -D u-boot.bin dfu-util 0.7
> 
> Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
> Copyright 2010-2012 Tormod Volden and Stefan Schmidt
> This program is Free Software and has ABSOLUTELY NO WARRANTY
> Please report bugs to dfu-util@lists.gnumonks.org
> 
> Opening DFU capable USB device... ID 04e8:6601
> Did not find cached descriptor
> WARNING: Can not find cached DFU functional descriptor
> Warning: Assuming DFU version 1.0
> Run-time device DFU version 0100
> Claiming USB DFU Runtime Interface...
> Determining device status: state = appIDLE, status = 0
> Device really in Runtime Mode, send DFU detach request...
> Resetting USB...
> Opening DFU USB Device...
> Found DFU: [04e8:6601] devnum=0, cfg=2, intf=0, alt=0, name="u-boot"
> Claiming USB DFU Interface...
> Setting Alternate Setting #0 ...
> Determining device status: state = dfuIDLE, status = 0
> dfuIDLE, continuing
> Did not find cached descriptor
> Error obtaining cached DFU functional descriptor
> DFU mode device DFU version 0110
> Device returned transfer size 4096
> No valid DFU suffix signature
> Warning: File has no DFU suffix
> bytes_per_hash=6280
> Copying data from PC to DFU device
> Starting download: [##################################################]
> finished! Sent a total of 314004 bytes
> state(2) = dfuIDLE, status(0) = No error condition is present
> Done!
> 
> 
> Ok, so it seems to work (CRC is correct, system boots). The reason
> of the turmoil from my side was the VERY OLD version of dfu-utils,
> which I've used for testing. 


Indeed that was the problem. We changed quite a bit in dfu-util to get
the actual informations from the USB functional descriptor. And it
seems that was not provided correctly from the u-boot DFU
implementation before. Good to have that fixed.

We are really careful not to introduce regressions when going forward
with dfu-util but some stuff is just way to problematic to keep when
moving on.

I wonder where you actually got such an old version of dfu-util. We
work together with packagers to get new versions in all recent
distros. Might be worth to fill a bug about updting it for yours.

regards
Stefan Schmidt
Łukasz Majewski Dec. 27, 2012, 7:52 a.m. UTC | #11
Hi Stefan,

> I wonder where you actually got such an old version of dfu-util.
I use the stable debian repository:
 http://ftp.se.debian.org stable

And it is still there (version:
dfu-util version 0.1+svnexported)
 
> We
> work together with packagers to get new versions in all recent
> distros. Might be worth to fill a bug about updting it for yours.

Anyway thanks for explanation.
Stefan Schmidt Dec. 28, 2012, 2:03 p.m. UTC | #12
Hello.

On Thu, 2012-12-27 at 08:52, Lukasz Majewski wrote:
> 
> > I wonder where you actually got such an old version of dfu-util.
> I use the stable debian repository:
>  http://ftp.se.debian.org stable
>
> And it is still there (version:
> dfu-util version 0.1+svnexported)

Well, Debian stable is nothing we can change. They don't update
packages. The unstable and testing versions have 0.5 and I filled a
bug for an update to 0.7 just some minutes ago.

regards
Stefan Schmidt
Lukasz Majewski Dec. 29, 2012, 2:42 p.m. UTC | #13
Hi Stefan,

> Hello.
> 
> On Thu, 2012-12-27 at 08:52, Lukasz Majewski wrote:
> > 
> > > I wonder where you actually got such an old version of dfu-util.
> > I use the stable debian repository:
> >  http://ftp.se.debian.org stable
> >
> > And it is still there (version:
> > dfu-util version 0.1+svnexported)
> 
> Well, Debian stable is nothing we can change. 

I use stable for production machine - just because it is "stable" :-).

> They don't update
> packages. The unstable and testing versions have 0.5 and I filled a
> bug for an update to 0.7 just some minutes ago.

Thanks a lot.
> 
Regards,
Lukasz Majewski