mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Merge branch 'fluke/cli-fixes' into 'main'
Fluke/cli fixes See merge request asus-linux/asusctl!67
This commit is contained in:
@@ -224,8 +224,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if parsed.show_supported {
|
if parsed.show_supported {
|
||||||
let dat = dbus.proxies().supported().get_supported_functions()?;
|
println!("Supported laptop functions:\n\n{}", supported);
|
||||||
println!("Supported laptop functions:\n\n{}", dat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(chg_limit) = parsed.chg_limit {
|
if let Some(chg_limit) = parsed.chg_limit {
|
||||||
@@ -235,6 +234,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Print the root help for base commands if the commands are supported
|
||||||
fn print_supported_help(supported: &SupportedFunctions, parsed: &CliStart) {
|
fn print_supported_help(supported: &SupportedFunctions, parsed: &CliStart) {
|
||||||
// As help option don't work with `parse_args_default`
|
// As help option don't work with `parse_args_default`
|
||||||
// we will call `parse_args_default_or_exit` instead
|
// we will call `parse_args_default_or_exit` instead
|
||||||
@@ -255,25 +255,20 @@ fn print_supported_help(supported: &SupportedFunctions, parsed: &CliStart) {
|
|||||||
let commands: Vec<String> = CliCommand::usage().lines().map(|s| s.to_string()).collect();
|
let commands: Vec<String> = CliCommand::usage().lines().map(|s| s.to_string()).collect();
|
||||||
println!("\nCommands available");
|
println!("\nCommands available");
|
||||||
for line in commands.iter().filter(|line| {
|
for line in commands.iter().filter(|line| {
|
||||||
if line.contains("profile")
|
if line.contains("profile") {
|
||||||
&& !supported.fan_cpu_ctrl.stock_fan_modes
|
return supported.fan_cpu_ctrl.stock_fan_modes || supported.fan_cpu_ctrl.fan_curve_set;
|
||||||
&& !supported.fan_cpu_ctrl.fan_curve_set
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if line.contains("led-mode") && !supported.keyboard_led.stock_led_modes.is_empty() {
|
if line.contains("led-mode") {
|
||||||
return false;
|
return supported.keyboard_led.stock_led_modes.is_empty();
|
||||||
}
|
}
|
||||||
if line.contains("bios")
|
if line.contains("bios") {
|
||||||
&& (!supported.rog_bios_ctrl.dedicated_gfx_toggle
|
return supported.rog_bios_ctrl.dedicated_gfx_toggle
|
||||||
|| !supported.rog_bios_ctrl.post_sound_toggle)
|
|| supported.rog_bios_ctrl.post_sound_toggle;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if line.contains("anime") && !supported.anime_ctrl.0 {
|
if line.contains("anime") {
|
||||||
return false;
|
return supported.anime_ctrl.0;
|
||||||
}
|
}
|
||||||
true
|
false
|
||||||
}) {
|
}) {
|
||||||
println!("{}", line);
|
println!("{}", line);
|
||||||
}
|
}
|
||||||
@@ -369,7 +364,9 @@ fn handle_led_mode(
|
|||||||
.collect();
|
.collect();
|
||||||
for command in commands.iter().filter(|command| {
|
for command in commands.iter().filter(|command| {
|
||||||
for mode in &supported.stock_led_modes {
|
for mode in &supported.stock_led_modes {
|
||||||
if command.contains(<&str>::from(mode)) {
|
dbg!(mode);
|
||||||
|
dbg!(command);
|
||||||
|
if command.contains(&<&str>::from(mode).to_lowercase()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Before=display-manager.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=IS_SERVICE=1
|
Environment=IS_SERVICE=1
|
||||||
|
ExecStartPre=/bin/sleep 2
|
||||||
ExecStart=/usr/bin/asusd
|
ExecStart=/usr/bin/asusd
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|||||||
Reference in New Issue
Block a user