Add the profile database and the end-to-end detection driver
source-pr / source (pull_request) Successful in 12s
source-pr / source (pull_request) Successful in 12s
Profiles carry the only envelopes detection may use, so a combination absent from the database is refused rather than guessed. The schema-1 document is validated on load: unknown chips or sensor wiring, inverted or zero envelopes, zero chain counts and duplicate names are all rejected. run_detection now ties the pieces together: probe every declared port, select a profile by chip, sensor wiring and physical port count, identify the PSU, and emit a HardwarePlan. A machine with a dead chain still matches its three-chain profile and runs degraded instead of being reclassified; plan() now tolerates unidentified chains and refuses only when nothing identified. The detection backend contract gains identify_psu(), and HalClient answers it through the new HAL verb.
This commit is contained in:
+8
-2
@@ -1,7 +1,9 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
//! Versioned local wire contract between Alkane OS and an SDK hardware backend.
|
||||
|
||||
use crate::detect::{ChainProbe, ChipModel, EepromState, Envelope, ProbeOutcome, PsuCapability};
|
||||
use crate::detect::{
|
||||
ChipModel, DetectionBackend, EepromState, Envelope, ProbeOutcome, PsuCapability,
|
||||
};
|
||||
use crate::HardwareBackend;
|
||||
use std::fmt;
|
||||
use std::io::{self, Read, Write};
|
||||
@@ -446,7 +448,7 @@ impl HalClient {
|
||||
}
|
||||
}
|
||||
|
||||
impl ChainProbe for HalClient {
|
||||
impl DetectionBackend for HalClient {
|
||||
type Error = HalError;
|
||||
|
||||
fn probe(&mut self, chain: u8, attempt: u8) -> Result<ProbeOutcome, Self::Error> {
|
||||
@@ -456,6 +458,10 @@ impl ChainProbe for HalClient {
|
||||
fn eeprom(&mut self, chain: u8) -> Result<EepromState, Self::Error> {
|
||||
self.read_eeprom(chain)
|
||||
}
|
||||
|
||||
fn identify_psu(&mut self) -> Result<Option<PsuCapability>, Self::Error> {
|
||||
self.identify_psu().map(Some)
|
||||
}
|
||||
}
|
||||
|
||||
fn chip_from_wire(value: u8) -> Option<ChipModel> {
|
||||
|
||||
Reference in New Issue
Block a user