Skip to content

Commit 1f3eadc

Browse files
committed
commandline: Add --uptimeinfo
To see when the EC and APU has reset, how often and why. > sudo framework_tool --uptimeinfo EC Uptime Time since EC Boot: 71h 06m 12s AP Resets since EC Boot: 2 EC Reset Flags PowerOn Hibernate Recent AP Resets Reset Time: 64h 34m 11s Cause: ShutdownG3 Reset Time: 65h 04m 05s Cause: ShtdownThermal Signed-off-by: Daniel Schaefer <[email protected]>
1 parent a7b621b commit 1f3eadc

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

framework_lib/src/commandline/clap_std.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ struct ClapCli {
240240
#[arg(long)]
241241
ec_hib_delay: Option<Option<u32>>,
242242

243+
#[arg(long)]
244+
uptimeinfo: bool,
245+
243246
/// Hash a file of arbitrary data
244247
#[arg(long)]
245248
hash: Option<std::path::PathBuf>,
@@ -454,6 +457,7 @@ pub fn parse(args: &[String]) -> Cli {
454457
console: args.console,
455458
reboot_ec: args.reboot_ec,
456459
ec_hib_delay: args.ec_hib_delay,
460+
uptimeinfo: args.uptimeinfo,
457461
hash: args.hash.map(|x| x.into_os_string().into_string().unwrap()),
458462
driver: args.driver,
459463
pd_addrs,

framework_lib/src/commandline/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ pub struct Cli {
211211
pub console: Option<ConsoleArg>,
212212
pub reboot_ec: Option<RebootEcArg>,
213213
pub ec_hib_delay: Option<Option<u32>>,
214+
pub uptimeinfo: bool,
214215
pub hash: Option<String>,
215216
pub pd_addrs: Option<(u16, u16, u16)>,
216217
pub pd_ports: Option<(u8, u8, u8)>,
@@ -295,6 +296,7 @@ pub fn parse(args: &[String]) -> Cli {
295296
console: cli.console,
296297
reboot_ec: cli.reboot_ec,
297298
// ec_hib_delay
299+
uptimeinfo: cli.uptimeinfo,
298300
hash: cli.hash,
299301
pd_addrs: cli.pd_addrs,
300302
pd_ports: cli.pd_ports,
@@ -1174,6 +1176,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
11741176
print_err(ec.set_ec_hib_delay(*delay));
11751177
}
11761178
print_err(ec.get_ec_hib_delay());
1179+
} else if args.uptimeinfo {
1180+
print_err(ec.get_uptime_info());
11771181
} else if args.test {
11781182
println!("Self-Test");
11791183
let result = selftest(&ec);

framework_lib/src/commandline/uefi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub fn parse(args: &[String]) -> Cli {
7878
console: None,
7979
reboot_ec: None,
8080
ec_hib_delay: None,
81+
uptimeinfo: false,
8182
hash: None,
8283
// This is the only driver that works on UEFI
8384
driver: Some(CrosEcDriverType::Portio),
@@ -493,6 +494,9 @@ pub fn parse(args: &[String]) -> Cli {
493494
Some(None)
494495
};
495496
found_an_option = true;
497+
} else if arg == "--uptimeinfo" {
498+
cli.uptimeinfo = true;
499+
found_an_option = true;
496500
} else if arg == "-t" || arg == "--test" {
497501
cli.test = true;
498502
found_an_option = true;

0 commit comments

Comments
 (0)