From cbdeca25e2d43773a83206c5f177d5cd6d145759 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 12 Oct 2016 20:36:21 +0100 Subject: [PATCH] libdfu: Fix uploading from DfuSe devices --- libdfu/dfu-target.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libdfu/dfu-target.c b/libdfu/dfu-target.c index db3e439a0..f1fa5f1b9 100644 --- a/libdfu/dfu-target.c +++ b/libdfu/dfu-target.c @@ -951,6 +951,9 @@ dfu_target_upload_element (DfuTarget *target, (guint) offset); return NULL; } + g_debug ("using sector %u for read of %x", + dfu_sector_get_id (sector), + offset); if (!dfu_sector_has_cap (sector, DFU_SECTOR_CAP_READABLE)) { g_set_error (error, DFU_ERROR, @@ -970,6 +973,10 @@ dfu_target_upload_element (DfuTarget *target, return NULL; last_sector_id = dfu_sector_get_id (sector); } + + /* abort back to IDLE */ + if (!dfu_device_abort (priv->device, cancellable, error)) + return FALSE; } /* read chunk of data */ @@ -1005,6 +1012,12 @@ dfu_target_upload_element (DfuTarget *target, break; } + /* abort back to IDLE */ + if (dfu_device_has_dfuse_support (priv->device)) { + if (!dfu_device_abort (priv->device, cancellable, error)) + return FALSE; + } + /* check final size */ if (expected_size > 0) { if (total_size != expected_size) {