Repository navigation
rs-fw-update: return recovery result and fix reconnect wait match - #15611
Merged
remibettan merged 1 commit intoAug 30, 2026
Conversation
sysrsbuild-gh-agentic
left a comment
Collaborator
There was a problem hiding this comment.
Auto-generated review by rs-agentic bot.
The fix is correct: update_recovery_device() returns int matching main()'s return type, and adding return properly exits after one recovery pass, preventing fall-through into the runtime update loop. The regression described in the PR is real and this is the right minimal fix.
One pre-existing concern worth noting (see inline comment).
remibettan
force-pushed
the
fix/rs-fw-update-recovery-return-RSDEV-12551
branch
from
August 30, 2026 08:55
31547b9 to
cdfa336
Compare
Nir-Az
approved these changes
Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracked by: RSDEV-12551
Overview: Fix two defects in
rs-fw-update -rthat together produced the reported "timeout then second flash": the recovery result was discarded so execution fell through into the runtime update loop, and the reconnect-wait callback was doing a pointer compare instead of a string compare and never matched.Why
Both regressions were introduced by commit
e9c2afd40("Mipi fixing fw update") when the inline Recovery branch was extracted intoupdate_recovery_device():main()lost thereturn, soupdate_recovery_device()'sEXIT_SUCCESS/EXIT_FAILUREwas ignored andmain()fell through to the normal runtime-device update loop — producing a second flash of the same image.update_serial_numberused to be astd::stringdeclared inmain(). In the extracted function it was rewritten asauto update_serial_number = recovery_device.get_info(...), deducingconst char*. The devices-changed callback comparesrecovery_sn == update_serial_number— that became a pointer compare and never matched, so the recovery reconnect always timed out. In the pre-fix flow the timeout was masked because the fall-through re-queried the device immediately; with fix (1) alone,-rwould still exitEXIT_FAILUREon a successful flash.Summary
tools/fw-update/rs-fw-update.cpp:if (recover_arg.isSet()) return update_recovery_device(ctx, file_arg);— stop fall-through.std::string update_serial_number = recovery_device.get_info(...);— restore string comparison in the reconnect callback.Test plan
rs-fw-update -r -f <image>— one recovery pass,Recovery done, exit success. No timeout, no second flash.rs-fw-update -r -f rvp-flash-dfu.img— one recovery pass, exit success.EXIT_FAILUREwhen the device genuinely fails to re-enumerate (yank cable before reconnect).🤖 Generated by AI