From 76385adca302ad97cbcc2ec0fe350a9b4dfdef23 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 25 Jun 2026 13:03:19 -0600 Subject: [PATCH] xhcid: do not read interface names and add more debugging --- .../usb/xhcid/src/xhci/device_enumerator.rs | 5 ++- drivers/usb/xhcid/src/xhci/mod.rs | 34 ++++++++++++++++--- drivers/usb/xhcid/src/xhci/scheme.rs | 3 ++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/usb/xhcid/src/xhci/device_enumerator.rs b/drivers/usb/xhcid/src/xhci/device_enumerator.rs index 74b9f73251..3fcd7c7e0e 100644 --- a/drivers/usb/xhcid/src/xhci/device_enumerator.rs +++ b/drivers/usb/xhcid/src/xhci/device_enumerator.rs @@ -134,7 +134,10 @@ impl DeviceEnumerator { } } Err(err) => { - warn!("processing of device attach request failed! Error: {}", err); + warn!( + "processing of device dettach request failed! Error: {}", + err + ); } } } diff --git a/drivers/usb/xhcid/src/xhci/mod.rs b/drivers/usb/xhcid/src/xhci/mod.rs index d9b0c2cf95..d33069e180 100644 --- a/drivers/usb/xhcid/src/xhci/mod.rs +++ b/drivers/usb/xhcid/src/xhci/mod.rs @@ -900,14 +900,36 @@ impl Xhci { let mut input = port_state.input_context.lock().unwrap(); - self.update_max_packet_size(&mut *input, slot, dev_desc_8_byte) - .await?; + match self + .update_max_packet_size(&mut *input, slot, dev_desc_8_byte) + .await + { + Ok(()) => {} + Err(err) => { + error!( + "Failed to update max packet size for port {}: `{}`", + port_id, err + ); + return Err(err); + } + } } debug!("Got the 8 byte dev descriptor: {:X?}", dev_desc_8_byte); - let dev_desc = self.get_desc(port_id, slot).await?; - debug!("Got the full device descriptor!"); + let dev_desc = match self.get_desc(port_id, slot).await { + Ok(ok) => { + debug!("Got the full device descriptor!"); + ok + } + Err(err) => { + error!( + "Failed to get full device descriptor for port {}: `{}`", + port_id, err + ); + return Err(err); + } + }; self.port_states.get_mut(&port_id).unwrap().dev_desc = Some(dev_desc); debug!("Got the port states again!"); @@ -1015,6 +1037,10 @@ impl Xhci { // For later USB versions, packet_size is the shift 1u32 << dev_desc.packet_size }; + debug!( + "Setting new packet size of slot {} to {}", + slot_id, new_max_packet_size + ); let mut b = input_context.device.endpoints[0].b.read(); b &= 0x0000_FFFF; b |= (new_max_packet_size) << 16; diff --git a/drivers/usb/xhcid/src/xhci/scheme.rs b/drivers/usb/xhcid/src/xhci/scheme.rs index 30ee55a5b2..e47223d524 100644 --- a/drivers/usb/xhcid/src/xhci/scheme.rs +++ b/drivers/usb/xhcid/src/xhci/scheme.rs @@ -552,10 +552,13 @@ impl Xhci { alternate_setting: desc.alternate_setting, class: desc.class, interface_str: if desc.interface_str > 0 { + /*TODO: broken on some devices Some( self.fetch_string_desc(port_id, slot, desc.interface_str, lang_id) .await?, ) + */ + None } else { None },