Enforce valid image brightness in daemon and asusctl

This commit is contained in:
I Al Istannen
2022-07-16 03:00:22 +00:00
committed by Luke Jones
parent ef04549c8e
commit c0e36295b7
6 changed files with 50 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ pub enum AnimeError {
Udev(String, std::io::Error),
NoDevice,
UnsupportedDevice,
InvalidBrightness(f32),
}
impl fmt::Display for AnimeError {
@@ -36,6 +37,11 @@ impl fmt::Display for AnimeError {
AnimeError::Udev(deets, error) => write!(f, "udev {}: {}", deets, error),
AnimeError::NoDevice => write!(f, "No AniMe Matrix device found"),
AnimeError::UnsupportedDevice => write!(f, "Unsupported AniMe Matrix device found"),
AnimeError::InvalidBrightness(bright) => write!(
f,
"Image brightness must be between 0.0 and 1.0 (inclusive), was {}",
bright
),
}
}
}