mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-30 10:28:14 +00:00
fix(core): improve reliability of nrf update
[no changelog]
This commit is contained in:
parent
d5d921d3d4
commit
62fbc019b9
@ -139,11 +139,18 @@ bool nrf_update(const uint8_t *image_ptr, size_t image_len) {
|
||||
sha256_Update(&ctx, image_ptr, image_len);
|
||||
sha256_Final(&ctx, sha256);
|
||||
|
||||
smp_upload_app_image(image_ptr, image_len, sha256, SHA256_DIGEST_LENGTH);
|
||||
uint8_t try_cntr = 0;
|
||||
|
||||
bool result = false;
|
||||
do {
|
||||
result = smp_upload_app_image(image_ptr, image_len, sha256,
|
||||
SHA256_DIGEST_LENGTH);
|
||||
try_cntr++;
|
||||
} while (!result && try_cntr < 3);
|
||||
|
||||
smp_reset();
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ pub fn upload_image(image_data: &[u8], image_hash: &[u8]) -> bool {
|
||||
if wait_for_response(
|
||||
MsgType::ImageUploadResponse,
|
||||
&mut resp_buffer,
|
||||
Duration::from_millis(100),
|
||||
Duration::from_millis(500),
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
@ -87,7 +87,7 @@ pub fn upload_image(image_data: &[u8], image_hash: &[u8]) -> bool {
|
||||
if wait_for_response(
|
||||
MsgType::ImageUploadResponse,
|
||||
&mut resp_buffer,
|
||||
Duration::from_millis(100),
|
||||
Duration::from_millis(500),
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user