File tree 1 file changed +8
-8
lines changed
framework_lib/src/chromium_ec
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -1044,21 +1044,21 @@ impl CrosEc {
1044
1044
loop {
1045
1045
match cmd. send_command_vec ( self ) {
1046
1046
Ok ( data) => {
1047
- // EC Buffer is empty. That means we've read everything from the snapshot
1048
- // The windows crosecbus driver returns all NULL instead of empty response
1049
- if data. is_empty ( ) || data. iter ( ) . all ( |x| * x == 0 ) {
1047
+ // EC Buffer is empty. That means we've read everything from the snapshot.
1048
+ // The windows crosecbus driver returns all NULL with a leading 0x01 instead of
1049
+ // an empty response.
1050
+ if data. is_empty ( ) || data. iter ( ) . all ( |x| * x == 0 || * x == 1 ) {
1050
1051
debug ! ( "Empty EC response. Stopping console read" ) ;
1051
- // Don't read too fast, wait a second before reading more
1052
- os_specific:: sleep ( 1_000_000 ) ;
1052
+ // Don't read too fast, wait 100ms before reading more
1053
+ os_specific:: sleep ( 100_000 ) ;
1053
1054
EcRequestConsoleSnapshot { } . send_command ( self ) ?;
1054
1055
cmd. subcmd = ConsoleReadSubCommand :: ConsoleReadRecent as u8 ;
1055
1056
continue ;
1056
1057
}
1057
1058
1058
1059
let utf8 = std:: str:: from_utf8 ( & data) . unwrap ( ) ;
1059
- let ascii = utf8
1060
- . replace ( |c : char | !c. is_ascii ( ) , "" )
1061
- . replace ( [ '\0' ] , "" ) ;
1060
+ let full_ascii = utf8. replace ( |c : char | !c. is_ascii ( ) , "" ) ;
1061
+ let ascii = full_ascii. replace ( [ '\0' ] , "" ) ;
1062
1062
1063
1063
print ! ( "{}" , ascii) ;
1064
1064
}
You can’t perform that action at this time.
0 commit comments