Add dbus methods and CLI args for battery charge limit

This commit is contained in:
Luke
2020-06-26 16:23:37 +12:00
5 changed files with 127 additions and 7 deletions

View File

@@ -22,6 +22,8 @@ struct CLIStart {
bright: Option<LedBrightness>,
#[options(meta = "FAN", help = "<silent, normal, boost>")]
fan_mode: Option<FanLevel>,
#[options(meta = "CHRG", help = "<20-100>")]
charge_limit: Option<u8>,
#[options(command)]
command: Option<Command>,
}
@@ -87,5 +89,11 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
Err(err) => println!("Error: {}", err),
}
}
if let Some(charge_limit) = parsed.charge_limit {
match writer.write_charge_limit(charge_limit) {
Ok(msg) => println!("Daemon response: {}", msg),
Err(err) => println!("Error: {}", err),
}
}
Ok(())
}