@@ -30,9 +30,9 @@ use crate::ccgx::{self, SiliconId::*};
3030use crate :: chromium_ec;
3131use crate :: chromium_ec:: commands:: DeckStateMode ;
3232use crate :: chromium_ec:: commands:: FpLedBrightnessLevel ;
33+ use crate :: chromium_ec:: commands:: RebootEcCmd ;
3334use crate :: chromium_ec:: print_err;
34- use crate :: chromium_ec:: EcError ;
35- use crate :: chromium_ec:: EcResult ;
35+ use crate :: chromium_ec:: { EcError , EcResult } ;
3636#[ cfg( feature = "linux" ) ]
3737use crate :: csme;
3838use crate :: ec_binary;
@@ -59,6 +59,16 @@ pub enum ConsoleArg {
5959 Follow ,
6060}
6161
62+ #[ cfg_attr( not( feature = "uefi" ) , derive( clap:: ValueEnum ) ) ]
63+ #[ derive( Clone , Debug , PartialEq ) ]
64+ pub enum RebootEcArg {
65+ Reboot ,
66+ JumpRo ,
67+ JumpRw ,
68+ CancelJump ,
69+ DisableJump ,
70+ }
71+
6272#[ cfg_attr( not( feature = "uefi" ) , derive( clap:: ValueEnum ) ) ]
6373#[ derive( Clone , Copy , Debug , PartialEq ) ]
6474pub enum FpBrightnessArg {
@@ -124,6 +134,7 @@ pub struct Cli {
124134 pub fp_brightness : Option < Option < FpBrightnessArg > > ,
125135 pub kblight : Option < Option < u8 > > ,
126136 pub console : Option < ConsoleArg > ,
137+ pub reboot_ec : Option < RebootEcArg > ,
127138 pub help : bool ,
128139 pub info : bool ,
129140 // UEFI only
@@ -484,6 +495,29 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
484495 Err ( err) => println ! ( "Failed to read console: {:?}" , err) ,
485496 } ,
486497 }
498+ } else if let Some ( reboot_arg) = & args. reboot_ec {
499+ match reboot_arg {
500+ RebootEcArg :: Reboot => match ec. reboot_ec ( RebootEcCmd :: ColdReboot ) {
501+ Ok ( _) => { }
502+ Err ( err) => println ! ( "Failed: {:?}" , err) ,
503+ } ,
504+ RebootEcArg :: JumpRo => match ec. jump_ro ( ) {
505+ Ok ( _) => { }
506+ Err ( err) => println ! ( "Failed: {:?}" , err) ,
507+ } ,
508+ RebootEcArg :: JumpRw => match ec. jump_rw ( ) {
509+ Ok ( _) => { }
510+ Err ( err) => println ! ( "Failed: {:?}" , err) ,
511+ } ,
512+ RebootEcArg :: CancelJump => match ec. cancel_jump ( ) {
513+ Ok ( _) => { }
514+ Err ( err) => println ! ( "Failed: {:?}" , err) ,
515+ } ,
516+ RebootEcArg :: DisableJump => match ec. disable_jump ( ) {
517+ Ok ( _) => { }
518+ Err ( err) => println ! ( "Failed: {:?}" , err) ,
519+ } ,
520+ }
487521 } else if args. test {
488522 println ! ( "Self-Test" ) ;
489523 let result = selftest ( & ec) ;
@@ -655,6 +689,7 @@ Options:
655689 --fp-brightness [<VAL>]Get or set fingerprint LED brightness level [possible values: high, medium, low]
656690 --kblight [<KBLIGHT>] Set keyboard backlight percentage or get, if no value provided
657691 --console <CONSOLE> Get EC console, choose whether recent or to follow the output [possible values: recent, follow]
692+ --reboot-ec Control EC RO/RW jump [possible values: reboot, jump-ro, jump-rw, cancel-jump, disable-jump]
658693 -t, --test Run self-test to check if interaction with EC is possible
659694 -h, --help Print help information
660695 "#
0 commit comments