User Tools

Site Tools


using_autohotkey_to_map_keys_on_the_amtelco_kb163_unified_keyboard

Using AutoHotKey to map keys on the Amtelco KB163 Unified Keyboard

The Amtelco KB163 Unified Keyboard is a giant keyboard with a ton of extended function keys we want to hook, and it looks something like this:

kb163cut.jpg

Yes, it looks old, but they're still making them – they're purpose built for call centers. All those extended keys have special purpose functions like "Dial", "Check-in", etc. I got two different ones that were being thrown out – a USB version and an AT version.

Hooking the USB version

I wanted to enable all those extra keys with AutoHotKey. I started with the USB version – this was fairly straightforward. The keyboard "holds down" an imaginary F13 key, then presses another key based on which button you pressed. AutoHotKey supports this kind of "hold one key and press another" paradigm out-of-box, so mapping these was as easy as:

F13 & 9::MsgBox You pressed the "web browser" button on your crazy Amtelco keyboard!

Unfortunately, the USB version had a very dumb numpad – the digits were arranged in phone order instead of normal numpad order (which is fixable), and the decimal point key was replaced with a duplicate slash key (which is not fixable, since it sends the same code as the normal slash).

Hooking the AT version

Because of the problems with the USB version, I turned to the AT version, which can be turned into PS/2 with an adapter (which can then be turned into USB with another adapter). This was a bit harder, since this model sends much stranger signals. It sends a special scan-code 062 UP signal before each extended key signal (both down and up). So when you depress "ON", it sends:

  1. SC062 up
  2. y down

When you release "ON", it sends:

  1. SC062 up
  2. y up

So SC062 never actually goes down – this is totally unlike any normal device, so AutoHotKey can't hook it in one line by default. To fix this, we add a bit of state to keep track of whether the SC062 up corresponds to key down or key up, then we hook the bare key conditionally. This is achieved with the following script:

; AutoHotKey handler for the AT version of the Amtelco KB163 Unified Keyboard
; (A giant keyboard with a ton of extended function keys we want to hook)
;
; This keyboard sends a special scan-code 062 **UP** signal before each extended
; key signal (both down and up).  So when you depress "ON", it sends:
;   1. SC062 up
;   2. y down
; When you release "ON", it sends:
;   1. SC062 up
;   2. y up
; So SC062 never goes down -- this is totally unlike any normal device, so AHK can't
; hook it in one line by default.  To fix this, we add a bit of state to keep track
; of whether the SC062 up corresponds to key down or key up, then we hook the bare key
; conditionally.

; Reset the SC062 tracker every second in case of a strange stuck key or whatever
SetTimer, ResetBrain, 1000
ResetBrain:
x:=0
return

; Hook the SC062 itself, setting x=1 for keydown and x=0 for keyup
*SC062 up::x:=!x

; The following hooks are only triggered for the extended keys using their "usual" scancodes.
; To get more, just press the button without it being hooked, and you'll type the hook character
#if x
j::Edit
'::Reload
#if

Conclusion

With this, it is possible to hook any extended function key on either model!

(Unfortunately, the action on this keyboard is awful – it's like typing on a fat guy, so I didn't end up using either of these keyboards. But here's the info anyway, Internet, enjoy!!!)

using_autohotkey_to_map_keys_on_the_amtelco_kb163_unified_keyboard.txt · Last modified: 2011/05/31 18:13 by tkbletsc