Skip to content

Commit

Permalink
Use latest brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-pro committed Dec 26, 2021
1 parent 9be921c commit 0452a2d
Showing 3 changed files with 11 additions and 68 deletions.
54 changes: 5 additions & 49 deletions app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ build = "build.rs"

[dependencies]
anyhow = "1.0.43"
brightness = { version = "0.3.1" }
brightness = { git = "https://github.com/jacob-pro/brightness", rev = "c442ea8" }
chrono = "0.4"
clap = "3.0.0-beta.5"
config = "0.10.1"
23 changes: 5 additions & 18 deletions app/src/controller/apply.rs
Original file line number Diff line number Diff line change
@@ -69,15 +69,16 @@ pub fn apply(config: &Config, enabled: bool) -> (ApplyResult, Option<unix_t>) {
Ok(mut dev) => match block_on(dev.set(br.brightness)) {
Err(e) => {
log::error!(
"An error occurred setting monitor brightness: {}",
error_debug(&e)
"An error occurred setting monitor brightness: {:?} for: {:?}",
e,
dev
);
errors.push(e);
}
_ => {}
},
Err(e) => {
log::error!("An error occurred getting monitors: {}", error_debug(&e));
log::error!("An error occurred getting monitors: {:?}", e);
errors.push(e);
}
}
@@ -113,6 +114,7 @@ pub async fn get_properties(
"device_name" => device.device_name().await?,
"device_description" => device.device_description().await?,
"device_key" => device.device_registry_key().await?,
"device_path" => device.device_path().await?,
})
}

@@ -124,18 +126,3 @@ pub async fn get_properties(
"device_name" => device.device_name().await?,
})
}

fn error_debug(e: &dyn std::error::Error) -> String {
let mut msg = format!("{:?}", e);
let mut src = e.source();
loop {
match src {
None => break,
Some(inner) => {
msg.push_str(&format!(" - {:?}", inner));
src = inner.source();
}
}
}
msg
}

0 comments on commit 0452a2d

Please sign in to comment.