chore: close session — commit all remaining pre-existing state
Finalize all non-artifact changes accumulated from other sessions: - config updates, recipe changes, source edits, patches - pkgar/cache artifacts intentionally excluded (build outputs) This is the maximum achievable scope for this session. Hardware-accelerated KDE blocked by: QML gate, KWin/Plasma builds, hardware GPU validation — all require build system + physical GPU.
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
use log::{info, warn, LevelFilter};
|
||||
use log::{info, LevelFilter};
|
||||
use std::fs;
|
||||
use std::time::Duration;
|
||||
|
||||
struct StderrLogger;
|
||||
impl log::Log for StderrLogger {
|
||||
fn enabled(&self, m: &log::Metadata) -> bool { m.level() <= LevelFilter::Info }
|
||||
fn log(&self, r: &log::Record) { eprintln!("[{}] redbear-acmd: {}", r.level(), r.args()); }
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
fn scan_and_create() -> usize {
|
||||
fn scan() -> usize {
|
||||
let mut n = 0;
|
||||
let _ = fs::create_dir_all("/dev");
|
||||
if let Ok(dir) = fs::read_dir("/scheme/usb") {
|
||||
for entry in dir.flatten() {
|
||||
if let Ok(config) = fs::read_to_string(entry.path().join("config")) {
|
||||
if config.contains("class=0a") || config.contains("CDC ACM") {
|
||||
let tty = format!("/dev/ttyACM{}", n);
|
||||
let _ = fs::write(&tty, &[]);
|
||||
for e in dir.flatten() {
|
||||
if let Ok(c) = fs::read_to_string(e.path().join("config")) {
|
||||
if c.contains("class=0a") || c.contains("CDC ACM") {
|
||||
let tgt = e.path();
|
||||
let lnk = format!("/dev/ttyACM{}", n);
|
||||
let _ = std::os::unix::fs::symlink(&tgt, &lnk);
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
@@ -25,14 +24,9 @@ fn scan_and_create() -> usize {
|
||||
}
|
||||
n
|
||||
}
|
||||
|
||||
fn main() {
|
||||
log::set_logger(&StderrLogger).ok();
|
||||
log::set_max_level(LevelFilter::Info);
|
||||
info!("redbear-acmd: USB CDC ACM serial daemon");
|
||||
loop {
|
||||
let n = scan_and_create();
|
||||
if n > 0 { info!("redbear-acmd: {} ttyACM device(s)", n); }
|
||||
std::thread::sleep(Duration::from_secs(5));
|
||||
}
|
||||
loop { let c = scan(); if c > 0 { info!("redbear-acmd: {} ttyACM symlink(s)", c); } std::thread::sleep(Duration::from_secs(5)); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user