Skip to content

Commit fd7d49f

Browse files
committed
console: Handle all NULL response from driver
BUG=`framework_tool --console recent` would hang and never return because it's stuck in the loop TEST=Make sure `framework_tool --console recent` can run properly on windows and return >50 lines of log Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 9ae3349 commit fd7d49f

File tree

1 file changed

+5
-3
lines changed
  • framework_lib/src/chromium_ec

1 file changed

+5
-3
lines changed

framework_lib/src/chromium_ec/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ impl CrosEc {
820820
Ok(result.valid)
821821
}
822822

823-
/// Requests recent console output from EC and constantly asks for more
823+
/// Requests console output from EC and constantly asks for more
824824
/// Prints the output and returns it when an error is encountered
825825
pub fn console_read(&self) -> EcResult<()> {
826826
EcRequestConsoleSnapshot {}.send_command(self)?;
@@ -832,7 +832,8 @@ impl CrosEc {
832832
match cmd.send_command_vec(self) {
833833
Ok(data) => {
834834
// EC Buffer is empty. That means we've read everything from the snapshot
835-
if data.is_empty() {
835+
// The windows crosecbus driver returns all NULL instead of empty response
836+
if data.is_empty() || data.iter().all(|x| *x == 0) {
836837
debug!("Empty EC response. Stopping console read");
837838
// Don't read too fast, wait a second before reading more
838839
os_specific::sleep(1_000_000);
@@ -874,7 +875,8 @@ impl CrosEc {
874875
match cmd.send_command_vec(self) {
875876
Ok(data) => {
876877
// EC Buffer is empty. That means we've read everything
877-
if data.is_empty() {
878+
// The windows crosecbus driver returns all NULL instead of empty response
879+
if data.is_empty() || data.iter().all(|x| *x == 0) {
878880
debug!("Empty EC response. Stopping console read");
879881
return Ok(console);
880882
}

0 commit comments

Comments
 (0)