From 6e09e4dfdcd4f14f56e11f45dd00846f683dddde Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sat, 14 Nov 2020 17:17:30 +0100 Subject: [PATCH] dfuse: Set address pointer before leave if we have a start address During an addressed download or upload we may have been moving the device address pointer around so we need to set it back before the leave request. https://sourceforge.net/p/dfu-util/tickets/99/ Signed-off-by: Tormod Volden --- src/dfuse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dfuse.c b/src/dfuse.c index c04bbf4..499ed11 100644 --- a/src/dfuse.c +++ b/src/dfuse.c @@ -403,6 +403,8 @@ int dfuse_do_upload(struct dfu_if *dif, int xfer_size, int fd, dfu_abort_to_idle(dif); if (dfuse_leave) { + if (dfuse_address_present) + dfuse_special_command(dif, dfuse_address, SET_ADDRESS); dfuse_dnload_chunk(dif, NULL, 0, 2); /* Zero-size */ } @@ -727,6 +729,8 @@ int dfuse_do_dnload(struct dfu_if *dif, int xfer_size, struct dfu_file *file, } if (dfuse_leave) { + if (dfuse_address_present) + dfuse_special_command(dif, dfuse_address, SET_ADDRESS); dfuse_dnload_chunk(dif, NULL, 0, 2); /* Zero-size */ } return ret;