Try to mitigate the lack of kbd_brightness on some laptops

This commit is contained in:
Luke D. Jones
2024-05-10 12:21:15 +12:00
parent e62e7e8eca
commit 1da68ea69d
6 changed files with 105 additions and 41 deletions

View File

@@ -5,12 +5,15 @@ use log::{info, warn};
use crate::error::{PlatformError, Result};
use crate::{attr_u8, has_attr, set_attr_u8_array, to_device};
/// The sysfs control for backlight levels. This is only for the 3-step
/// backlight setting, and for TUF laptops. It is not a hard requirement
/// for Aura keyboards
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Clone)]
pub struct KeyboardLed {
pub struct KeyboardBacklight {
path: PathBuf,
}
impl KeyboardLed {
impl KeyboardBacklight {
attr_u8!("brightness", path);
has_attr!("kbd_rgb_mode" path);
@@ -59,7 +62,7 @@ impl KeyboardLed {
});
}
Err(PlatformError::MissingFunction(
"asus::kbd_backlight not found".into(),
"KeyboardLed:new(), asus::kbd_backlight not found".into(),
))
}
}