Fixes: Handle keyboard nodes better.

- Uses string instead of debug print for some errors
- Add interface num arg for LED controller (should help support
  older laptops better)
- Some slightly better error messages
- Fix an idiotic mistake in `for i in 0..2.. if i > 0` -_-
- Remove "unsupported" warning on laptop ctrl
- Silence warning about AniMe not existing
- Adjust the turbo-toggle CLI arg
- Version bump for new release with fancurves

Closes #7 #10 #8 #4
This commit is contained in:
Luke D Jones
2020-09-10 10:43:08 +12:00
parent 1b427c6c07
commit cddff32757
13 changed files with 143 additions and 126 deletions

View File

@@ -6,10 +6,11 @@ use std::io::Read;
pub static LEDMODE_CONFIG_PATH: &str = "/etc/asusd/asusd-ledmodes.toml";
static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
pub static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
pub struct LaptopBase {
usb_product: String,
condev_iface: Option<String>, // required for finding the Consumer Device interface
supported_modes: Vec<u8>,
}
@@ -17,6 +18,9 @@ impl LaptopBase {
pub fn usb_product(&self) -> &str {
&self.usb_product
}
pub fn condev_iface(&self) -> Option<&String> {
self.condev_iface.as_ref()
}
pub fn supported_modes(&self) -> &[u8] {
&self.supported_modes
}
@@ -37,6 +41,7 @@ pub fn match_laptop() -> Option<LaptopBase> {
info!("Found GL753 or similar");
return Some(LaptopBase {
usb_product: "1854".to_string(),
condev_iface: None,
supported_modes: vec![STATIC, BREATHING, STROBE],
});
}
@@ -44,6 +49,11 @@ pub fn match_laptop() -> Option<LaptopBase> {
}
}
}
warn!(
"Unsupported laptop, please request support at {}",
HELP_ADDRESS
);
warn!("Continuing with minimal support");
None
}
@@ -58,6 +68,7 @@ fn select_1866_device(prod: String) -> LaptopBase {
let mut laptop = LaptopBase {
usb_product: prod,
condev_iface: Some("02".to_owned()),
supported_modes: vec![],
};
@@ -67,13 +78,6 @@ fn select_1866_device(prod: String) -> LaptopBase {
return laptop;
}
}
warn!(
"Unsupported laptop, please request support at {}",
HELP_ADDRESS
);
warn!("Continuing with minimal support");
laptop
}