mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Bugfix: destroy the deref clone stackoverflow
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -33,7 +33,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "3.1.2"
|
||||
version = "3.1.3"
|
||||
dependencies = [
|
||||
"daemon",
|
||||
"gumdrop",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "asusctl"
|
||||
version = "3.1.2"
|
||||
version = "3.1.3"
|
||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -4,12 +4,7 @@ use daemon::{
|
||||
};
|
||||
use gumdrop::{Opt, Options};
|
||||
use rog_dbus::AuraDbusClient;
|
||||
use rog_types::{
|
||||
anime_matrix::{AniMeDataBuffer, FULL_PANE_LEN},
|
||||
cli_options::{AniMeActions, AniMeStatusValue, LedBrightness, SetAuraBuiltin},
|
||||
gfx_vendors::GfxVendors,
|
||||
profile::{FanLevel, ProfileCommand, ProfileEvent},
|
||||
};
|
||||
use rog_types::{anime_matrix::{AniMeDataBuffer, FULL_PANE_LEN}, aura_modes::AuraModes, cli_options::{AniMeActions, AniMeStatusValue, LedBrightness, SetAuraBuiltin}, gfx_vendors::GfxVendors, profile::{FanLevel, ProfileCommand, ProfileEvent}};
|
||||
use std::env::args;
|
||||
use yansi_term::Colour::Green;
|
||||
use yansi_term::Colour::Red;
|
||||
@@ -336,17 +331,23 @@ fn handle_led_mode(
|
||||
}
|
||||
|
||||
println!("\nHelp can also be requested on modes, e.g: static --help");
|
||||
std::process::exit(1);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if mode.next_mode && mode.prev_mode {
|
||||
println!("Please specify either next or previous")
|
||||
println!("Please specify either next or previous");
|
||||
return Ok(());
|
||||
}
|
||||
if mode.next_mode {
|
||||
dbus.proxies().led().next_led_mode()?;
|
||||
} else if mode.prev_mode {
|
||||
dbus.proxies().led().prev_led_mode()?;
|
||||
} else if let Some(command) = mode.command.as_ref() {
|
||||
dbus.proxies().led().set_led_mode(&command.into())?
|
||||
} else if let Some(mode) = mode.command.as_ref() {
|
||||
if mode.help_requested() {
|
||||
println!("{}", mode.self_usage());
|
||||
return Ok(());
|
||||
}
|
||||
dbus.proxies().led().set_led_mode(&<AuraModes>::from(mode))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -204,28 +204,28 @@ pub enum AuraModes {
|
||||
|
||||
impl From<SetAuraBuiltin> for AuraModes {
|
||||
fn from(mode: SetAuraBuiltin) -> Self {
|
||||
match mode {
|
||||
SetAuraBuiltin::Static(x) => AuraModes::Static(x),
|
||||
SetAuraBuiltin::Breathe(x) => AuraModes::Breathe(x),
|
||||
SetAuraBuiltin::Strobe(x) => AuraModes::Strobe(x),
|
||||
SetAuraBuiltin::Rainbow(x) => AuraModes::Rainbow(x),
|
||||
SetAuraBuiltin::Star(x) => AuraModes::Star(x),
|
||||
SetAuraBuiltin::Rain(x) => AuraModes::Rain(x),
|
||||
SetAuraBuiltin::Highlight(x) => AuraModes::Highlight(x),
|
||||
SetAuraBuiltin::Laser(x) => AuraModes::Laser(x),
|
||||
SetAuraBuiltin::Ripple(x) => AuraModes::Ripple(x),
|
||||
SetAuraBuiltin::Pulse(x) => AuraModes::Pulse(x),
|
||||
SetAuraBuiltin::Comet(x) => AuraModes::Comet(x),
|
||||
SetAuraBuiltin::Flash(x) => AuraModes::Flash(x),
|
||||
SetAuraBuiltin::MultiStatic(x) => AuraModes::MultiStatic(x),
|
||||
SetAuraBuiltin::MultiBreathe(x) => AuraModes::MultiBreathe(x),
|
||||
}
|
||||
(&mode).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&SetAuraBuiltin> for AuraModes {
|
||||
fn from(mode: &SetAuraBuiltin) -> Self {
|
||||
mode.clone().into()
|
||||
match mode {
|
||||
SetAuraBuiltin::Static(x) => AuraModes::Static(x.clone()),
|
||||
SetAuraBuiltin::Breathe(x) => AuraModes::Breathe(x.clone()),
|
||||
SetAuraBuiltin::Strobe(x) => AuraModes::Strobe(x.clone()),
|
||||
SetAuraBuiltin::Rainbow(x) => AuraModes::Rainbow(x.clone()),
|
||||
SetAuraBuiltin::Star(x) => AuraModes::Star(x.clone()),
|
||||
SetAuraBuiltin::Rain(x) => AuraModes::Rain(x.clone()),
|
||||
SetAuraBuiltin::Highlight(x) => AuraModes::Highlight(x.clone()),
|
||||
SetAuraBuiltin::Laser(x) => AuraModes::Laser(x.clone()),
|
||||
SetAuraBuiltin::Ripple(x) => AuraModes::Ripple(x.clone()),
|
||||
SetAuraBuiltin::Pulse(x) => AuraModes::Pulse(x.clone()),
|
||||
SetAuraBuiltin::Comet(x) => AuraModes::Comet(x.clone()),
|
||||
SetAuraBuiltin::Flash(x) => AuraModes::Flash(x.clone()),
|
||||
SetAuraBuiltin::MultiStatic(x) => AuraModes::MultiStatic(x.clone()),
|
||||
SetAuraBuiltin::MultiBreathe(x) => AuraModes::MultiBreathe(x.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user