Fix: non-rgb keyboard backlight control

This commit is contained in:
Luke D Jones
2021-03-23 13:44:07 +13:00
parent 96ceef1bdb
commit df7ae4d014
6 changed files with 35 additions and 29 deletions

View File

@@ -49,15 +49,24 @@ pub struct LaptopLedData {
}
impl LaptopLedData {
pub fn get_data() -> Option<Self> {
pub fn get_data() -> Self {
let dmi = sysfs_class::DmiId::default();
let board_name = dmi.board_name().expect("Could not get board_name");
let prod_family = dmi.product_family().expect("Could not get product_family");
if let Some(modes) = LedSupportFile::load_from_config() {
return modes.matcher(&prod_family, &board_name);
if let Some(data) = modes.matcher(&prod_family, &board_name) {
return data;
}
}
info!("Using generic LED control for keyboard brightness only");
LaptopLedData {
prod_family,
board_names: vec![board_name],
standard: vec![],
multizone: false,
per_key: false,
}
None
}
}