I'm working on xhci controller driver for a proprietary OS. I'm having a problem with enumerating USB2 devices. USB3 devices get enumerated without issues. Here's what my driver does:
enableSlot
command to the controller.AddressDevice
command to the controller.maxPacketSize
EvaluateContext
command.ConfigureEndpoint
command to the controller.SET_CONFIGURATION
request to the device.success
completion code.Now, if I attach a USB3 device, all 10 steps complete without issues.
However, if I attach a USB2 device, only the first 9 steps complete and the device responds with a STALL
on the 10th step.
I have tried more things than I can even list here, including playing with the BSR, sending SET_ADDRESS requests manually, trying other configurations, different devices, sending wrong configurations... They all return a STALL on the status stage trb.
Is there any way to know what is causing the usb2 devices to stall? How can I fix this? Any pointers are much appreciated.
The problem was that I need to set the DIR bit of the status stage trb of the set configuration request to 1. USB3 devices want DIR = 0. I don't know but it works.