Re: dfu: Does is work for anybody with dfu-util 0.9?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 11, 2019 at 11:22:35AM +0100, Ladislav Michl wrote:
> Hi,
> 
> I'm using DFU to download firmware to AT91 based device. Registered
> configurations are:
> dfu: register alt0(bootstrap) with device /dev/dataflash0.at91bootstrap
> dfu: register alt1(bootloader) with device /dev/dataflash0.barebox
> dfu: register alt2(system) with device /dev/nand0.bb
> So with the bit of luck even bootstrap is upgradable using DFU, however
> dfu-util refuses doing anything, bailing out here on dfu_root->next
> not being NULL:
> 

dfu stopped working for me with the following dfu-utils commit. I never
came along fixing it, but a proper patch would surely be welcomed.

Sascha


------------------------------8<--------------------------------

>From 377f6f136d3369529f44578acaeee82d7c7d7af9 Mon Sep 17 00:00:00 2001
From: Paul Fertser <fercerpav@xxxxxxxxx>
Date: Sun, 10 Aug 2014 14:26:05 +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 is
already in the right mode, matching on alt setting number or name
should be skipped.

Fixes regression on OpenMoko Freerunner.

Signed-off-by: Paul Fertser <fercerpav@xxxxxxxxx>
---
 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) {
-- 
2.20.1


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux