diff --git a/system/drivers/usb-xhci-bus/usb-xhci-library.zig b/system/drivers/usb-xhci-bus/usb-xhci-library.zig index c69ecff..544e766 100644 --- a/system/drivers/usb-xhci-bus/usb-xhci-library.zig +++ b/system/drivers/usb-xhci-bus/usb-xhci-library.zig @@ -807,6 +807,15 @@ pub const Controller = struct { /// MPS0; QEMU forgives it — the classic full-speed-mouse-on-real-hardware /// failure (M20). fn refreshMaxPacketSize0(self: *Controller, device: *Device) bool { + // SuperSpeed (and above) fix EP0's max packet size at 512, and encode + // bMaxPacketSize0 as an EXPONENT (9 = 2^9 = 512), not a literal size — + // the default is already correct and byte 7 must NOT be read as a size. + // Only full/low/high speed carry a literal 8/16/32/64 that can differ + // from the speed default and need this correction. (Reading the SS + // exponent as a size set EP0 to 9 bytes and broke every following + // transfer — a SuperSpeed hub failing to enumerate on real hardware.) + if (device.speed >= 4) return true; + var head: [8]u8 = undefined; const request = usb_abi.getDescriptor(.device, 0, 0, 8); if (!self.controlTransfer(device, request, head[0..], true)) return false;