openmoko dfu-util improvements (patch & questions)

Stefan Schmidt stefan at
Sat Apr 3 23:36:37 CEST 2010


On Sat, 2010-04-03 at 20:26, Sandro Giessl wrote:
> However, there are some small things we want to add to work with our devices 
> and to conform with the DFU 1.0 spec, in particular:
> DFU_GETSTATUS ignores bwPollTimeout but does hardcoded usleep(5000) when doing 
> DFU download:
> This is a show-stoper for us, since this delay is too short and results in 
> libusb 'Broken pipe' errors.
> A patch implementing proper timeout handling is attached.

Nice to see other people using it.

> My question is, do you see a chance in getting these things upstream?
> Since some distros are shipping slightly different SVN revisions, do you plan a 
> real dfu-util release any time soon?

As Paul already pointed out the biggest problem is that we don't have a real
maintainer for it. I think Harald is way to busy with other things and nobody
stepped up to take care of fixing problems going forward to a real release. The
download part is quite stable I think, at least on the Openmoko phones and I
already heard from people that it shoudl also detect various BT devices. The
last time I tested upload was broken though.

> --- ../dfu-util-openmoko/src/sam7dfu.c	2010-04-03 18:35:40.000000000 +0200

Hmm, this is no longer only sam7 related. Seems like a historical fragment from
the pre-OM days. (Some of the code was already used on the OpenPCD project).

> +++ src/sam7dfu.c	2010-04-03 20:04:11.000000000 +0200
> @@ -2,6 +2,8 @@
>   * USB DFU 1.0 Spec.  Not overloaded like the Atmel one...
>   *
>   * (C) 2007-2008 by Harald Welte <laforge at>
> + * (C) 2010      by Sandro Giessl <s.giessl at>
> + *                  Daniel Hiepler <d.hiepler at>
>   */

Aehm, I don't think 2 lines of code change plus three lines comments justify the
copyright addition of two people...

>  #include <stdio.h>
> @@ -143,7 +145,10 @@ int sam7dfu_do_dnload(struct usb_dev_han
>  				fprintf(stderr, "Error during download get_status\n");
>  				goto out_close;
>  			}
> -			usleep(5000);
> +                        /* respect bwPollTimeout (in msec) the device
> +                           expects the host to wait before subsequent
> +                           DFU_GETSTATUS (DFU 1.0, section 6.1.2) */
> +			usleep(dst.bwPollTimeout*1000);
>  		} while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE);
>  		if (dst.bStatus != DFU_STATUS_OK) {
>  			printf(" failed!\n");

Did you test if bwPollTimeout is really filled from u-boot on the Openmoko

Stefan Schmidt

More information about the devel mailing list