Page 1 of 1

UHCI Interrupt transfer

Posted: Sat Feb 13, 2016 10:14 am
by MollenOS
So, been stuck on this all day now, control and bulk work great on real hardware for me, and I can set up pretty much any device I connect to the laptop. So I decided to code my HID driver and now after trying to test some input devices, I get a STALL on the first interrupt-IN transfer i try to make.

After device enumeration (or device-setup) for HID i do:

1) Set Idle
2) Set from boot-protocol to report protocol (ONLY if they support boot protocol)
3) Get report descriptor and parse it
4) Initiate the interrupt transfer.

I build a QH with only 1 td (consists of IN transfer with a max of (32 - 1) bytes) and queue it.

BEFORE:
TD Control/Status: 0x19800000
TD Header: 0x03E18169

It then faults to:
TD Control/Status: 0x014507FF (0 bytes transferred, CRC/Timeout, Stall)
TD Header: 0x03E18169

What am I missing?

Re: UHCI Interrupt transfer

Posted: Sat Feb 13, 2016 4:05 pm
by TomT
I have code for interrupt transfers via usb mouse using uhci and ehci that may give you ideas:

TomT
https://github.com/tatimmer/tatOS

Re: UHCI Interrupt transfer

Posted: Sat Feb 13, 2016 4:41 pm
by MollenOS
I looked at your code and you don't exactly seem to do things that much different.

The problem lies with the fact that the HID device I'm accessing is full speed and not low speed, it tells me the Max Packet size is 32 bytes. Yet windows uses 64 byte transfers with the device. (I use USBlyzer to see info from the USB stack in Windows). This leads me to believe that either windows ignore the 32 bytes specifies by the endpoint (I tried doing too, still got a stall), or perhaps they queue up 2 x, 32 byte TDs because the endpoint might require two frames, but can a full speed endpoint ask for multiple frames? Isn't that only high speed? And could that be the problem?

Re: UHCI Interrupt transfer

Posted: Mon Feb 15, 2016 12:06 pm
by TomT
What is your device ?

Re: UHCI Interrupt transfer

Posted: Mon Feb 15, 2016 12:30 pm
by MollenOS
Well after a lot of testing I found out all HID devices don't work, no matter if low or full speed. All Interrupt transfers fail on the first TD with a Stall / CRC Timeout. Which is wierd, bulk and control transfers work just fine.

One device is an USB mouse with Max endpoint size of 8 bytes, with the largest report size being 5 bytes, which means I only queue one TD with a max size of 8 bytes.

The second device is an USB dangle for wireless Headset that has 4 interfaces, one of them HID. It is full speed with a maximum endpoint size of 32 bytes, and it's report descriptor reports the largest report size of 63 bytes (I add a byte so there is room for the report Id), which means I queue 2 TDs both with a maximum of 32 bytes.

The first td of both devices stalls, all requests sent through control works just fine and give me what I want, as soon as I queue for their interrupt in endpoint, stall

Re: UHCI Interrupt transfer

Posted: Tue Feb 16, 2016 8:50 am
by MollenOS
Uhhh, for some reason it works now, I rewrote a few pieces of code and it doesn't stall anymore. Now I just have to make sure I get the data-toggles right on short-transfers and when there is multiple td's in an interrupt-qh...