Fix thread 'main' panicked at asusctl/src/main.rs:85:14:

This commit is contained in:
guylamar2006
2025-02-17 21:13:42 +00:00
committed by Luke Jones
parent ae8ce83583
commit 3e4d594b05

View File

@@ -74,22 +74,36 @@ fn main() {
println!("\nError: {e}\n"); println!("\nError: {e}\n");
print_info(); print_info();
}) { }) {
let asusd_version = platform_proxy let asusd_version = match platform_proxy.version() {
.version() Ok(version) => version,
.map_err(|e| { Err(e) => {
error!( error!(
"Could not get asusd version: {e:?}\nIs asusd.service running? {}", "Could not get asusd version: {e:?}\nIs asusd.service running? {}",
check_service("asusd") check_service("asusd")
); );
}) return;
.unwrap(); }
};
if asusd_version != self_version { if asusd_version != self_version {
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}"); println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
return; return;
} }
let supported_properties = platform_proxy.supported_properties().unwrap(); let supported_properties = match platform_proxy.supported_properties() {
let supported_interfaces = list_iface_blocking().unwrap(); Ok(props) => props,
Err(e) => {
error!("Could not get supported properties: {e:?}");
return;
}
};
let supported_interfaces = match list_iface_blocking() {
Ok(ifaces) => ifaces,
Err(e) => {
error!("Could not get supported interfaces: {e:?}");
return;
}
};
if parsed.version { if parsed.version {
println!("asusctl v{}", env!("CARGO_PKG_VERSION")); println!("asusctl v{}", env!("CARGO_PKG_VERSION"));