diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-03-30 01:30:58 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-04-06 05:38:11 +0200 |
| commit | 60d3d111972f462c1f38d1d4fd27e89713974fc6 (patch) | |
| tree | 009693ce2a54764f392a9c3137e35f6d03046fb5 | |
| parent | d1e4b3d7d5a931cd6e04b7e2fe467945ef862477 (diff) | |
usb: cleanup logging.
| -rw-r--r-- | embassy-nrf/src/usb.rs | 18 | ||||
| -rw-r--r-- | embassy-usb-serial/src/lib.rs | 6 | ||||
| -rw-r--r-- | 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> { | |||
| 213 | }); | 213 | }); |
| 214 | // Enable the USB pullup, allowing enumeration. | 214 | // Enable the USB pullup, allowing enumeration. |
| 215 | regs.usbpullup.write(|w| w.connect().enabled()); | 215 | regs.usbpullup.write(|w| w.connect().enabled()); |
| 216 | info!("enabled"); | 216 | trace!("enabled"); |
| 217 | 217 | ||
| 218 | Bus { | 218 | Bus { |
| 219 | phantom: PhantomData, | 219 | phantom: PhantomData, |
| @@ -247,23 +247,23 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> { | |||
| 247 | 247 | ||
| 248 | if r.isooutcrc().bit() { | 248 | if r.isooutcrc().bit() { |
| 249 | regs.eventcause.write(|w| w.isooutcrc().set_bit()); | 249 | regs.eventcause.write(|w| w.isooutcrc().set_bit()); |
| 250 | info!("USB event: isooutcrc"); | 250 | trace!("USB event: isooutcrc"); |
| 251 | } | 251 | } |
| 252 | if r.usbwuallowed().bit() { | 252 | if r.usbwuallowed().bit() { |
| 253 | regs.eventcause.write(|w| w.usbwuallowed().set_bit()); | 253 | regs.eventcause.write(|w| w.usbwuallowed().set_bit()); |
| 254 | info!("USB event: usbwuallowed"); | 254 | trace!("USB event: usbwuallowed"); |
| 255 | } | 255 | } |
| 256 | if r.suspend().bit() { | 256 | if r.suspend().bit() { |
| 257 | regs.eventcause.write(|w| w.suspend().set_bit()); | 257 | regs.eventcause.write(|w| w.suspend().set_bit()); |
| 258 | info!("USB event: suspend"); | 258 | trace!("USB event: suspend"); |
| 259 | } | 259 | } |
| 260 | if r.resume().bit() { | 260 | if r.resume().bit() { |
| 261 | regs.eventcause.write(|w| w.resume().set_bit()); | 261 | regs.eventcause.write(|w| w.resume().set_bit()); |
| 262 | info!("USB event: resume"); | 262 | trace!("USB event: resume"); |
| 263 | } | 263 | } |
| 264 | if r.ready().bit() { | 264 | if r.ready().bit() { |
| 265 | regs.eventcause.write(|w| w.ready().set_bit()); | 265 | regs.eventcause.write(|w| w.ready().set_bit()); |
| 266 | info!("USB event: ready"); | 266 | trace!("USB event: ready"); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | Poll::Pending | 269 | Poll::Pending |
| @@ -636,6 +636,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { | |||
| 636 | } | 636 | } |
| 637 | 637 | ||
| 638 | fn accept(&mut self) { | 638 | fn accept(&mut self) { |
| 639 | debug!("control accept"); | ||
| 639 | let regs = T::regs(); | 640 | let regs = T::regs(); |
| 640 | regs.tasks_ep0status | 641 | regs.tasks_ep0status |
| 641 | .write(|w| w.tasks_ep0status().bit(true)); | 642 | .write(|w| w.tasks_ep0status().bit(true)); |
| @@ -645,9 +646,9 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { | |||
| 645 | fn accept_in<'a>(&'a mut self, buf: &'a [u8]) -> Self::AcceptInFuture<'a> { | 646 | fn accept_in<'a>(&'a mut self, buf: &'a [u8]) -> Self::AcceptInFuture<'a> { |
| 646 | async move { | 647 | async move { |
| 647 | #[cfg(feature = "defmt")] | 648 | #[cfg(feature = "defmt")] |
| 648 | info!("control accept {:x}", buf); | 649 | debug!("control in accept {:x}", buf); |
| 649 | #[cfg(not(feature = "defmt"))] | 650 | #[cfg(not(feature = "defmt"))] |
| 650 | info!("control accept {:x?}", buf); | 651 | debug!("control in accept {:x?}", buf); |
| 651 | let req = self.request.unwrap(); | 652 | let req = self.request.unwrap(); |
| 652 | assert!(req.direction == UsbDirection::In); | 653 | assert!(req.direction == UsbDirection::In); |
| 653 | 654 | ||
| @@ -666,6 +667,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { | |||
| 666 | } | 667 | } |
| 667 | 668 | ||
| 668 | fn reject(&mut self) { | 669 | fn reject(&mut self) { |
| 670 | debug!("control reject"); | ||
| 669 | let regs = T::regs(); | 671 | let regs = T::regs(); |
| 670 | regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().bit(true)); | 672 | regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().bit(true)); |
| 671 | self.request = None; | 673 | 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> { | |||
| 125 | data_bits: data[6], | 125 | data_bits: data[6], |
| 126 | }; | 126 | }; |
| 127 | self.shared().line_coding.lock(|x| x.set(coding)); | 127 | self.shared().line_coding.lock(|x| x.set(coding)); |
| 128 | info!("Set line coding to: {:?}", coding); | 128 | debug!("Set line coding to: {:?}", coding); |
| 129 | 129 | ||
| 130 | OutResponse::Accepted | 130 | OutResponse::Accepted |
| 131 | } | 131 | } |
| @@ -136,7 +136,7 @@ impl<'d> ControlHandler for Control<'d> { | |||
| 136 | let shared = self.shared(); | 136 | let shared = self.shared(); |
| 137 | shared.dtr.store(dtr, Ordering::Relaxed); | 137 | shared.dtr.store(dtr, Ordering::Relaxed); |
| 138 | shared.rts.store(rts, Ordering::Relaxed); | 138 | shared.rts.store(rts, Ordering::Relaxed); |
| 139 | info!("Set dtr {}, rts {}", dtr, rts); | 139 | debug!("Set dtr {}, rts {}", dtr, rts); |
| 140 | 140 | ||
| 141 | OutResponse::Accepted | 141 | OutResponse::Accepted |
| 142 | } | 142 | } |
| @@ -148,7 +148,7 @@ impl<'d> ControlHandler for Control<'d> { | |||
| 148 | match req.request { | 148 | match req.request { |
| 149 | // REQ_GET_ENCAPSULATED_COMMAND is not really supported - it will be rejected below. | 149 | // REQ_GET_ENCAPSULATED_COMMAND is not really supported - it will be rejected below. |
| 150 | REQ_GET_LINE_CODING if req.length == 7 => { | 150 | REQ_GET_LINE_CODING if req.length == 7 => { |
| 151 | info!("Sending line coding"); | 151 | debug!("Sending line coding"); |
| 152 | let coding = self.shared().line_coding.lock(|x| x.get()); | 152 | let coding = self.shared().line_coding.lock(|x| x.get()); |
| 153 | assert!(buf.len() >= 7); | 153 | assert!(buf.len() >= 7); |
| 154 | buf[0..4].copy_from_slice(&coding.data_rate.to_le_bytes()); | 154 | 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> { | |||
| 129 | } | 129 | } |
| 130 | }, | 130 | }, |
| 131 | Either::Right(req) => { | 131 | Either::Right(req) => { |
| 132 | info!("control request: {:x}", req); | 132 | debug!("control request: {:x}", req); |
| 133 | 133 | ||
| 134 | match req.direction { | 134 | match req.direction { |
| 135 | UsbDirection::In => self.handle_control_in(req).await, | 135 | UsbDirection::In => self.handle_control_in(req).await, |
