This project is read-only.

USB Uhci Hid support (USB Mouse)

Topics: Developing Cosmos (Working on Cosmos source code directly), Using Cosmos (Developing your own OS, projects, etc)
Oct 15, 2014 at 6:43 PM
Does anybody know the correct way of initialising the USB mouse and getting hid movement reports...i have tried and tried again but the mouse returns 8/5 zeroed bytes on real hardware and vmware but returns movement and click info on Bochs.
//Set address
CreateRawPacket(ref SETUP0, RequestType.Host2Device, StandardRequest.SET_ADDRESS, DevAddr, 0, 0);
AddASyncTD(0x22100, Token.Setup, 7, 0, 0, false, 0x22120, (uint)SETUP0, false, isLowspeed); 
AddASyncTD(0x22120, Token.In, 0, 0, 0, true, 0x1, (uint)ACK0, false, isLowspeed);

//Set Configuration
CreateRawPacket(ref SETUP1, RequestType.Host2Device, StandardRequest.SET_CONFIGURATION, 1, 0, 0);
AddASyncTD(0x22200, Token.Setup, 7, 0, DevAddr, false, 0x22220, (uint)SETUP1, false, isLowspeed);
AddASyncTD(0x22220, Token.In, 0, 0, DevAddr, true, 0x1, (uint)ACK1, false, isLowspeed);

//Get Configuration (Verify)
CreateRawPacket(ref SETUP2, RequestType.Device2Host, StandardRequest.GET_CONFIGURATION, 0, 0, 1);
AddASyncTD(0x22300, Token.Setup, 7, 0, DevAddr, false, 0x22320, (uint)SETUP2, false, isLowspeed);
AddASyncTD(0x22320, Token.In, 1, 0, DevAddr, true, 0x22340, (uint)DATA2, false, isLowspeed);
AddASyncTD(0x22340, Token.Out, 0, 0, DevAddr, false, 0x1, (uint)ACK2, false, isLowspeed);

///Get Report 
CreateClassPacket(ref SETUP3, RequestType.Device2HostClass_Interface, 0x01, 0x100, 0, 8);
AddASyncTD(0x22400, Token.Setup, 7, 0, DevAddr, false, 0x22420, (uint)SETUP3, false, isLowspeed);
AddASyncTD(0x22420, Token.In, 5, 1, DevAddr, true, 0x1, (uint)DATA3, false, isLowspeed);
I have tested them individually and all works fine but mouse doesnt return hid data on vmware or on real hardware. Instructions such as GetDeviceDescriptor, GetInterfaceDescriptor, Set/Get Configuration, Get/Set Protocol works fine. But No data is returned for hid report


Steps i took:
  1. Reset and Setup Ports, HC etc
  2. Create FrameList and map it to UHCI register FrameListAddr
  3. Pause Host Controller
  4. Create TDs and Queue Heads
  5. Create Packets for TDs
i have tried each of these Packets combinations but no return Hid movement data on real hardware;
  1. SetAddress->Set Configuration->Get Configuration->Get Report
  2. Get Device Descriptor -> SetAdress->Set Configuration->Get Configuration->Get Report
  3. Get Device Descriptor -> Get Configuration Descriptor-> SetAdress->Set Configuration->Get Configuration->Get Report
Hid is the only usb class keeping me back. The hid documents arent much help i have read them. I would like to finish HID before going to USB Mass Storage.


:) If we can get HID to work. Then Both UHCI and EHCI are pretty much guarenteed for cosmos. As i have them coded already. HID is quite a difficult task help will greatly be appreciated.