From 4fdb81fa30b7648ed832b43021ece1e55010d694 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Sat, 18 Jul 2026 17:29:33 +0900 Subject: [PATCH] DIAG(ptyd): log pty.input line-discipline (icanon/vmin -> cooked/mosi) + slave read mosi state --- ptyd/src/pty.rs | 13 +++++++++++++ ptyd/src/subterm.rs | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/ptyd/src/pty.rs b/ptyd/src/pty.rs index 80cd2957a4..f68eb72f91 100644 --- a/ptyd/src/pty.rs +++ b/ptyd/src/pty.rs @@ -246,6 +246,19 @@ impl Pty { } self.update(); + if !buf.is_empty() { + let cc = self.termios.c_cc; + eprintln!( + "ptyd-diag: input {} bytes icanon={} echo={} vmin={} vtime={} -> cooked={} mosi={}", + buf.len(), + icanon, + echo, + cc[VMIN], + cc[VTIME], + self.cooked.len(), + self.mosi.len(), + ); + } } pub fn output(&mut self, buf: &[u8]) { diff --git a/ptyd/src/subterm.rs b/ptyd/src/subterm.rs index beda848fa3..f17e4a8565 100644 --- a/ptyd/src/subterm.rs +++ b/ptyd/src/subterm.rs @@ -51,6 +51,14 @@ impl Resource for PtySubTerm { pty.update(); + if !pty.mosi.is_empty() { + eprintln!( + "ptyd-diag: subterm read: mosi has {} packet(s), first len {}", + pty.mosi.len(), + pty.mosi.front().map(|p| p.len()).unwrap_or(0), + ); + } + if let Some(packet) = pty.mosi.pop_front() { let mut i = 0;