Skip to content

Commit 6dd82ff

Browse files
committed
Add --s0ix-counter commandline
Prints how many times the system was in s0ix since EC reset Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 4d341f4 commit 6dd82ff

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

framework_lib/src/commandline/clap_std.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ struct ClapCli {
243243
#[arg(long)]
244244
uptimeinfo: bool,
245245

246+
#[arg(long)]
247+
s0ix_counter: bool,
248+
246249
/// Hash a file of arbitrary data
247250
#[arg(long)]
248251
hash: Option<std::path::PathBuf>,
@@ -458,6 +461,7 @@ pub fn parse(args: &[String]) -> Cli {
458461
reboot_ec: args.reboot_ec,
459462
ec_hib_delay: args.ec_hib_delay,
460463
uptimeinfo: args.uptimeinfo,
464+
s0ix_counter: args.s0ix_counter,
461465
hash: args.hash.map(|x| x.into_os_string().into_string().unwrap()),
462466
driver: args.driver,
463467
pd_addrs,

framework_lib/src/commandline/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ pub struct Cli {
212212
pub reboot_ec: Option<RebootEcArg>,
213213
pub ec_hib_delay: Option<Option<u32>>,
214214
pub uptimeinfo: bool,
215+
pub s0ix_counter: bool,
215216
pub hash: Option<String>,
216217
pub pd_addrs: Option<(u16, u16, u16)>,
217218
pub pd_ports: Option<(u8, u8, u8)>,
@@ -297,6 +298,7 @@ pub fn parse(args: &[String]) -> Cli {
297298
reboot_ec: cli.reboot_ec,
298299
// ec_hib_delay
299300
uptimeinfo: cli.uptimeinfo,
301+
s0ix_counter: cli.s0ix_counter,
300302
hash: cli.hash,
301303
pd_addrs: cli.pd_addrs,
302304
pd_ports: cli.pd_ports,
@@ -1178,6 +1180,12 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
11781180
print_err(ec.get_ec_hib_delay());
11791181
} else if args.uptimeinfo {
11801182
print_err(ec.get_uptime_info());
1183+
} else if args.s0ix_counter {
1184+
if let Some(counter) = print_err(ec.get_s0ix_counter()) {
1185+
println!("s0ix_counter: {}", counter);
1186+
} else {
1187+
println!("s0ix_counter: Unknown");
1188+
}
11811189
} else if args.test {
11821190
println!("Self-Test");
11831191
let result = selftest(&ec);

framework_lib/src/commandline/uefi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub fn parse(args: &[String]) -> Cli {
7979
reboot_ec: None,
8080
ec_hib_delay: None,
8181
uptimeinfo: false,
82+
s0ix_counter: false,
8283
hash: None,
8384
// This is the only driver that works on UEFI
8485
driver: Some(CrosEcDriverType::Portio),
@@ -497,6 +498,9 @@ pub fn parse(args: &[String]) -> Cli {
497498
} else if arg == "--uptimeinfo" {
498499
cli.uptimeinfo = true;
499500
found_an_option = true;
501+
} else if arg == "--s0ix-counter" {
502+
cli.s0ix_counter = true;
503+
found_an_option = true;
500504
} else if arg == "-t" || arg == "--test" {
501505
cli.test = true;
502506
found_an_option = true;

0 commit comments

Comments
 (0)