Example keyboard HID driver? RRS feed

  • Question

  • Hi, I'm writing a driver for the keyboard. I have the part where it interfaces with the hardware working correctly but need help with properly passing the data to the rest of the system. Currently I call an app in userland which does SendInput but that is subpar as it doesn't work with repeated keys and doesn't work on the login screen and the lock screen. Is there an example on making a keyboard driver so I can properly pass the data on to windows?

    Wednesday, May 13, 2015 4:50 PM


  • the strongly recommended approach is to write this as a WDF (either KMDF or UMDF) HID miniport. your miniport will report a HID descriptor that contains a keyboard. The in box HID stack (hidclass.sys) will enumerate a child stack for the keyboard, load the std keyboard driver (kbdhid.sys) and report the data.  Basically, you write a driver one level below the keyboard stack and then you get to reuse the keyboard stack wholesale. There are a couple of samples demonstrating how to write the HID miniport, hidusbfx2 is one of them.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, May 13, 2015 5:26 PM