Skip to content

Add flash dump, serial terminal, and UX fixes#7

Merged
widgetii merged 1 commit intomasterfrom
feature/flash-dump-and-terminal
Mar 30, 2026
Merged

Add flash dump, serial terminal, and UX fixes#7
widgetii merged 1 commit intomasterfrom
feature/flash-dump-and-terminal

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

  • Flash dump via U-Boot serial console (CLI + TUI + WebUI)
  • Real serial terminal in TUI using TextArea with direct keystroke passthrough
  • Multiple UX fixes from real hardware testing sessions

Verified on real hardware

  • hi3516ev300: recovery + autoboot interrupt + terminal + flash dump all working
  • Backspace, arrow keys, Ctrl-C all functional in terminal

Test plan

  • 198 Python tests pass (20 new flashdump + 7 autoboot)
  • 53 JS tests pass
  • Lint + mypy clean

🤖 Generated with Claude Code

Flash dump via U-Boot:
- flashdump.py: sf probe → sf read → md.b hex parser → binary file
- detect_flash_from_text(): finds flash size from boot log or sf probe
- Fixed false-positive: "RAM size: 128MB" no longer matches as 8MB
- CLI: defib dump-flash -p PORT -o flash.bin [--size 16MB]
- TUI: Ctrl-D triggers dump, WebUI: "Dump Flash" button

Serial terminal (TUI):
- TextArea-based terminal replaces broken RichLog approach
- Direct keystroke passthrough via on_key → serial write
- Backspace handling: interprets BS control chars from U-Boot
- Backspace stops at line boundaries
- Ctrl-key combos pass through to Textual actions (Ctrl-Q=quit etc)
- Arrow keys send ANSI escape sequences (U-Boot command history)
- Auto-scrolls to bottom on new output

Serial console (WebUI):
- Ctrl-C button, md.b hex parser for flash dump
- sendUbootCmd() uses \r line endings

Bug fixes:
- \r not \n for U-Boot commands (all interfaces)
- Ctrl-Q to quit (was q, intercepted typing)
- CancelledError handled in flash dump worker
- Flash size regex: context-aware, power-of-two validation

Tests: 20 flashdump tests, 7 autoboot tests, 198 total passing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 4c5fc22 into master Mar 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant