I know xHCI is a much more complicated process of getting a hub to work, but that's my next step.
I've read the parts in Ben Lunt's book that talk about it, but it still isn't working.
It's failing at the Set Address command (see the bottom of the post).
Also, if I enable the SetDepth request, it causes the hub to hang and stop responding.
Here's what I'm doing:
- Activate hub like any other device
- Set the configuration: type=0,request=SetConfig,value=config_value,index=0,length=0
- Set the HUB bit in the slot context and send a Evaluate Context command where A=1
- Set the hub depth (on both USB2 and 3?). type=0x20,request=0xC,value=[routing value for device, same as slot ctx],index=0,length=0
At this point it stops functioning, starts timing out or sending bad status code. If I don't do the set depth command, it continues.
. - Request hub descriptor: type=0xA0,request=GetDesc,value=0x2900,index=0,length=7 (This is only to get number of ports)
For each port: - Set feature PORTPOWER: type=0x23,request=SetFeature,value=8,index=port+1,length=0
- Clear feature PORTCNCTN: type=0x23,request=ClrFeature,value=0x10,index=port+1,length=0
- Check Status: type=0xA3,request=GetStatus,value=0,index=port+1,length=4
Check if HUB_STATUS_CONNECTION bit is on. Break if not.
. - Set Feature RESET: type=0x23,request=SetFeature,value=4,index=port+1,length=0
(Wait 50ms) - Check Status: type=0xA3,request=GetStatus,value=0,index=port+1,length=4
Check if HUB_STATUS_CONNECTION bit is on. Break if not.
. - Clear Feature CRESET: type=0x23,request=ClrFeature,value=0x14,index=port+1,length=0
If this succeeds, a valid device is found. My code gets here as long as the SetDepth request is disabled.
. - Get Hub status to see if connected device is lowspeed or not: 0xA3,GetStatus,0,port+1,4
- Generate new routing value for the device
- Create a new slot (and context) for the device:
.......place the routing value in the slot context
.......set the RH port num to the parent's RH port num - Send SetAddress. This always fails. It returns 0x5000000, or TRB error?
Code: Select all
For reference, here is the TRB. It doesn't look like there's anything wrong:
Param: 8CE000
Status: 0
Command: 5002C00
And here's the slot context I'm trying to enable:
08100000 00040000 00000000 00000000 00000000 00000000 00000000 00000000
Any help is appreciated