diff --git a/src/common/include/common/command.h b/src/common/include/common/command.h index 199c8e6..1c172dd 100644 --- a/src/common/include/common/command.h +++ b/src/common/include/common/command.h @@ -44,6 +44,8 @@ enum Command { CMD_MATRIX_GET = 17, // Save LED settings to ROM CMD_LED_SAVE = 18, + // Enable/disable no input mode + CMD_SET_NO_INPUT = 19, //TODO }; diff --git a/tool/src/ec.rs b/tool/src/ec.rs index 030b94b..b3a90d1 100644 --- a/tool/src/ec.rs +++ b/tool/src/ec.rs @@ -35,6 +35,7 @@ enum Cmd { LedSetMode = 16, MatrixGet = 17, LedSave = 18, + SetNoInput = 19, } const CMD_SPI_FLAG_READ: u8 = 1 << 0; @@ -279,6 +280,10 @@ impl Ec { self.command(Cmd::MatrixGet, matrix) } + pub unsafe fn set_no_input(&mut self, no_input: bool) -> Result<(), Error> { + self.command(Cmd::SetNoInput, &mut [no_input as u8]) + } + pub fn into_dyn(self) -> Ec> where A: 'static { Ec { diff --git a/tool/src/main.rs b/tool/src/main.rs index e4ac64a..b743e44 100644 --- a/tool/src/main.rs +++ b/tool/src/main.rs @@ -377,6 +377,12 @@ fn main() { .multiple(true) ) ) + .subcommand(SubCommand::with_name("set_no_input") + .arg(Arg::with_name("value") + .possible_values(&["true", "false"]) + .required(true) + ) + ) .get_matches(); let get_ec = || -> Result<_, Error> { @@ -596,6 +602,16 @@ fn main() { }, } }, + ("set_no_input", Some(sub_m)) => { + let no_input = sub_m.value_of("value").unwrap().parse::().unwrap(); + match unsafe { ec.set_no_input(no_input) } { + Ok(()) => (), + Err(err) => { + eprintln!("failed to set no_input mode: {:X?}", err); + process::exit(1); + } + } + } _ => unreachable!() } }