Package: dfu-util
Version: 0.0+r4880-1
Severity: normal
Tags: patch

The output on stdout looks odd in 'upload' mode because the upload loop
never actually breaks properly; it always exits through the 'out_close'
path so doesn't print "finished" or terminate the line.  Changing one
'goto out_close' to a 'break' fixes this problem.

The download waits until dfu_get_status returns DFU_STATE_dfuDNLOAD_IDLE,
but if there is a verify or format error, the device will transition to
DFU_STATE_dfuERROR instead, which will result in an infinite loop.

The attached patch fixes both of these problems.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-3-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dfu-util depends on:
ii  libc6                        2.10.2-8    Embedded GNU C Library: Shared lib
ii  libusb-0.1-4                 2:0.1.12-14 userspace USB programming library

dfu-util recommends no packages.

dfu-util suggests no packages.

-- no debconf information
diff -ru dfu-util-0.0+r4880.orig/src/sam7dfu.c dfu-util-0.0+r4880/src/sam7dfu.c
--- dfu-util-0.0+r4880.orig/src/sam7dfu.c	2010-05-20 17:19:07.000000000 -0400
+++ dfu-util-0.0+r4880/src/sam7dfu.c	2010-05-20 17:24:41.000000000 -0400
@@ -60,7 +60,7 @@
 		if (rc < xfer_size) {
 			/* last block, return */
 			ret = total_bytes;
-			goto out_close;
+			break;
 		}
 		putchar('#');
 		fflush(stdout);
@@ -143,7 +143,8 @@
 				goto out_close;
 			}
 			usleep(5000);
-		} while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE);
+		} while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE &&
+			 dst.bState != DFU_STATE_dfuERROR);
 		if (dst.bStatus != DFU_STATUS_OK) {
 			printf(" failed!\n");
 			printf("state(%u) = %s, status(%u) = %s\n", dst.bState,
Only in dfu-util-0.0+r4880/src: sam7dfu.c~

Reply via email to