Content originally posted in LPCWare by Baggiz on Fri Mar 02 02:31:41 MST 2012
Hi,
In fact I am not only trying to port it to lpc2387, I am also trying to expand its functionality so it will be able to speak with a intermediate hub and two devices behind it. Doing so seems to force me into doing changes not only to the "outer sides" of the code, but also to the code's core, which I think makes it less usable as a generic library.
So far I have managed to enumerate the hub and start asking the first device for its setup. In that process I stumbled upon a thing which puzzled me a great deal at first. The device has a EP0 packet size of eight bytes, while the previous enumerated hub has 64, so when I sent a Get Device Descriptor request to the device only one data/IN transaction containing eight of 18 bytes were received. When doing the same thing to the hub all 18 bytes were received in one single data/IN transaction. Obviously it had something to do with the EP0 packet size. What I then tried was to modified the code in "HcdControlTransfer" in OHCI.c so that it would add the necessary number of Data Stage TDs to the queue and voila then it worked as expected!
The question I now have is why I had to do like that? It seems that in the original LUFA code and other USB host drivers don't have to take this step? So what is the thought behind your code, is it designed to allow for multiple IN transactions? Is there something I haven't configured right? Getting 18 bytes by queueing more TDs is manageable since it only needs three IN TDs, but getting the Configuration Descriptor won't be possible since its total length is 1191 bytes, which would require a very large TD queue.
An alternative might be some kind of event driven mechanism, start with queue the Setup transaction and one data/IN TD and when the data is received add another data/IN TD until all data is received.