Like LEDs for a USB keyboard under Windows

I am trying to install the keyboard LEDs of a USB keyboard. I already tried / knew the following:

  • To set the PS / 2 keyboard LEDs, you can use CreateFile ("\\. \ Keybd", GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); DeviceIoControl (hKeybd, IOCTL_KEYBOARD_SET_INDICATORS ...

  • To set the LEDs to be truly compatible with the HID keyboard, you can use DirectInput, SendDeviceData using page 8.

  • You can use SendInput / keybd_event. But it will also change the state. Therefore, when you change CAPS LOCK using this method during user input, he / she will receive upper and lower case letters :-)

When I explored method 2 with two keyboards, the SendDeviceData function always returns E_NOTIMPL. Many USB keyboard makers seem to rely on the built-in HID driver. In this case, the HID driver reports that the keyboard as an amplified keyboard for the PC says it is "emulation". But Windows HID emulation does not support SendDeviceData.

Therefore, I suspect there must be another way to install the keyboard LEDs. Windows must talk to the USB keyboard to install the LEDs :-)

Any ideas on changing the keyboard LEDs without changing the status of the keyboard?

+5
source share
1 answer

HID Descriptor Tool, HID . 8 ( "" ). USB, .

keybd_event, , , Windows .

+2

All Articles