Skip to content

Commit 1e6a130

Browse files
JohnAZoidbergclaude
andcommitted
Exit with 1 when reading EC state fails
--intrusion, --kblight, --ec-hib-delay and --privacy printed an error but exited with 0 when the EC command failed, for example because the EC firmware doesn't support it, like on the desktop. Drop the extra "Not all EC versions support this comand." message from --privacy, the error now explains InvalidCommand itself. Tested on Framework Desktop (AMD Ryzen AI Max 300). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent d32701c commit 1e6a130

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • framework_lib/src/commandline

‎framework_lib/src/commandline/mod.rs‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
17601760
);
17611761
} else {
17621762
println!(" Unable to tell");
1763+
return 1;
17631764
}
17641765
} else if args.inputdeck {
17651766
let family = smbios::get_platform().and_then(Platform::which_family);
@@ -1886,6 +1887,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
18861887
println!("{}%", percentage);
18871888
} else {
18881889
println!("Unable to tell");
1890+
return 1;
18891891
}
18901892
} else if let Some((row, col, scanset)) = args.remap_key {
18911893
print_err(ec.remap_key(row, col, scanset));
@@ -1975,9 +1977,13 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
19751977
}
19761978
} else if let Some(delay) = &args.ec_hib_delay {
19771979
if let Some(delay) = delay {
1978-
print_err(ec.set_ec_hib_delay(*delay));
1980+
if print_err(ec.set_ec_hib_delay(*delay)).is_none() {
1981+
return 1;
1982+
}
1983+
}
1984+
if print_err(ec.get_ec_hib_delay()).is_none() {
1985+
return 1;
19791986
}
1980-
print_err(ec.get_ec_hib_delay());
19811987
} else if args.sysinfo {
19821988
print_err(ec.get_sysinfo());
19831989
} else if args.uptimeinfo {
@@ -2197,7 +2203,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
21972203
if cam { "Connected" } else { "Disconnected" }
21982204
);
21992205
} else {
2200-
println!("Not all EC versions support this comand.")
2206+
return 1;
22012207
};
22022208
} else if let Some((command_id, command_version, ref data)) = args.host_command {
22032209
match ec.send_command(command_id, command_version, data) {

0 commit comments

Comments
 (0)