Skip to content

Commit

Permalink
[nrf fromtree] Fix BDX transfer resumption
Browse files Browse the repository at this point in the history
When OTA is interrupted in the middle of a BDX transfer
and the transfer is then re-initiated after the 5-minute
idle timeout, it may fail with the following error:

dfu_target_stream: stream_flash_buffered_write error -12

Signed-off-by: Damian Krolik <[email protected]>

(cherry picked from commit 5e6279cc1debd0bb9da0a97dd82592f089a0c920)
  • Loading branch information
markaj-nordic authored and kkasperczyk-no committed Sep 9, 2022
1 parent cafa0cd commit 6cfff04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/platform/nrfconnect/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ CHIP_ERROR OTAImageProcessorImpl::PrepareDownloadImpl()
writer.image_id = image_id;
writer.open = [](int id, size_t size) { return dfu_target_init(DFU_TARGET_IMAGE_TYPE_MCUBOOT, id, size, nullptr); };
writer.write = [](const uint8_t * chunk, size_t chunk_size) { return dfu_target_write(chunk, chunk_size); };
writer.close = [](bool success) { return dfu_target_done(success); };
writer.close = [](bool success) { return success ? dfu_target_done(success) : dfu_target_reset(); };

ReturnErrorOnFailure(System::MapErrorZephyr(dfu_multi_image_register_writer(&writer)));
};
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nrfconnect/OTAImageProcessorImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface
bool IsFirstImageRun() override;
CHIP_ERROR ConfirmCurrentImage() override;

private:
protected:
CHIP_ERROR PrepareDownloadImpl();
CHIP_ERROR ProcessHeader(ByteSpan & aBlock);

Expand Down

0 comments on commit 6cfff04

Please sign in to comment.