Skip to content

fix(uboot-shell): detect split interrupt prompt - #164

Merged
ZR233 merged 1 commit into
drivercraft:mainfrom
yueneiqi:fix/uboot-shell-split-interrupt-prompt
Aug 3, 2026
Merged

fix(uboot-shell): detect split interrupt prompt#164
ZR233 merged 1 commit into
drivercraft:mainfrom
yueneiqi:fix/uboot-shell-split-interrupt-prompt

Conversation

@yueneiqi

Copy link
Copy Markdown
Contributor

问题

uboot-shell 0.2.6 假定 U-Boot 中断输出为 => <INTERRUPT>\n,并从 <INTERRUPT> 同一行提取提示符。Orange Pi 5 Plus 上的 U-Boot 2025.10 实际输出为 <INTERRUPT>\n=> ,导致保存的提示符为空,后续命令只读取首个字符便被误判为完成。

修改

  • 抽取按串口空闲边界收集输出的辅助方法。
  • 当中断标记前没有提示符时,从后续输出中提取提示符,并去除行首换行。
  • 保留提示符与中断标记同行的既有行为。
  • 对空提示符返回明确错误,避免继续执行产生误导性结果。
  • 增加两种输出布局的确定性回归测试,并更新 Unreleased changelog。

验证

  • cargo fmt --all -- --check
  • cargo clippy -p uboot-shell --all-targets --all-features -- -D warnings
  • cargo build -p uboot-shell --all-features
  • cargo test -p uboot-shell -- --nocapture --test-threads=1
  • Orange Pi 5 Plus(RK3588,U-Boot 2025.10,CH340 串口 1500000 baud)实机验证:通过本地依赖覆盖运行 ostool 0.23.5,成功识别分行提示符,连续执行 setenv autoload yes、读取加载地址、生成 FIT,并进入 loady 上传阶段。

发布请求

此修复解决已发布 uboot-shell 0.2.6 与上述 U-Boot 输出格式的兼容问题。合并后请发布 uboot-shell 0.2.7,以便 ostool 和下游项目直接更新到修复版本。

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

本 PR 将中断标记后才输出 U-Boot prompt 的场景改为读取空闲前的后续字节,并新增覆盖 prompt 位于标记前/后的字节流测试;变更局限于 uboot-shell 的初始化 prompt 识别及其 changelog,未改变公开 API 或其他命令/传输流程。

检查情况:GitHub Actions check (stable, x86_64-unknown-linux-gnu) 已成功;本地已通过 git diff --check 并确认 HEAD 为 270007b0242aca3dacad7b376d1adbef36d3ce84。按 crate 规则尝试运行 cargo fmt --all -- --checkcargo test -p uboot-shell --target x86_64-unknown-linux-gnu -- --nocapture,但环境未安装 cargo(exit 127),因此未在本地重复 Rust 检查。未发现此前评审评论或 PR 讨论;检索相关历史 PR 未发现需要处理的重复变更。

未发现未解决的问题、兼容性风险或额外测试缺口;现有 CI 和新增的聚焦协议测试覆盖了本次行为修复。

Powered by gpt-5.6-terra

Select the last non-empty prompt line when serial latency allows repeated
interrupt responses to arrive before prompt detection completes.
@yueneiqi
yueneiqi force-pushed the fix/uboot-shell-split-interrupt-prompt branch from 270007b to edf4169 Compare July 31, 2026 16:38
@yueneiqi

Copy link
Copy Markdown
Contributor Author

补充 WSL2 + ostool-server 远程串口实机验证后,发现 WebSocket 延迟可能让多个 Ctrl-C 响应在提示符检测完成前到达,形成 <INTERRUPT>\n=> <INTERRUPT>\n=> 。本分支已增加对应的确定性回归测试,并改为选择中断输出后的最后一个非空提示符行。

更新后已验证:

  • cargo fmt --all -- --check
  • cargo clippy -p uboot-shell --all-targets --all-features -- -D warnings
  • cargo test -p uboot-shell -- --nocapture --test-threads=1
  • Orange Pi 5 Plus 经 ostool-server 远程串口成功执行全部 U-Boot 环境命令、传输 14 MB FIT 并执行 bootm 进入 StarryOS 内核。

发布请求保持不变:合并后请发布 uboot-shell 0.2.7

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

本 PR 修复 U-Boot 将 <INTERRUPT> 与提示符分两行输出、以及串口延迟导致重复中断输出时的初始化识别:当中断标记同行没有前缀时,改为收集空闲前的后续字节并选择最后一个非空行作为提示符;同时新增三组确定性字节流测试,并更新 uboot-shell 的 Unreleased changelog。变更局限于 uboot-shell 的私有初始化/清空输入逻辑,没有改变公开 API、命令接口或 YMODEM 协议流程;它会影响该 crate 的后续命令回复边界识别,新增测试覆盖了此共享契约的关键布局。

验证情况:GitHub Actions check (stable, x86_64-unknown-linux-gnu) 在本提交 edf416974036d381ce2b494f4c049faadc9328f1 上成功。已通过 git diff --check,并用审查助手核验工作区 HEAD 与目标 SHA 一致、变更 crate 为 uboot-shell。按助手计划尝试执行 cargo fmt --check、针对 crate 的 clippy(-D warnings)和测试,但审查环境未安装 cargo/rustc(均 exit 127),所以没有在本地重复 Rust 检查;未发现任何由本 PR 引起的 CI 失败。

已检查既有审查与讨论:没有行级审查评论;此前 APPROVED 评审针对旧提交,不能替代本次结论;作者补充的实机验证与重复中断测试与当前提交相符,未留下需要处理的评审意见。检索到的历史 PR #145 是已合并的串口传输稳定性工作,不与本修复重复。

未发现未解决的正确性问题、兼容性风险或额外测试缺口。

Powered by gpt-5.6-terra

@ZR233
ZR233 merged commit 677615e into drivercraft:main Aug 3, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Aug 3, 2026
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.

2 participants