implemented generic linux sal with heuristics

This commit is contained in:
2026-02-26 15:16:37 +01:00
parent 48c3b46a0c
commit f87efa1d24
13 changed files with 686 additions and 125 deletions

View File

@@ -48,7 +48,7 @@ impl<T: PreflightAuditor + ?Sized> PreflightAuditor for Arc<T> {
}
/// Suppresses conflicting daemons (tlp, thermald).
pub trait EnvironmentGuard {
pub trait EnvironmentGuard: Send + Sync {
fn suppress(&mut self) -> Result<()>;
fn restore(&mut self) -> Result<()>;
}
@@ -77,7 +77,7 @@ impl<T: SensorBus + ?Sized> SensorBus for Arc<T> {
}
/// Write-only interface for hardware commands.
pub trait ActuatorBus {
pub trait ActuatorBus: Send + Sync {
fn set_fan_mode(&self, mode: &str) -> Result<()>;
fn set_sustained_power_limit(&self, watts: f32) -> Result<()>;
fn set_burst_power_limit(&self, watts: f32) -> Result<()>;
@@ -96,7 +96,7 @@ impl<T: ActuatorBus + ?Sized> ActuatorBus for Arc<T> {
}
/// Concurrent monitor for catastrophic states.
pub trait HardwareWatchdog {
pub trait HardwareWatchdog: Send + Sync {
fn check_emergency(&self) -> Result<bool>;
}
@@ -105,3 +105,8 @@ impl<T: HardwareWatchdog + ?Sized> HardwareWatchdog for Arc<T> {
(**self).check_emergency()
}
}
/// Aggregate trait for a complete platform implementation.
pub trait PlatformSal: PreflightAuditor + SensorBus + ActuatorBus + EnvironmentGuard + HardwareWatchdog {}
impl<T: PreflightAuditor + SensorBus + ActuatorBus + EnvironmentGuard + HardwareWatchdog + ?Sized> PlatformSal for T {}