@@ -43,7 +43,7 @@ use crate::chromium_ec::commands::RgbS;
4343use crate :: chromium_ec:: commands:: TabletModeOverride ;
4444use crate :: chromium_ec:: EcResponseStatus ;
4545use crate :: chromium_ec:: { print_err, EcFlashType } ;
46- use crate :: chromium_ec:: { EcError , EcResult } ;
46+ use crate :: chromium_ec:: { CrosEcDriver , EcError , EcResult } ;
4747use crate :: csme;
4848use crate :: ec_binary;
4949use crate :: esrt:: { self , ResourceType } ;
@@ -230,8 +230,7 @@ pub struct Cli {
230230 // UEFI only
231231 pub allupdate : bool ,
232232 pub paginate : bool ,
233- // TODO: This is not actually implemented yet
234- pub raw_command : Vec < String > ,
233+ pub host_command : Option < ( u16 , u8 , Vec < u8 > ) > ,
235234}
236235
237236pub fn parse ( args : & [ String ] ) -> Cli {
@@ -316,7 +315,7 @@ pub fn parse(args: &[String]) -> Cli {
316315 nvidia : cli. nvidia ,
317316 // allupdate
318317 paginate : cli. paginate ,
319- // raw_command
318+ // host_command
320319 ..Default :: default ( )
321320 }
322321 } else {
@@ -1603,9 +1602,18 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
16031602 } else {
16041603 println ! ( "Not all EC versions support this comand." )
16051604 } ;
1606- // TODO:
1607- //} else if arg == "-raw-command" {
1608- // raw_command(&args[1..]);
1605+ } else if let Some ( ( command_id, command_version, ref data) ) = args. host_command {
1606+ match ec. send_command ( command_id, command_version, data) {
1607+ Ok ( response) => {
1608+ println ! ( "Response ({} bytes):" , response. len( ) ) ;
1609+ if response. is_empty ( ) {
1610+ println ! ( " (empty)" ) ;
1611+ } else {
1612+ util:: print_multiline_buffer ( & response, 0 ) ;
1613+ }
1614+ }
1615+ Err ( e) => println ! ( "EC command failed: {:?}" , e) ,
1616+ }
16091617 } else if let Some ( pd_bin_path) = & args. pd_bin {
16101618 #[ cfg( feature = "uefi" ) ]
16111619 let data: Option < Vec < u8 > > = crate :: uefi:: fs:: shell_read_file ( pd_bin_path) ;
0 commit comments