tool: Add a system76_ec command to disable input events
For testing Launch keyboards. Could easily support in EC firmware as well if we had a use for that, but not adding that for now.
This commit is contained in:
@ -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
|
||||
};
|
||||
|
||||
|
@ -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<A: Access> Ec<A> {
|
||||
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<Box<dyn Access>>
|
||||
where A: 'static {
|
||||
Ec {
|
||||
|
@ -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::<bool>().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!()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user