Monday, October 24, 2011

'Programmable' keypad for Art stuffs

David Revoy posted an article on his blog about a home made accessory that places convenient art tool buttons near your screen:

I searched around for a programmable keypad, but they were expensive and few had Linux support.

But I found this cheap Ortek touchpad/numeric pad on for $20.

(It doubles as a mousepad and numeric pad.  Not ideal if you prefer physical button feedback, but this info will work on other USB keypads of your choice.)

We can't reprogram this device, but we can use Linux's udev keymap utility to remap the keys.

Here's what I added to my udev rules:  (/etc/udev/rules.d/99-local.rules)
# ORTEK Smart Pad Re-Write Rules
SUBSYSTEM=="input", ATTRS{idVendor}=="05a4", ATTRS{idProduct}=="2000", ACTION=="add", RUN+="keymap $name ortek"

I then created this file: "/lib/udev/keymaps/ortek" with this MyPaint specific keymap:

#0x70053 numlock
0x7005f f    # KP_7
0x7005c d    # KP_4
0x70059 s    # KP_1
0x70062 a    # KP_0

0x70060 y    # KP_8
0x7005d z    # KP_5
0x7005a p    # KP_2
0x70063 o    # KP_Decimal

0x70061 l    # KP_9
0x7005e g    # KP_6
0x7005b b    # KP_3
0x70054 i    # KP_Divide

0x70055 f12      # KPASTERIK
0x70056 comma    # KP_Subtract
0x70057 dot      # KP_Add
0x70058 s        # KP_Enter

0x7002a delete    # backspace

Now when I use MyPaint, or any other application, I can hold this in my hand instead of the tiring hovering over my keyboard.

Unfortunately, I haven't figured out how to do double key presses yet, like Ctrl-S, so only single character maps at this time.  If anyone knows how, please email me and I will update.

Note that this process will also work with other USB keypads, provided you create the proper udev rule to match it, and note the key codes that emit.

No comments:

Post a Comment