Commit 6ba46c0b authored by Jamie McCrae's avatar Jamie McCrae Committed by Andrzej Puzdrowski
Browse files

boot_serial: Fix issue with queued commands



Fixes an issue whereby multiple commands are received and some
are still being processed. This generally arises when a response
takes a long time (e.g. when image decryption is required),
duplicate commands will now send multiple responses but avoids
the bug of future commands being sent to which previous responses
are received.

Signed-off-by: default avatarJamie McCrae <jamie.mccrae@nordicsemi.no>
parent 5c00da45
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1189,6 +1189,10 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
    int max_input;
    int elapsed_in_ms = 0;

#ifndef MCUBOOT_SERIAL_WAIT_FOR_DFU
    bool allow_idle = true;
#endif

    boot_uf = f;
    max_input = sizeof(in_buf);

@@ -1200,7 +1204,10 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
         * from serial console (if single-thread mode is used).
         */
#ifndef MCUBOOT_SERIAL_WAIT_FOR_DFU
        if (allow_idle == true) {
            MCUBOOT_CPU_IDLE();
            allow_idle = false;
        }
#endif
        MCUBOOT_WATCHDOG_FEED();
#ifdef MCUBOOT_SERIAL_WAIT_FOR_DFU
@@ -1208,6 +1215,9 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
#endif
        rc = f->read(in_buf + off, sizeof(in_buf) - off, &full_line);
        if (rc <= 0 && !full_line) {
#ifndef MCUBOOT_SERIAL_WAIT_FOR_DFU
            allow_idle = true;
#endif
            goto check_timeout;
        }
        off += rc;