From 97fccf9c9536e48469d17ac1d6add77ca2da0d0e Mon Sep 17 00:00:00 2001 From: Matt Harvey Date: Mon, 27 Sep 2021 15:03:10 -0700 Subject: [PATCH] Forces logging off during ZMODEM uploads With logging on, the Rust logger trace messages do indeed cause the sender to abort near the beginning of the upload. Change-Id: I9ed150db1ad557034d1aefcc99385d771be3edd5 GitOrigin-RevId: 3815d6b21db1dc4978b19fc9b4307007d03e4b12 --- apps/system/components/DebugConsole/kata-shell/src/rz.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/system/components/DebugConsole/kata-shell/src/rz.rs b/apps/system/components/DebugConsole/kata-shell/src/rz.rs index e88f16d..1f263c4 100644 --- a/apps/system/components/DebugConsole/kata-shell/src/rz.rs +++ b/apps/system/components/DebugConsole/kata-shell/src/rz.rs @@ -3,6 +3,7 @@ use alloc::vec::Vec; use crc::crc32; use crc::Hasher32; +use log; use zmodem; @@ -45,6 +46,14 @@ impl io::Write for Upload { /// Receives using ZMODEM and wraps the result as an Upload. pub fn rz(r: R, w: W) -> Result { let mut upload = Upload::new(); + + // Turn off logging, since it goes to the UART and will cause the sender to + // abort. + let prior_log_level = log::max_level(); + log::set_max_level(log::LevelFilter::Off); + zmodem::recv::recv(r, w, &mut upload)?; + + log::set_max_level(prior_log_level); Ok(upload) }