Main Site Documentation

Handle LEDs status of a keyboard



I’m working on a project where i plug a keyboard in the USB host of a G120 and I use the USB device to emulate a keyboard to the computer. This is done in order to modify the keys transmit to the computer according to some specification.
All works good with the USBC_Keyboard and USBH_Keyboard class. But i would have like to do the project a bit better. As manage the status of LEDs. But the 2 classes don’t give access to LEDs status. Even if i’m pretty sure that at least in the USBC_Keyboard class they are managed, because when you press Caps Lock / Num Lock or Scroll Lock, the corresponding LED lights.
Is there a way to change the status of the LEDs with the USBC_Keyboard class and a way to get the status of these LEDs from the computer with the USBH_Keyboard class ?
If no, should i use USBC_Device and USBH_RawDevice in order to handle the connection with the keyboard and the computer to get and set LEDs status. Or is there a hope that GHI will do some methods to handle the LEDs status, in a forthcoming updates of the premium library ?

Thank you in advance to anyone who can answer me.


There is no way today beside using low level raw methods, which requires some usb experience.

welcome to the community.


And moreover, I’m afraid this would be a proprietary implementation as each keyboard manufacturer does not respect a “standard” way to do that job…

Welcome on the Forum !


Thank you for your answers.

I’ll try to handle it with USBC_Device and USBH_RawDevice classes. I think successfully manage keyboards that use the HID boot protocol. Since the descriptor is fixed. And for other keyboards I will use the USBC/H_Keyboard classes.

@ Gus, when you say: “There is no way today…” Does that mean there is a chance that later it is feasible with high-level classes?


We never stopped adding features but this one is very low priority now to be honest.