Files
Jacob Dahl ee002b1db6 fix(tools/uploader): handle USB CDC reconnect race during reboot (#27419)
After sending reboot-to-bootloader, the PX4 USB CDC node briefly
disappears while the bootloader re-enumerates. Reopening the serial
port can land on a half-broken descriptor and the next tcdrain()
raises termios.error (5, 'Input/output error'). That bare OSError
escaped every retry layer and crashed the uploader, even though a
manual re-run would succeed once enumeration settled.

Convert OSError/SerialException from flush() and reset_buffers() into
the module's ConnectionError, matching how send()/recv() already
behave, and let the identify retry loops in _try_identify also catch
ConnectionError so a single transient I/O hiccup doesn't abort the
upload.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-05-20 19:08:53 -06:00
..