Update deps and fmt

This commit is contained in:
Luke
2021-01-09 13:42:46 +13:00
parent d61c180ee5
commit 81645d0777
21 changed files with 477 additions and 243 deletions

View File

@@ -32,10 +32,8 @@ gumdrop = "^0.8.0"
log = "^0.4.8"
env_logger = "^0.7.1"
# async
zbus = "1.2.0"
zvariant = "2.2.0"
#tokio = { version = "^0.2.4", features = ["rt-threaded", "sync"] }
zbus = "^1.8.0"
zvariant = "^2.4.0"
# serialisation
serde = "^1.0"

View File

@@ -11,7 +11,7 @@ const APPLY: u8 = 0xc4;
// Used to turn the panel on and off
// The next byte can be 0x03 for "on" and 0x00 for "off"
const ON_OFF : u8 = 0x04;
const ON_OFF: u8 = 0x04;
use asus_nb::error::AuraError;
use log::{error, info, warn};
@@ -60,14 +60,12 @@ impl crate::ZbusAdd for CtrlAnimeDisplay {
#[dbus_interface(name = "org.asuslinux.Daemon")]
impl Dbus for CtrlAnimeDisplay {
fn set_anime(&mut self, input: Vec<Vec<u8>>) {
self.do_command(AnimatrixCommand::WriteImage(input))
.map_or_else(|err| warn!("{}", err),
|()| info!("Writing image to Anime"));
.map_or_else(|err| warn!("{}", err), |()| info!("Writing image to Anime"));
}
fn set_on_off(&mut self, status: bool) {
let mut flush : Vec<u8> = vec![0; PACKET_SIZE];
let mut flush: Vec<u8> = vec![0; PACKET_SIZE];
flush[0] = DEV_PAGE;
flush[1] = WRITE;
flush[2] = ON_OFF;
@@ -81,9 +79,10 @@ impl Dbus for CtrlAnimeDisplay {
status_str = "off";
}
self.do_command(AnimatrixCommand::Write(flush))
.map_or_else(|err| warn!("{}", err),
|()| info!("Turning {} the AniMe", status_str));
self.do_command(AnimatrixCommand::Write(flush)).map_or_else(
|err| warn!("{}", err),
|()| info!("Turning {} the AniMe", status_str),
);
}
fn set_boot_on_off(&mut self, status: bool) {
@@ -91,9 +90,10 @@ impl Dbus for CtrlAnimeDisplay {
self.do_command(AnimatrixCommand::SetBoot(status))
.and_then(|()| self.do_command(AnimatrixCommand::Apply))
.map_or_else(|err| warn!("{}", err),
|()| info!("Turning {} the AniMe at boot/shutdown",
status_str));
.map_or_else(
|err| warn!("{}", err),
|()| info!("Turning {} the AniMe at boot/shutdown", status_str),
);
}
}

View File

@@ -43,7 +43,7 @@ impl CtrlCharge {
}
#[dbus_interface(signal)]
pub fn notify_charge(&self, limit: u8) -> zbus::Result<()>;
fn notify_charge(&self, limit: u8) -> zbus::Result<()>;
}
impl crate::ZbusAdd for CtrlCharge {

View File

@@ -55,7 +55,7 @@ impl DbusFanAndCpu {
if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) {
if let Ok(json) = serde_json::to_string(profile) {
self.notify_profile(&json)
.unwrap_or_else(|err| warn!("{}", err));
.unwrap_or_else(|err| warn!("{}", err));
}
}
}

View File

@@ -76,12 +76,12 @@ impl DbusKbdBacklight {
if let Ok(mut ctrl) = self.inner.try_lock() {
if let Ok(mut cfg) = ctrl.config.clone().try_lock() {
ctrl.toggle_mode(false, &mut cfg)
.unwrap_or_else(|err| warn!("{}", err));
.unwrap_or_else(|err| warn!("{}", err));
if let Some(mode) = cfg.get_led_mode_data(cfg.kbd_backlight_mode) {
if let Ok(json) = serde_json::to_string(&mode) {
self.notify_led(&json)
.unwrap_or_else(|err| warn!("{}", err));
.unwrap_or_else(|err| warn!("{}", err));
}
}
}
@@ -92,12 +92,12 @@ impl DbusKbdBacklight {
if let Ok(mut ctrl) = self.inner.try_lock() {
if let Ok(mut cfg) = ctrl.config.clone().try_lock() {
ctrl.toggle_mode(true, &mut cfg)
.unwrap_or_else(|err| warn!("{}", err));
.unwrap_or_else(|err| warn!("{}", err));
if let Some(mode) = cfg.get_led_mode_data(cfg.kbd_backlight_mode) {
if let Ok(json) = serde_json::to_string(&mode) {
self.notify_led(&json)
.unwrap_or_else(|err| warn!("{}", err));
.unwrap_or_else(|err| warn!("{}", err));
}
}
}
@@ -418,7 +418,6 @@ impl CtrlKbdBacklight {
fn toggle_mode(&mut self, reverse: bool, config: &mut Config) -> Result<(), RogError> {
let current = config.kbd_backlight_mode;
if let Some(idx) = self.supported_modes.iter().position(|v| *v == current) {
let mut idx = idx;
// goes past end of array
if reverse {

View File

@@ -15,8 +15,8 @@ pub mod laptops;
mod error;
use config::Config;
use crate::error::RogError;
use config::Config;
use zbus::ObjectServer;
pub static VERSION: &str = env!("CARGO_PKG_VERSION");

View File

@@ -1,11 +1,6 @@
use asus_nb::{
anime_dbus::AniMeDbusWriter,
cli_options::{
AniMeActions,
AniMeStatusValue,
LedBrightness,
SetAuraBuiltin,
},
cli_options::{AniMeActions, AniMeStatusValue, LedBrightness, SetAuraBuiltin},
core_dbus::AuraDbusClient,
profile::{ProfileCommand, ProfileEvent},
};