Windows – Changing the keystrokes of a USB keyboard

keyboardwindows

Every time a key is pressed on a regular keyboard, a numeric 'key code' is sent to the computer, eg. 32 or 51 which represent specific keys.

Unrelated to my default keyboard which I am using to type this post, I want to be able to plug in a keyboard via USB and have its key codes all shifted up by some constant C.

Thus, when pressing the 'a' key on this side keyboard, the computer would not receive the keycode for 'a', but rather some higher number which the computer does not have a planned response to.

These out-of-conventional-range keystrokes will control a program of mine which knows what they are and will be listening for them.

Hardware or software solution would work for me. Perhaps there are special keyboards sold for this end, or maybe some software-related modification could let this be accomplished for any regular keyboard– I have no idea. What is crucial is that the keycode shift applies only for my side keyboard and not my default keyboard which I use for regular stuff.

Edit: I'm on Windows.

Best Answer

  • The problem you are running into here is that windows is going to recognize your USB keyboard with the HID (Human Interface Driver) and assign it the default/active keyboard mapping that you are using on that system. (Windows and to my knowledge no other desktop OS supports multiple keyboard mappings at the same time.)

    Joe's comment of a 72 button mouse might be your ticket. Otherwise, coding out your software to poll the secondary keyboard instead of using the native interrupt signals may work.

  • Related Question