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

Lukasz Majewski l.majewski at samsung.com
Mon Dec 17 18:32:07 CET 2012


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


More information about the U-Boot mailing list