none
Trying to convert a Lower HID Keyboard Filter to an Upper filter above kbdhid RRS feed

  • Question

  • Hello,

    A few months ago I solicited some help regarding writing a filter for a USB/HID keyboard.  Thanks to all who gave help especially DH.  It does work and I can even get diagnostic feed back from it.

    Unfortunately, it seems to lack the flexibility I required.  It is loaded as a lower filter below  kbdhid.   I do get the HID keyboard reports, but I can only change that single report.  I want to be able to insert an additional keyboard report ( I want to be able to send another key with it's own modifiers).  I don't see/know how to do it. Here are a couple of options I thought about, but I don't know how to implement either one:

    1)

    It seems to me that one option would be to some how get the kbdhid driver to request a second read from the keyboard WITHOUT an actual keystroke occurring.  Presumably it would be identical to the first one since the pressed keys hasn't changed in that brief time.  But, then using this second report one I could change it to insert the desired key/modifier.

    2)

    Another option might be to use an upper filter between kbdhid and kbdclass. (It would have to be before the I8042 to the kbdclass input because  we already have an upper filter for the kbdclass that filter keystroke from a PS/2 keyboard. )  I have tried moving the existing, functional HID filter from a lower filter to an upper filter.  It does load and devcon shows it to be an upper filter above kbdhid.  Debug diagnostics show that DriverEntry gets call and that the EvtIoDeviceControl routine gets called a few times initially, just like when it was a lower filter.

    However, the EvtIoRead and EvtIoWrite routines never get called, let alone the ReadCompletion routine.

    Obviously there is something different between lower and upper filters, but what.  Do they take the same callback routines/protocols?

    Also is the output of the kbdhid in HID keyboard report format or has it changed to the KEYBOARD_INPUT_DATA format.

    How can I capture HID keyboard data after kbdhid?

    3)

    ???

    Thanks,

    Don


    • Edited by Don Jr Friday, February 20, 2015 12:50 AM
    Friday, February 20, 2015 12:44 AM

Answers

  • look at the kbdfiltr sample. It shows how to implement a filter between the port and kbdclass, just like you want. These interface with a service callback routine, your filter will hook the callback chain. This allows you to see reported keystrokes as well as insert your own at any time

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

    Friday, February 20, 2015 4:49 AM

All replies

  • look at the kbdfiltr sample. It shows how to implement a filter between the port and kbdclass, just like you want. These interface with a service callback routine, your filter will hook the callback chain. This allows you to see reported keystrokes as well as insert your own at any time

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

    Friday, February 20, 2015 4:49 AM
  • the way to make this work with your current setup is to queue the read request kbdhid sends and then send down your own request. When you want to report a new key outside of the hw reporting, you complete the queued read with the data. This gets complex if the read you send down completes before kbdhid can send another read

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

    Friday, February 20, 2015 4:51 AM
  • Thank you.

    I guess you can tell that I am still learning, but how do I "queue the read request kbdhid sends and then send down your own request"?

    Also, when you say it can get complex, do you mean if the request I would send down does NOT complete before kbdhid needs to send another read due to a HW keyboard event?

    Thanks, again.

    Don


    • Edited by Don Jr Friday, February 20, 2015 2:49 PM
    Friday, February 20, 2015 2:48 PM