Skip to content

fix(console): map LF back to CR for Windows SAC CMD - #1

Closed
Xirren wants to merge 3 commits into
masterfrom
fix/ems-sac-enter
Closed

Xirren wants to merge 3 commits into
masterfrom
fix/ems-sac-enter

Conversation

@Xirren

@Xirren Xirren commented Nov 6, 2026

Copy link
Copy Markdown
Owner

问题

droidvm console 只清了 ICANON|ECHO|ISIG,ICRNL 仍在,回车到 guest 时已变成 LF。Windows SAC 接受 LF,但 CMD 频道只认 CR,所以 SAC 正常、cmd 里回车无效。

修复

转发前把 LF 映射回 CR。Linux getty 不受影响:其 ICRNL 会把 CR 再转回 NL。

验证

  • Windows(EMS/SAC,SBSA 串口):SAC 与 CMD 回车正常
  • Alpine Linux:串口 getty 登录正常(未受影响)

参考实现

cloud-hypervisor 的同一问题(#1770)由 PR #1771 修复,做法相同:

// Replace "\n" with "\r" to deal with Windows SAC (#1170)
if count == 1 && out[0] == 0x0a {
    out[0] = 0x0d;
}

cloud-hypervisor/cloud-hypervisor#1770
cloud-hypervisor/cloud-hypervisor#1771

MollySophia and others added 3 commits October 3, 2026 19:44
Signed-off-by: Molly Sophia <mollysophia379@gmail.com>
…d-gunyah-only

fix(vm): restrict pseudo-unprotected mode to crosvm Gunyah
The console client leaves ICRNL set, so Enter reaches the guest as LF.
SAC accepts LF, but its CMD channel only treats CR as Enter. Convert LF
back to CR before forwarding; Linux getty's ICRNL turns it back into NL.

Reference: cloud-hypervisor#1770, fixed in PR #1771.
@Xirren
Xirren force-pushed the fix/ems-sac-enter branch from b120304 to 70bc991 Compare November 6, 2026 17:15
@Xirren Xirren closed this Nov 6, 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.

3 participants