mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 21:09:41 +08:00
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>