Bonfra wrote:Thanks a lot! I really appreciate what you are doing for me :)
Just don't get too busy with this rn, it still is Christmas XP
Indeed, and a Merry Christmas to you as well.
I spent a few minutes and was able to run your image through my USB Test Suite after finding a few errors.
1) The read at:
https://github.com/Bonfra04/BonsOS/blob ... uhci.c#L51
is trying to read a WORD when the register is a BYTE. QEMU seems to allow it, Bochs does not. Your UHCI code returned 'UHCI not detected' and did nothing more.
2) When setting the interface, you need to use USB_REQUEST_RECP_INTERFACE as well
https://github.com/Bonfra04/BonsOS/blob ... uest.c#L75
(For now, you can ignore setting the interface. When you find a device that supports more than one interface (BBB
and UASP for example), you will then need to set the interface)
3) Unlike IN packets, when sending OUT packets (Bulk or otherwise), you should send the count of bytes being sent, not the max count.
https://github.com/Bonfra04/BonsOS/blob ... sfer.c#L80
All but that last packet should have a count of MAX_PACKET, then the last packet has the remaining. Since your first try is a CBW, it is only one packet with 31 bytes. You currently tell it you are sending 64. It will STALL.
Your code should be something like:
Code: Select all
packets[pid].maxlen = (size > MAX_PACKET) ? MAX_PACKET : size;
size -= MAX_PACKET;
of course paying attention to negative numbers in 'size' and setting MAX_PACKET to the size returned in the endpoint descriptor for this device.
After modifying my test suite to allow these errors, I got your code to retrieve 36 bytes of Inquiry data (though I did not verify that it was correct data) and retrieve a 13-byte CSW.
Again, Merry Christmas to you and everyone here.
Ben