diff --git a/drivers/usb/xhcid/src/xhci/device_enumerator.rs b/drivers/usb/xhcid/src/xhci/device_enumerator.rs index a84c2ada59..74b9f73251 100644 --- a/drivers/usb/xhcid/src/xhci/device_enumerator.rs +++ b/drivers/usb/xhcid/src/xhci/device_enumerator.rs @@ -77,7 +77,7 @@ impl DeviceEnumerator { } //THIS LOCKS THE PORTS. DO NOT LOCK PORTS BEFORE THIS POINT - info!("Received a device connect on port {}, but it's not enabled. Resetting the port.", port_id); + debug!("Received a device connect on port {}, but it's not enabled. Resetting the port.", port_id); let _ = self.hci.reset_port(port_id); let mut ports = self.hci.ports.lock().unwrap(); @@ -128,8 +128,10 @@ impl DeviceEnumerator { ); let result = futures::executor::block_on(self.hci.detach_device(port_id)); match result { - Ok(_) => { - info!("Device on port {} was detached", port_id); + Ok(was_connected) => { + if was_connected { + info!("Device on port {} was detached", port_id); + } } Err(err) => { warn!("processing of device attach request failed! Error: {}", err); diff --git a/drivers/usb/xhcid/src/xhci/mod.rs b/drivers/usb/xhcid/src/xhci/mod.rs index 5881b55994..bd5577070a 100644 --- a/drivers/usb/xhcid/src/xhci/mod.rs +++ b/drivers/usb/xhcid/src/xhci/mod.rs @@ -417,7 +417,7 @@ impl Xhci { let max_slots = cap.max_slots(); let max_ports = cap.max_ports(); - info!("xHC max slots: {}, max ports: {}", max_slots, max_ports); + debug!("xHC max slots: {}, max ports: {}", max_slots, max_ports); (max_slots, max_ports) }; @@ -589,7 +589,7 @@ impl Xhci { debug!("Ringing command doorbell."); self.dbs.lock().unwrap()[0].write(0); - info!("XHCI initialized."); + debug!("XHCI initialized."); self.op.get_mut().unwrap().set_cie(self.cap.cic()); @@ -633,6 +633,7 @@ impl Xhci { //Do nothing } _ => { + eprintln!("{}: CCS {}, CSC {}", port_id, ccs, csc); //Either something is connected, or nothing is connected and a port status change was asserted. self.device_enumerator_sender .send(DeviceEnumerationRequest { port_id }) @@ -668,7 +669,7 @@ impl Xhci { warn!("No detected supported protocol for port {}", port_id); } Some(protocol) => { - info!( + debug!( "Port {} is a USB {}.{} port with slot type {} and in current state {}: {:?}", port_id, protocol.rev_major(), @@ -803,7 +804,7 @@ impl Xhci { (port.read(), port.state(), port.speed(), port.flags()) }; - info!( + debug!( "XHCI Port {}: {:X}, State {}, Speed {}, Flags {:?}", port_id, data, state, speed, flags ); @@ -836,7 +837,7 @@ impl Xhci { let mut input = unsafe { self.alloc_dma_zeroed::>()? }; - info!("Attempting to address the device"); + debug!("Attempting to address the device"); let mut ring = match self .address_device(&mut input, port_id, slot_ty, slot, protocol_speed, speed) .await @@ -914,7 +915,7 @@ impl Xhci { Ok(()) } - pub async fn detach_device(&self, port_id: PortId) -> Result<()> { + pub async fn detach_device(&self, port_id: PortId) -> Result { if let Some(children) = self.drivers.remove(&port_id) { for mut child in children { info!("killing driver process {} for port {}", child.id(), port_id); @@ -964,19 +965,18 @@ impl Xhci { if let Some(state) = self.port_states.remove(&port_id) { debug!("disabling port slot {} for port {}", state.slot, port_id); - let result = self.disable_port_slot(state.slot).await; + let result = self.disable_port_slot(state.slot).await.and(Ok(true)); debug!( "disabled port slot {} for port {} with result: {:?}", state.slot, port_id, result ); - result } else { debug!( "Attempted to detach from port {}, which wasn't previously attached.", port_id ); - Ok(()) + Ok(false) } } diff --git a/drivers/usb/xhcid/src/xhci/scheme.rs b/drivers/usb/xhcid/src/xhci/scheme.rs index ada4542aec..9c9f3d6a1b 100644 --- a/drivers/usb/xhcid/src/xhci/scheme.rs +++ b/drivers/usb/xhcid/src/xhci/scheme.rs @@ -1185,7 +1185,7 @@ impl Xhci { .c .write(u32::from(avg_trb_len) | (u32::from(max_esit_payload_lo) << 16)); - log::info!("initialized endpoint {}", endp_num); + log::debug!("initialized endpoint {}", endp_num); } { @@ -1214,7 +1214,7 @@ impl Xhci { let mut req: ConfigureEndpointsReq = serde_json::from_slice(json_buf).or(Err(Error::new(EBADMSG)))?; - info!( + debug!( "Running configure endpoints command, at port {}, request: {:?}", port, req );