5cc4e13f09
P3-3: fbcond scrollback — captures last 1000 lines of text output in ring buffer, exposes via read_scrollback(). Patch created but needs line number adjustment for clean application. P3-5: thermal daemon source created at drivers/thermald/. Reads ACPI thermal zone temperature, logs warnings >65°C, errors >80°C. Needs Cargo.toml workspace integration and recipe.toml BINS entry. Part of COMPREHENSIVE-FIX-PLAN-FINAL P3 implementation.
57 lines
1.4 KiB
Diff
57 lines
1.4 KiB
Diff
--- a/drivers/graphics/fbcond/src/text.rs
|
|
+++ b/drivers/graphics/fbcond/src/text.rs
|
|
@@ -5,17 +5,25 @@
|
|
|
|
use crate::display::Display;
|
|
|
|
+const SCROLLBACK_LINES: usize = 1000;
|
|
+
|
|
pub struct TextScreen {
|
|
pub display: Display,
|
|
inner: console_draw::TextScreen,
|
|
ctrl: bool,
|
|
input: VecDeque<u8>,
|
|
+ scrollback: VecDeque<Vec<u8>>,
|
|
+ scroll_pos: usize,
|
|
}
|
|
|
|
impl TextScreen {
|
|
pub fn new(display: Display) -> TextScreen {
|
|
TextScreen {
|
|
display,
|
|
inner: console_draw::TextScreen::new(),
|
|
ctrl: false,
|
|
input: VecDeque::new(),
|
|
+ scrollback: VecDeque::with_capacity(SCROLLBACK_LINES),
|
|
+ scroll_pos: 0,
|
|
}
|
|
}
|
|
|
|
@@ -128,6 +136,24 @@
|
|
|
|
let damage = self.inner.write(map, buf, &mut self.input);
|
|
|
|
+ for line in buf.split(|&b| b == b'\n') {
|
|
+ let mut v = line.to_vec();
|
|
+ v.push(b'\n');
|
|
+ self.scrollback.push_back(v);
|
|
+ }
|
|
+ while self.scrollback.len() > SCROLLBACK_LINES {
|
|
+ self.scrollback.pop_front();
|
|
+ }
|
|
+
|
|
self.display.sync_rect(damage);
|
|
}
|
|
|
|
Ok(buf.len())
|
|
}
|
|
+
|
|
+ pub fn read_scrollback(&self) -> Vec<u8> {
|
|
+ let mut result = Vec::new();
|
|
+ for line in &self.scrollback {
|
|
+ result.extend_from_slice(line);
|
|
+ }
|
|
+ result
|
|
+ }
|
|
}
|