help needed with dfu-util issue on Freerunner

Tormod Volden lists.tormod at gmail.com
Sun Aug 10 13:47:08 CEST 2014


On Sun, Aug 10, 2014 at 12:26 PM, Paul Fertser wrote:
> Tormod Volden writes:
>> Further, it would be helpful to run dfu-util with gdb or another
>> debugger and step through the enumeration and matching of interfaces,
>> and see why the interface (name) is not recognized.
>
> The reason is that initially freerunner's u-boot is in runtime mode, so
> alt_name comparison fails the first time probe_devices() is invoked, so
> dfu-util has no chance to continue and reset it from runtime to dfu
> mode. A patch inline.

Hi Paul,

Thanks a lot for investigating this! I am Cc'ing the dfu-util list and
preferably we move the conversation there.

So the freerunner does not list the alternate interfaces in runtime
mode? This is actually fine according to the DFU standard, but I
expected it to list them also in runtime mode. I had seen dfu-util -l
list them in earlier reports, but maybe the freerunner was already in
dfu mode in those cases and I missed that.

Can I ask you the favour to send me a lsusb -v dump both from runtime
and dfu mode? it would be good to keep for reference and we have a
device-logs folder for this.

Your patch looks fine, but I would appreciate testing from others on
the dfu-list who have devices that do the runtime/dfu mode switching
and use the alternate name/number matching.

(Paul's original post with patch can be seen non-garbled here:
http://lists.openmoko.org/pipermail/devel/2014-August/007296.html)

>
> PS: regarding configure.ac, it's my strong enough impression that
> MAINTAINER_MODE macro should be removed from there, it only adds
> confusion and never does anything useful IMHO.

I just searched a little for AM_MAINTAINER_MODE and I that see it has
been debated a lot. Looks like some recommend
AM_MAINTAINER_MODE([disabled]). Would that help? I don't know if it is
needed by some distributors, this could be cargo-cult for what I know.

Best regards,
Tormod


>
> From 7af120685753890c6e8f0db1984c4665e4266b5d Mon Sep 17 00:00:00 2001
> From: Paul Fertser <fercerpav at gmail.com>
> Date: Sun, 10 Aug 2014 14:22:15 +0400
> Subject: [PATCH] dfu_util: ignore alt_index/alt_name specification in runtime
>  mode
>
> When the device is in runtime mode it needs to be reset first into DFU
> mode for the list of alternate settings to appear, so unless it's
> already in the right mode, matching on alt setting number or name
> should be skipped.
>
> Signed-off-by: Paul Fertser <fercerpav at gmail.com>
> ---
>  src/dfu_util.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/dfu_util.c b/src/dfu_util.c
> index bb40e94..cc92c19 100644
> --- a/src/dfu_util.c
> +++ b/src/dfu_util.c
> @@ -189,13 +189,17 @@ found_dfu:
>                                 int dfu_mode;
>
>                                 intf = &uif->altsetting[alt_idx];
> -                               if (match_iface_alt_index > -1 && match_iface_alt_index != alt_idx)
> -                                       continue;
> +
>                                 if (intf->bInterfaceClass != 0xfe ||
>                                     intf->bInterfaceSubClass != 1)
>                                         continue;
>
>                                 dfu_mode = (intf->bInterfaceProtocol == 2);
> +
> +                               if (dfu_mode &&
> +                                   match_iface_alt_index > -1 && match_iface_alt_index != alt_idx)
> +                                       continue;
> +
>                                 if (dfu_mode) {
>                                         if ((match_vendor_dfu >= 0 && match_vendor_dfu != desc->idVendor) ||
>                                             (match_product_dfu >= 0 && match_product_dfu != desc->idProduct)) {
> @@ -228,7 +232,8 @@ found_dfu:
>                                         strcpy(serial_name, "UNKNOWN");
>                                 libusb_close(devh);
>
> -                               if (match_iface_alt_name != NULL && strcmp(alt_name, match_iface_alt_name))
> +                               if (dfu_mode &&
> +                                   match_iface_alt_name != NULL && strcmp(alt_name, match_iface_alt_name))
>                                         continue;
>
>                                 if (dfu_mode) {
> --
> 1.8.3.2



More information about the devel mailing list