From ba0ca4ce056a4919cdda67a5c1c244a4f867e541 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 28 Mar 2025 18:02:18 -0600 Subject: [PATCH] Also fix packet size on USB 1 --- xhcid/src/xhci/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xhcid/src/xhci/mod.rs b/xhcid/src/xhci/mod.rs index 5ac85adf8a..2f91f72497 100644 --- a/xhcid/src/xhci/mod.rs +++ b/xhcid/src/xhci/mod.rs @@ -963,11 +963,11 @@ impl Xhci { slot_id: u8, dev_desc: usb::DeviceDescriptor8Byte, ) -> Result<()> { - let new_max_packet_size = if dev_desc.major_usb_vers() == 2 { - // For USB 2.0, packet_size is in bytes + let new_max_packet_size = if dev_desc.major_usb_vers() <= 2 { + // For USB 2.0 and below, packet_size is in bytes u32::from(dev_desc.packet_size) } else { - // For other USB versions, packet_size is the shift + // For later USB versions, packet_size is the shift 1u32 << dev_desc.packet_size }; let endp_ctx = &mut input_context.device.endpoints[0]; @@ -998,11 +998,11 @@ impl Xhci { input_context.add_context.write(1 << 1); input_context.drop_context.write(0); - let new_max_packet_size = if dev_desc.major_version() == 2 { - // For USB 2.0, packet_size is in bytes + let new_max_packet_size = if dev_desc.major_version() <= 2 { + // For USB 2.0 and below, packet_size is in bytes u32::from(dev_desc.packet_size) } else { - // For other USB versions, packet_size is the shift + // For later USB versions, packet_size is the shift 1u32 << dev_desc.packet_size }; let endp_ctx = &mut input_context.device.endpoints[0];