From 229046c6348f264ef1abbb040b5c5b5553e07e86 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sat, 18 Jul 2026 07:23:29 +0900 Subject: [PATCH] fix(debug): report EVENT_READ in fevent when serial input is queued The debug scheme's fevent always returned empty, relying solely on the edge-triggered debug_notify(). A reader that registers with an event queue after input has already arrived (fbcond's serial console) would miss it. Report readable when the input queue is non-empty. --- src/scheme/debug.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/scheme/debug.rs b/src/scheme/debug.rs index c70ac5792b..2e688519b4 100644 --- a/src/scheme/debug.rs +++ b/src/scheme/debug.rs @@ -109,7 +109,19 @@ impl KernelScheme for DebugScheme { _flags: EventFlags, token: &mut CleanLockToken, ) -> Result { - let _handle = *HANDLES.read(token.token()).get(id)?; + let handle = *HANDLES.read(token.token()).get(id)?; + + // Report readable when serial/debug input is already queued, so a reader + // that registers with an event queue AFTER input has arrived (e.g. + // fbcond's serial console feeding the getty) still learns it is + // readable, rather than relying solely on the edge-triggered + // debug_notify(). Non-input handles never report readable. + if handle.num != SpecialFds::DisableGraphicalDebug as usize + && handle.num != SpecialFds::SchemeRoot as usize + && !INPUT.is_currently_empty(token) + { + return Ok(EVENT_READ); + } Ok(EventFlags::empty()) }