USB error received OUT token in state DATA recevied

August 26, 2022

I'm working on a USB HID device and am getting the error can't add hid device -32 in dmesg

[87766.717582] usbhid 1-5.2:1.0: can't add hid device: -32
[87766.717594] usbhid: probe of 1-5.2:1.0 failed with error -32

It is showing up as a full speed device and printing the descriptors however fails to configure usbhid endpoint...

The host is sending a get descriptor request, the device is responding but there is no ack dispite the host retrying several times.

USB error sequence

Zooming in with the logic analyzer the protocol analyzer is giving the error "ERR: received OUT token in state DATA recevied".

USB OUT in state DATA received

The nack flag is being cleared... but it's not responding what gives?

Well it turns out it was an index error with endpoint configuration! The control endpoint was accidentally being reconfigured to the HID endpoint.... So if you happen to see the same error check that your set configuration handler is correct!

Hope it helps someone!