Skip to content

rs-fw-update: return recovery result and fix reconnect wait match - #15611

Merged
remibettan merged 1 commit into
realsenseai:developmentfrom
remibettan:fix/rs-fw-update-recovery-return-RSDEV-12551
Aug 30, 2026
Merged

remibettan merged 1 commit into
realsenseai:developmentfrom
remibettan:fix/rs-fw-update-recovery-return-RSDEV-12551

Conversation

@remibettan

@remibettan remibettan commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Tracked by: RSDEV-12551

Overview: Fix two defects in rs-fw-update -r that 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 into update_recovery_device():

  1. main() lost the return, so update_recovery_device()'s EXIT_SUCCESS/EXIT_FAILURE was ignored and main() fell through to the normal runtime-device update loop — producing a second flash of the same image.
  2. update_serial_number used to be a std::string declared in main(). In the extracted function it was rewritten as auto update_serial_number = recovery_device.get_info(...), deducing const char*. The devices-changed callback compares recovery_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, -r would still exit EXIT_FAILURE on 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

  • D415 (reproducer from RSDEV-12551 comments): rs-fw-update -r -f <image> — one recovery pass, Recovery done, exit success. No timeout, no second flash.
  • D585: rs-fw-update -r -f rvp-flash-dfu.img — one recovery pass, exit success.
  • Recovery reconnect timeout still propagates as EXIT_FAILURE when the device genuinely fails to re-enumerate (yank cable before reconnect).
  • D457 MIPI recovery: prints the MIPI recovery message and exits success (no runtime update pass).

🤖 Generated by AI

@sysrsbuild-gh-agentic sysrsbuild-gh-agentic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread tools/fw-update/rs-fw-update.cpp Resolved
@remibettan
remibettan force-pushed the fix/rs-fw-update-recovery-return-RSDEV-12551 branch from 31547b9 to cdfa336 Compare August 30, 2026 08:55
@remibettan remibettan changed the title rs-fw-update: return recovery result to avoid duplicate update rs-fw-update: return recovery result and fix reconnect wait match Aug 30, 2026
@remibettan
remibettan requested a review from Nir-Az August 30, 2026 09:00
@remibettan
remibettan merged commit 92ce78b into realsenseai:development Aug 30, 2026
39 of 40 checks passed
@remibettan
remibettan deleted the fix/rs-fw-update-recovery-return-RSDEV-12551 branch September 9, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants