Skip to content

Commit 488f526

Browse files
committed
fix bug #129
1 parent c7d54ef commit 488f526

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tockloader-lib/src/bootloader_serial.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ pub async fn ping_bootloader_and_wait_for_response(
162162
) -> Result<(), TockloaderError> {
163163
let ping_pkt = [ESCAPE_CHAR, Command::Ping as u8];
164164

165-
for _ in 0..30 {
165+
for attempt in 0..30 {
166+
eprintln!("attempt {}", attempt); // Debug purposes
166167
write_bytes(port, &ping_pkt, DEFAULT_TIMEOUT).await?;
167-
let ret = read_bytes(port, 2, DEFAULT_TIMEOUT).await?;
168+
let ret = match read_bytes(port, 2, DEFAULT_TIMEOUT).await {
169+
Ok(buf) => buf,
170+
Err(_) => continue,
171+
};
168172

169173
if ret[1] == Response::Pong as u8 {
170174
return Ok(());

0 commit comments

Comments
 (0)