xHCI: second request to EP0 of MSD never finishes

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Demindiro
Member
Member
Posts: 96
Joined: Fri Jun 11, 2021 6:02 am
Libera.chat IRC: demindiro
Location: Belgium
Contact:

xHCI: second request to EP0 of MSD never finishes

Post by Demindiro »

Hello,

I'm trying to get my xHCI driver (which works fine in QEMU aside from a single errata) to work on real hardware but I'm stuck configuring a USB2 storage device.

The first request (GET_DESCRIPTOR with DEVICE, STRING ...) always succeeds, but the second request (also GET_DESCRIPTOR) gets stuck at the setup TRB. When I pull out the device the controller sends a USB Transaction Error event, which points to the SETUP TRB of the second request.

The other built-in devices do seem to work properly, though one gives a Stall error when trying to read the device string (although reading the manufacturer string works, oddly). I have a hunch it is related but I can't figure out where to look.

My code is here.
My OS is Norost B (website, Github, sourcehut)
My filesystem is NRFS (Github, sourcehut)
User avatar
Demindiro
Member
Member
Posts: 96
Joined: Fri Jun 11, 2021 6:02 am
Libera.chat IRC: demindiro
Location: Belgium
Contact:

Re: xHCI: second request to EP0 of MSD never finishes

Post by Demindiro »

I figured out the first issue: For some reason I was setting the chain bit in the data stage TRB. I removed that and now I can send more than one request.

The stall error persists though. I wasn't sure what was up with that (manufacturer string also returns a single non-ascii byte) until I noticed the indices are all zeroes. I've reread the wiki and apparently that means the device doesn't support it, whoops.

EDIT: the stall issue appears with a device that does have non-zero indices. The other ones just returns garbage. Manufacturer index works (it's some Hewlett Packard device, apparently).
My OS is Norost B (website, Github, sourcehut)
My filesystem is NRFS (Github, sourcehut)
Post Reply