From 60d3d111972f462c1f38d1d4fd27e89713974fc6 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 30 Mar 2022 01:30:58 +0200 Subject: [PATCH] usb: cleanup logging. --- embassy-nrf/src/usb.rs | 18 ++++++++++-------- embassy-usb-serial/src/lib.rs | 6 +++--- embassy-usb/src/lib.rs | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index b26e40272..d9524675d 100644 --- a/embassy-nrf/src/usb.rs +++ b/embassy-nrf/src/usb.rs @@ -213,7 +213,7 @@ impl<'d, T: Instance> driver::Driver<'d> for Driver<'d, T> { }); // Enable the USB pullup, allowing enumeration. regs.usbpullup.write(|w| w.connect().enabled()); - info!("enabled"); + trace!("enabled"); Bus { phantom: PhantomData, @@ -247,23 +247,23 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> { if r.isooutcrc().bit() { regs.eventcause.write(|w| w.isooutcrc().set_bit()); - info!("USB event: isooutcrc"); + trace!("USB event: isooutcrc"); } if r.usbwuallowed().bit() { regs.eventcause.write(|w| w.usbwuallowed().set_bit()); - info!("USB event: usbwuallowed"); + trace!("USB event: usbwuallowed"); } if r.suspend().bit() { regs.eventcause.write(|w| w.suspend().set_bit()); - info!("USB event: suspend"); + trace!("USB event: suspend"); } if r.resume().bit() { regs.eventcause.write(|w| w.resume().set_bit()); - info!("USB event: resume"); + trace!("USB event: resume"); } if r.ready().bit() { regs.eventcause.write(|w| w.ready().set_bit()); - info!("USB event: ready"); + trace!("USB event: ready"); } Poll::Pending @@ -636,6 +636,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { } fn accept(&mut self) { + debug!("control accept"); let regs = T::regs(); regs.tasks_ep0status .write(|w| w.tasks_ep0status().bit(true)); @@ -645,9 +646,9 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { fn accept_in<'a>(&'a mut self, buf: &'a [u8]) -> Self::AcceptInFuture<'a> { async move { #[cfg(feature = "defmt")] - info!("control accept {:x}", buf); + debug!("control in accept {:x}", buf); #[cfg(not(feature = "defmt"))] - info!("control accept {:x?}", buf); + debug!("control in accept {:x?}", buf); let req = self.request.unwrap(); assert!(req.direction == UsbDirection::In); @@ -666,6 +667,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { } fn reject(&mut self) { + debug!("control reject"); let regs = T::regs(); regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().bit(true)); self.request = None; diff --git a/embassy-usb-serial/src/lib.rs b/embassy-usb-serial/src/lib.rs index d6c31c86e..ce1fb4775 100644 --- a/embassy-usb-serial/src/lib.rs +++ b/embassy-usb-serial/src/lib.rs @@ -125,7 +125,7 @@ impl<'d> ControlHandler for Control<'d> { data_bits: data[6], }; self.shared().line_coding.lock(|x| x.set(coding)); - info!("Set line coding to: {:?}", coding); + debug!("Set line coding to: {:?}", coding); OutResponse::Accepted } @@ -136,7 +136,7 @@ impl<'d> ControlHandler for Control<'d> { let shared = self.shared(); shared.dtr.store(dtr, Ordering::Relaxed); shared.rts.store(rts, Ordering::Relaxed); - info!("Set dtr {}, rts {}", dtr, rts); + debug!("Set dtr {}, rts {}", dtr, rts); OutResponse::Accepted } @@ -148,7 +148,7 @@ impl<'d> ControlHandler for Control<'d> { match req.request { // REQ_GET_ENCAPSULATED_COMMAND is not really supported - it will be rejected below. REQ_GET_LINE_CODING if req.length == 7 => { - info!("Sending line coding"); + debug!("Sending line coding"); let coding = self.shared().line_coding.lock(|x| x.get()); assert!(buf.len() >= 7); buf[0..4].copy_from_slice(&coding.data_rate.to_le_bytes()); diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs index 5a6b21906..2287267b6 100644 --- a/embassy-usb/src/lib.rs +++ b/embassy-usb/src/lib.rs @@ -129,7 +129,7 @@ impl<'d, D: Driver<'d>> UsbDevice<'d, D> { } }, Either::Right(req) => { - info!("control request: {:x}", req); + debug!("control request: {:x}", req); match req.direction { UsbDirection::In => self.handle_control_in(req).await,