mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-08-17 22:29:21 +08:00
* fix(tools/uploader): rediscover CDC port after reboot-to-bootloader
After MAVLink/NSH reboot-to-bootloader the USB CDC node re-enumerates
under a different product string (application vs bootloader). The
uploader kept reopening the original path, so identify raced a vanished
node and only recovered on a later outer-loop rescan — when it recovered
at all.
Close the flight-stack port after sending reboot, wait for re-enumeration,
rebind to whichever matching port appears (preferring anything other than
the path we left), and only then run identify. Exact --port paths that do
not currently exist are no longer treated as live candidates.
* fix(tools/uploader): harden port rediscovery after reboot-to-bootloader
Send the reboot sequence at every configured flight-stack baud rate:
writes at a wrong baud succeed silently on real UARTs, so stopping at
the first "successful" baud never reached the second one. Rank
post-reboot candidates instead of excluding the previous path (the OS
often re-uses the tty number for the bootloader), try newly appeared
nodes first so a pinned app path that vanished with the product string
can still be found, collapse by-id symlinks onto their targets, and
spend one identify attempt per node per pass so a silent wrong device
cannot eat the rediscovery window. Exact-port existence checks only
apply on POSIX (os.path.exists("COM10") is false even when present),
and reboot commands honor --use-protocol-splitter-format again, which
the v2 rewrite had left wired to nothing.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* perf(tools/uploader): load firmware once instead of every retry cycle
The wait-for-bootloader loop re-parsed and re-decompressed the full
image on every ~50 ms retry.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>