Fix handshake: detect power-off before flooding 0xAA#27
Merged
Conversation
Flooding 0xAA to a running device causes 0x07 (BEL) echoes that prevent bootrom 0x20 detection, hanging the TUI forever. Fix: two-phase handshake. - Manual mode (default): waits silently until device goes silent (timeout after data = power off), then floods 0xAA so bootrom sees it immediately on next boot. - Automated mode (--power-cycle): floods from the start since device is guaranteed off. Verified on real hardware (both manual and automated paths): - hi3516cv300 (IVGHP203Y-AF) - hi3516ev300 (IVG85HG50PYA-S) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Problem
PR #26 defaulted
continuous_ack=Truewhich floods0xAAto a running device. The running Linux shell echoes0x07(BEL) for each0xAAreceived, polluting the serial buffer and preventing bootrom0x20detection. TUI hangs forever at handshake.Fix
Two-phase handshake with power-off detection:
0xAAsent (avoids0x07echo pollution)0xAAevery 50ms0x20pattern detected through the flood, bootrom enters download modecontinuous_ack=False--power-cycle)continuous_ack=TrueRegression tests
test_power_off_detection_triggers_flood— simulates TUI: data → silence → bootrom. Verifies flood starts after power-off.test_no_flood_while_device_running— verifies no0xAAsent while device is active.Verified on real hardware
Both manual and automated paths tested on:
🤖 Generated with Claude Code