mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-09-16 06:58:29 +00:00
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
This commit is contained in:
@@ -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: io::BufRead, W: io::Write>(r: R, w: W) -> Result<Upload, io::Error> {
|
||||
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user