Skip to content

Commit

Permalink
dfuse: Allow direct transition to DNLOAD_IDLE on special command
Browse files Browse the repository at this point in the history
It seems that the DFU 1.1 specification (Appendix A. Interface State
Summary) allows a transition from dfuIDLE (by DFU_DNLOAD request) to
dfuDNLOAD-SYNC, then to dfuDNLOAD-IDLE (by DFU_GETSTATUS request) if the
block is complete, without going via dfuDNBUSY.

For a DfuSe special command DFU_DNLOAD request like SET_ADDRESS this
could make sense. This behavior has been seen on a STM32U5A9BJ
bootloader.

Thanks to Markus Pope for analysis and initial patch.

https://sourceforge.net/p/dfu-util/tickets/145/

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
  • Loading branch information
tormodvolden committed Apr 16, 2024
1 parent 570e0c9 commit be49612
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dfuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static int dfuse_special_command(struct dfu_if *dif, unsigned int address,
}
if (firstpoll) {
firstpoll = 0;
if (dst.bState != DFU_STATE_dfuDNBUSY) {
if (dst.bState != DFU_STATE_dfuDNBUSY && dst.bState != DFU_STATE_dfuDNLOAD_IDLE) {
fprintf(stderr, "DFU state(%u) = %s, status(%u) = %s\n", dst.bState,
dfu_state_to_string(dst.bState), dst.bStatus,
dfu_status_to_string(dst.bStatus));
Expand Down

0 comments on commit be49612

Please sign in to comment.