Page 1 of 1

USB Root HUB init (please help)

PostPosted: Fri Sep 09, 2011 5:17 am
by Mihail_B
Hello there !
I've been seeking for help ... in lots of places ... After I've downloaded you USBSRC.ZIP I came to the
conclusion that you (once again :) ) might be the right man ...

I'm developing an uhci driver ... (dos) for my project http://filesystemd.sourceforge.net
and I got stuck at root hub initialization ...
I'm unable to figure out what is the order of steps in initing the root hub (so that I can gain access to the devices connected to it's ports)...
SetAddress first ?, SefConfiguration ?, SetPortFeature(POWER_ENABLED) ?, ... ?
I've tried to send TDs to hub ... but no reply .. nothing... i miss something ...
(so I've looked up for an UHCI controller using PCI port, I've enabled it, set irq, etc...
i've setted the frame base address, inited the ports ...
Now I only have to send some control requests consisiting of root hub initialization ...
Sorry if I wasted your time ... with my problem ...
If don't have time ... I will just have to wait another year(366days) (like I'm already trying for about ~732days ... deh - not dayly actually ...)
Thanks in advance ...
Best regards...

Re: USB Root HUB init (please help)

PostPosted: Sat Sep 10, 2011 4:50 am
by Bret
The root hub doesn't work like other hubs do. It's a "virtual" device -- it doesn't actually get assigned a real address, and you don't send packets across the bus to it like you do to a "real" USB device. In my API, I assign the root hub a (virtual) address of 1, but that's just so you have a way to refer to the root hub when using the API. There are never any control requests (not even a "Set Address") sent to the root hub, since it's actually impossible to do that. The software "intercepts" anything sent to address 1 and treats it differently than it does a real address (any address other than 1).

Also, you don't need to initialize the root hub as a separate process. Once you initialize the host controller, the root hub is also initialized. The root hub is inseparable from the host controller. As stated before, the root hub is a virtual or logical device, not a real device.

The way you monitor and control the root hub is the same way you monitor and control the host controller itself -- through the 32 byte I/O space. The first 16 bytes of the I/O space are for the host controller, and the last 16 are for the root hub. Each root hub port uses 2 bytes, and a UHCI controller can have a maximum of 2 root hub ports, so only 4 of the 16 I/O bytes dedicated to the root hub are actually used. The last 12 bytes of the I/O space are "wasted".

Re: USB Root HUB init (please help)

PostPosted: Sat Sep 10, 2011 11:31 pm
by Mihail_B
Bret wrote:Also, you don't need to initialize the root hub as a separate process. Once you initialize the host controller, the root hub is also initialized. The root hub is inseparable from the host controller. As stated before, the root hub is a virtual or logical device, not a real device.


Thanks a lot pal !
Wow that surrely saved me for a lot of trouble looking at my problem in a wrong direction !
:D
I first tryed like I was suppose to (thinking as if the root hub has been inited) but I was getting no answer from any device and got strange status bits ... so I thought based on some readings that I'm also supposed to init the root hub ...
Phew ... thanks a lot pal, again .... it's like saveing my life ....
phew

Best regards !
Merry Christmas !
Happy New Year !
Thanks a lot !
Mihai