USB Keyboard - setting LED's not working

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
alwaysnub
Posts: 20
Joined: Sat Aug 14, 2010 9:49 pm

USB Keyboard - setting LED's not working

Post by alwaysnub »

I am working on a USB keyboard device driver/code for my OS.
Currently trying to get the numlock and capslock LED's to light up using the boot-protocol SetReport(Out), but even though the usb transfer is completed successfully, the LED's dont light up.
If i wait too long after initializing the device (i,e 1-4 seconds) before trying to set the LED's, then the usb transfer reports a CRC Time Out error. This makes me think im not completely initializing the device.

I do the following before trying to set the LED's:
USB_SetConfiguration
HID_SetProtocol (0) Boot-Protocol
HID_GetReportDescriptor

Am i missing a step? I could not find anything else in the HID specifications.
alwaysnub
Posts: 20
Joined: Sat Aug 14, 2010 9:49 pm

Re: USB Keyboard - setting LED's not working

Post by alwaysnub »

I have solved this problem.

This is actually related to the uhci and not the HID specifically.
The reason the LED's never light up and a time-out error is generated after a period of time is because after each uhci transaction i was stopping the scheduler/controller -
(Setting bit-0 to 0 in the CMD register)

You MUST leave the controller running!
Post Reply