Custom mapping for USB keyboard-type device

I'm trying to create an advanced remapping utility for an external USB keyboard (to be specific, it is a Razer OrbWeaver gaming keypad -- which appears to OSX as a USB keyboard with only certain keys working).


Motivation is that due to strain injuries I'm losing the ability to enter data into the computer, and this does not bode well for my future as a programmer. So I'm experimenting with alternative input systems.


It isn't going to be as simple as mapping one key to another. One key might act as a modifier to influence the next keystroke, etc.

So I'm looking to sink all key up/down events from this device, write my own mapping logic, and re-emit custom key up/down events.


I've written some test code that uses a CGEventTap to intercept events. However, at this level it doesn't seem to be possible to determine which device is responsible for the event. It appears that to do this one must work at a lower level: IOKit.

I've found https://github.com/Daij-Djan/DDHidLib which looks as though it may be the right tool for the job -- it creates an Objective-C wrapper around the necessary IOKit calls.


However, I'm not sure whether I can/should also re-emit custom events at this level.


So I should think to the most awkward events I wish to create. Mouse clicks / drags, modifier key down/up-s, copy/paste. And maybe double/triple clicks.

How should I go about injecting these events into the operating system?


π

I'm not at all an expert on this topic, but is it possible InputMethodKit does what you want?

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/InputMethodKitFrameworkRef/

Hi! I'm in searching for same thing. I found this post http://ake.in.th/2012/11/17/my-first-kernel-extension-for-logitech-presenter-device/
I tried to change kext for working with standard keyboard, but unsuccessfuly. May be it will be helpful for you.

Custom mapping for USB keyboard-type device
 
 
Q