keyboard driver or filter RRS feed

  • Question

  • I'm looking for the ability to log data sent to the keyboard.  Like turn on the scroll_lock led.  Everything I find using google talks about logging keyboard input.  But nothing about output to the keyboard.  Most diagrams show arrows point up stream from the keyboard but don't show the down stream path to the keyboard.



    Monday, September 22, 2014 5:45 AM


All replies

  • There are internal device I/O controls, IOCTL_KEYBOARD_SET_INDICATORS and IOCTL_KEYBOARD_SET_TYPEMATIC that are the "standard" outputs to the keyboard.  There are more capabilities with HID devices, but without knowing what you are trying to achieve it is hard to give advice.


    Don Burn Windows Filesystem and Driver Consulting Website:

    Monday, September 22, 2014 2:45 PM
  • What I'm trying to do is determine the key codes that is being sent to the keyboard to tell the KVM what to do.  They don't seem to have information on the codes.  The KVM can switch between 4 computers using ctrl-alt-number.  But if you send this sequence to the keyboard it does not work.  You can also switch to the next computer using the scroll_lock key twice.  This can be simulated by sending the scroll_lock set led followed by scroll_lock reset led.

    I figured that if I could log the information sent to the keyboard I could Then use this information to create a program that works in Linux.  They don't provide a utility for Linux only windows.

    Monday, September 22, 2014 4:00 PM
  • Any KVM I've encountered takes the scan codes from the keyboard and uses them as input.  Not data sent to the keyboard from the system.  If you are looking for scan codes for legacy keyboards see  for HID data look at

    Don Burn Windows Filesystem and Driver Consulting Website:

    Monday, September 22, 2014 4:20 PM
  • in the ps2 case setting an LED is a write to a register, in the USB HID case it is a set report call (not writing a scancode though). The KVM traps all of these special sequences (switching,etc)  directly from the keyboard, you can't inject them from the host OS

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

    Monday, September 22, 2014 4:27 PM
  • One would ask why then does the proper keyboard entries work on windows but not on Linux?  When I'm on Linux the scroll_lock sequence does not work.  The KVM should not know what OS it is running on the computer.  But If I create a script to send the sequence to turn on the scroll_lock led and then off.  It switches to the other computer.  Also if I enter the ctrl-alt-1 on the Linux computer it does not switch to computer 1.  But if I enter ctrl-alt-2 on computer 1 which is running windows it switches to the Linux computer. 


    Monday, September 22, 2014 5:27 PM
  • Its the usb keyboard.  Device manager says its an hid keyboard device.
    Monday, September 22, 2014 10:51 PM
  • Now looking for the ability to write to the keyboard.  It's very difficult the Google write to keyboard.  Everything is about reading from the keyboard.  I think I found that my key logger is seems to show both input and output from the keyboard.  There was an if statement that seems to only show keystrokes going to the application.  I eliminated the if statement and no I see more data.

    I think I see that the USBKVM switch program send a 2,ctrl,alt when I enter ctrl,alt,2.  Now I'd like to be able to duplicate that with a program  C++, VB,powershell what every works.


    Tuesday, September 23, 2014 11:31 PM
  • I was wrong.  By removing the if statement I now get key down and key up logging.  Still looking for a way to hook into the app to 8042 data stream.
    Wednesday, September 24, 2014 5:06 AM
  • you can only do that from a filter driver. i8042prt has defined hooks to allow you access to the underlying registers. there is no write path to the keyboard or controller from UM

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

    Wednesday, September 24, 2014 6:43 AM
  • Use any USB logging tool or sniffer to see what your KVM utility does to switch.

    It's very difficult the Google write to keyboard. Everything is about reading from the keyboard.

    Imagine you drive along a road and see no one going in the opposite direction. So you can guess this is an one-way road.

    -- pa

    Wednesday, September 24, 2014 12:19 PM
  • Thanks.

    I thought I was on a divided highway and I couldn't see the other side.

    Wednesday, September 24, 2014 1:25 PM
  • Yes the keyboard is mostly a one way highway.  But every now and then a wrong way driver is going the wrong way.  Like caps lock, num lock,scroll lock that I know of.  Not sure if there are other wrong way drivers.
    Wednesday, September 24, 2014 5:53 PM