Remapping Keys on a G80-2551 under Windows using AutoHotkey

Hey guys,

I just started remapping my keyboard using Autohotkey, and thought that some others might be interested in it too. (Especially with all these G80-2551 being sold on ebay atm...) At first I started by reading out all of the scancodes using a (apparently pretty buggy) Keyboard Hook Script. Here are the results:

Code: Select all
Function Rows (Top): Row 1(FLTR):
SC05B   SC05C   SC05D   SC063   SC064   SC065   SC066   SC067   SC068   SC069   SC06A   SC06B
Row 2:
SC03B   SC03C   SC03D   SC03E   SC03F   SC040   SC041   SC042   SC043   SC044   SC057   SC058

Function Keys on the left:      Arrow Key Cluster:
SC071   SC076                     SC05A   SC149   SC151
SC072   SC045                     SC14F   SC152   SC153
SC074   SC06D                     SC004   SC148   SC005
SC137   SC06F                     SC14B   SC147   SC14D
SC075   SC06C                     SC002   SC150   SC003


As these codes appeared familiar to me, I just checked, and it's exactly the same layout as on my Terminal Emulator Boards. I was too lazy to check it with the original Terminal Board and a teensy, but AFAIR the codes a Teensy sends are NOT the same.

Now most of the keys can simply be remapped using an easy script using the following template:
Code: Select all
SCXXX::Send $resultingkey


I won't give too many details on the usage of AHK, as it is a) too complex, and b) I don't know too much about it either.

Many special keys are described here: http://www.autohotkey.com/docs/commands/Send.htm

E.g. to make the two blank buttons on the left side send the win and the menu key you would need:
Code: Select all
SC06C::Send {AppsKey}
SC075::Send {LWin}


But when I looked at the 4 keys around the arrow Keys (the 123rd to 126th keys if you will) I encountered a problem, where I would ask for the help of some more experienced AHK users: These keys send a combination of keys which looks strange to me. Due to the buggy Keyhook script I couldn't see, in which sequence the Scancodes are being sent, but these keys send the Scancode for a number key (from 1 to 4) AND an obscure "SC000". I don't know what SC000 is normally, but I'm pretty sure it's reserved for something special. I already tried "SC000&SC002::", but AHK denied to load the script, stating the Hotkey was invalid, so I doubt if it's possible to remap these keys at all.

Anyhow I hope that this helps some people out there!

RC-1140
Last edited by RC-1140 on 03 May 2012, 19:30, edited 1 time in total.
RC-1140
User avatar

Unread post21 Feb 2012, 19:05

User avatar
X
RC-1140
 
Posts: 770
Joined: 07 Sep 2011, 20:30
Location: Germany
Main keyboard: Unicomp Terminal Emulator
Main mouse: Razer Mamba
Favorite switch: Buckling Spring
Club member: 0020
 
 
Unicomp 122-Key Terminal Emulator - IBM Model M 1394309 - IBM Model M 1394312 (Terminal) - Cherry G84-4100 - Cherry G80-1800LUMDE-2 - Cherry G80-2551HAD (with a spare NIB)
Try a space between them. So.. SC000 & SC002::
sixty
User avatar
Gasbag Guru

Unread post22 Feb 2012, 16:50

User avatar
X
sixty
Gasbag Guru
 
Posts: 2917
Joined: 28 Jan 2011, 13:47
Main keyboard: DKSaver
Main mouse: Razer Krait
Favorite switch: Cherry MX Black
Club member: 0060
 
 
Permanently buying all types of rare Cherry Corp. keyboards. PM me.
Well, I tried this too... I feel like the SC000 Code is reserved for something special, and cannot be remapped.
RC-1140
User avatar

Unread post22 Feb 2012, 17:19

User avatar
X
RC-1140
 
Posts: 770
Joined: 07 Sep 2011, 20:30
Location: Germany
Main keyboard: Unicomp Terminal Emulator
Main mouse: Razer Mamba
Favorite switch: Buckling Spring
Club member: 0020
 
 
Unicomp 122-Key Terminal Emulator - IBM Model M 1394309 - IBM Model M 1394312 (Terminal) - Cherry G84-4100 - Cherry G80-1800LUMDE-2 - Cherry G80-2551HAD (with a spare NIB)
Have you had a look at how the Neo layout is implemented in AHK? Maybe you find some pointers there:
https://svn.neo-layout.org/windows/neo-vars/src/
suka
User avatar
frobiac

Unread post23 Feb 2012, 12:36

User avatar
X
suka
frobiac
 
Posts: 197
Joined: 20 Mar 2011, 13:47
Location: Germany
Main keyboard: custom split ergonomic "RedTilt"
Main mouse: IBM trackpoint
Favorite switch: MX red
Club member: 0046
 
Where is the key hook script? I'd like to do this myself.
Trent
User avatar

Unread post26 Feb 2012, 07:52

User avatar
X
Trent
 
Posts: 288
Joined: 17 Feb 2012, 15:29
Location: United States
Main keyboard: IBM Model M
 
Hell Yeah!

I finally managed to remap the 4 missing keys!

The keys sent some strange stuff like this (e.g. for the right bottom key with the Calculator on it):

Code: Select all
VK   SC   Up/Dn   Elapsed   Key
FF   000   u      0.09      ÿ
32   003   d      0.00      2
FF   000   u      0.14      ÿ
32   003   u      0.00      2


So the UP Event for Scancode 000 twice and the ordinary DOWN and UP Event for the Number. It took me a while and the help of the Guys in the AHK IRC to get the Idea to use a variable and an #If . I thought of inverting the value of the variable on every UP event on Scancode 000. After another while I discovered how to use the Scancode 000. And the result worked!

Code: Select all
Key1:=False
VKFFSC000 UP::Key1:=!Key1
#If Key1
SC002::Send 1/2
SC003::Send Calculator
SC004::Send TD=
SC005::Send Paper


Behind the SCXXX you can put the AHK command you want. In this example they just send the Description of the Key. But note that you have to put this at the end of your AHK script. Everything behind #If Key1 will be ignored if Key1 is false, which is nearly always.

And I also discovered a better solution for mapping the Windows and Apps Key.

Code: Select all
SC06C::
Send {AppsKey down}
KeyWait SC06C
Send {AppsKey up}
return
SC075::
Send {LWin down}
KeyWait VKFFSC075
Send {LWin up}
return


And btw Trent: Sorry I didn't see your question. You can simply see the scancodes using the KeybdHook. Simply create a Autohotkey Script which has "#InstallKeybdHook" on its beginning and launch it. Afterwards double click the Tray Icon and go to "View/Key History".
Push the button you want to know and press F5 afterwards.



RC-1140
RC-1140
User avatar

Unread post03 May 2012, 19:29

User avatar
X
RC-1140
 
Posts: 770
Joined: 07 Sep 2011, 20:30
Location: Germany
Main keyboard: Unicomp Terminal Emulator
Main mouse: Razer Mamba
Favorite switch: Buckling Spring
Club member: 0020
 
 
Unicomp 122-Key Terminal Emulator - IBM Model M 1394309 - IBM Model M 1394312 (Terminal) - Cherry G84-4100 - Cherry G80-1800LUMDE-2 - Cherry G80-2551HAD (with a spare NIB)

Who is online

Users browsing this forum: ichiro [Crawler], takthemon, Yahoo [Bot] and 18 guests