diff --git a/drivers/usb/xhcid/src/xhci/scheme.rs b/drivers/usb/xhcid/src/xhci/scheme.rs index e676355289..6cab973dcd 100644 --- a/drivers/usb/xhcid/src/xhci/scheme.rs +++ b/drivers/usb/xhcid/src/xhci/scheme.rs @@ -2481,14 +2481,16 @@ impl Xhci { write!(contents, "descriptors\nendpoints\n").unwrap(); - if self.slot_state( - self.port_states - .get(&port_num) - .ok_or(Error::new(ENOENT))? - .slot as usize, - ) != SlotState::Configured as u8 - { - write!(contents, "configure\n").unwrap(); + // A hub child port has no PortState until the hub daemon + // triggers attach_device() for it via port/attach — an + // endpoint that itself needs no state (open_handle_attach_device). + // Open the directory anyway so that attach flow can start the + // enumeration; state-dependent subpaths (descriptors, state, + // configure) still gate on the PortState existing. + if let Some(port_state) = self.port_states.get(&port_num) { + if self.slot_state(port_state.slot as usize) != SlotState::Configured as u8 { + write!(contents, "configure\n").unwrap(); + } } Ok(Handle::Port(port_num, contents))