Check inotify paths are valid. Add dgu/egpu/ac_online checks

This commit is contained in:
Luke D. Jones
2022-09-24 14:34:15 +12:00
parent 30550aaa91
commit 7939b00aa3
17 changed files with 210 additions and 43 deletions

View File

@@ -15,7 +15,8 @@ pub enum PlatformError {
AttrNotFound(String),
MissingFunction(String),
MissingLedBrightNode(String, std::io::Error),
Io(String, std::io::Error),
IoPath(String, std::io::Error),
Io(std::io::Error),
NoAuraKeyboard,
NoAuraNode,
}
@@ -33,9 +34,10 @@ impl fmt::Display for PlatformError {
PlatformError::Write(path, error) => write!(f, "Write {}: {}", path, error),
PlatformError::NotSupported => write!(f, "Not supported"),
PlatformError::AttrNotFound(deets) => write!(f, "Attribute not found: {}", deets),
PlatformError::Io(deets) => write!(f, "std::io error: {}", deets),
PlatformError::MissingFunction(deets) => write!(f, "Missing functionality: {}", deets),
PlatformError::MissingLedBrightNode(path, error) => write!(f, "Led node at {} is missing, please check you have the required patch or dkms module installed: {}", path, error),
PlatformError::Io(path, detail) => write!(f, "std::io error: {} {}", path, detail),
PlatformError::IoPath(path, detail) => write!(f, "{} {}", path, detail),
PlatformError::NoAuraKeyboard => write!(f, "No supported Aura keyboard"),
PlatformError::NoAuraNode => write!(f, "No Aura keyboard node found"),
}
@@ -49,3 +51,9 @@ impl From<rusb::Error> for PlatformError {
PlatformError::USB(err)
}
}
impl From<std::io::Error> for PlatformError {
fn from(err: std::io::Error) -> Self {
PlatformError::Io(err)
}
}