Ticket #673 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

[PATCH] Handle the DFU status value correctly during download

Reported by: nick@… Owned by: werner@…
Priority: high Milestone:
Component: host utilities Version: current svn head
Severity: normal Keywords: VERIFIED
Cc: buglog@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

During download you can end up in an endless loop if the dst.bStatus changes
to != DFU_STATUS_OK. dfu-util never recovers and keeps sending GET_STATUS
requests.

Fail the transfer as DFU_STATUS seems to indicate a fatal error in all cases
except DFU_STATUS_OK.

Index: sam7dfu.c
===================================================================
--- sam7dfu.c (revision 2384)
+++ sam7dfu.c (working copy)
@@ -127,8 +127,11 @@

goto out_close;

}
usleep(5000);

} while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE
  • dst.bStatus != DFU_STATUS_OK);

+ } while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE);
+ if (dst.bStatus != DFU_STATUS_OK) {
+ printf(" failed!\n");
+ goto get_status;
+ }

hashes_todo = (bytes_sent / bytes_per_hash) - hashes;
hashes += hashes_todo;

Change History

comment:1 Changed 12 years ago by nick@…

... and return a correct error value to the caller, so we get an error in $?
after exit of the program.

Index: sam7dfu.c
===================================================================
--- sam7dfu.c (revision 2384)
+++ sam7dfu.c (working copy)
@@ -127,8 +127,15 @@

goto out_close;

}
usleep(5000);

} while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE
  • dst.bStatus != DFU_STATUS_OK);

+ } while (dst.bState != DFU_STATE_dfuDNLOAD_IDLE);
+ if (dst.bStatus != DFU_STATUS_OK) {
+ printf(" failed!\n");
+ printf("state(%u) = %s, status(%u) = %s\n",
dst.bState,
+ dfu_state_to_string(dst.bState), dst.bStatus,
+ dfu_status_to_string(dst.bStatus));
+ ret = -1;
+ goto out_close;
+ }

hashes_todo = (bytes_sent / bytes_per_hash) - hashes;
hashes += hashes_todo;

comment:2 Changed 12 years ago by laforge@…

  • Status changed from new to assigned

comment:3 Changed 12 years ago by laforge@…

  • Status changed from assigned to closed
  • Resolution set to fixed

thanks, applied in svn rev. 2769.

comment:4 Changed 12 years ago by nick@…

  • Keywords VERIFIED added
Note: See TracTickets for help on using tickets.