Contribute
Register

4530s Remap Caps Lock to Escape

Status
Not open for further replies.
Joined
Oct 17, 2012
Messages
14
Motherboard
hp probook 4530s
CPU
i3
Graphics
hd 3000
Mac
  1. 0
Classic Mac
  1. 0
Mobile Phone
  1. 0
I'm trying to figure out how to remap my "caps lock" key to "escape" on my 4530s running 10.8.2. I have a macbook at work that I've done this with using the program "PCKeyboardHack", when I try that on my 4530s it does nothing.

I also tried "KeyRemap4MacBook", when I rebooted after installing that, both my integrated keyboard AND trackpad both didn't work at all. I had to plug in an external keyboard and mouse to un-install that to get back to a working state.

In case you are wondering WHY I want to do this, it's because I'm a heavy vim user and now have muscle memory to hit "caps lock" for "escape".
 
I'm trying to figure out how to remap my "caps lock" key to "escape" on my 4530s running 10.8.2. I have a macbook at work that I've done this with using the program "PCKeyboardHack", when I try that on my 4530s it does nothing.

I also tried "KeyRemap4MacBook", when I rebooted after installing that, both my integrated keyboard AND trackpad both didn't work at all. I had to plug in an external keyboard and mouse to un-install that to get back to a working state.

In case you are wondering WHY I want to do this, it's because I'm a heavy vim user and now have muscle memory to hit "caps lock" for "escape".

You can probably do it using my Voodoo keyboard driver & remapping. It is a lower level remap... happens before even things like KyeRemap4MacBook see it. See: https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/wiki/How-to-Use-Custom-Keyboard-Mapping

BTW, I'm using KeyRemap4MacBook without issue. I wonder if you had a conflict between it and PCKeyboardHack. Not a good idea to have two different keyboard remappers present.
 
I got Keymap4Macbook to work. It has an option for "caps lock" that simply tells you to use "PCKeyboardHack" which I can't get to work. So I'm kinda stuck there.

PCKeyBoardHack is trying to remap keycode 57 (caps lock) to 53 (escape). Maybe those aren't the correct keycodes for the 4530s?

I looked at the link you gave me, I'm completely unclear how I'm supposed to get the PS2 scan code and/or ADB codes for the caps lock and escape keys. debug mode?
 
I got Keymap4Macbook to work. It has an option for "caps lock" that simply tells you to use "PCKeyboardHack" which I can't get to work. So I'm kinda stuck there.

PCKeyBoardHack is trying to remap keycode 57 (caps lock) to 53 (escape). Maybe those aren't the correct keycodes for the 4530s?

PCKeyboardHack and Keymap4MacBook both deal in ADB codes. The ADB codes are generic for any keyboard. Main job of the keyboard driver is to receive raw input from the keyboard (in our case, PS/2 scan codes) and generate ADB codes.

57 and 53 are indeed the ADB codes for CapsLock and Escape.

I looked at the link you gave me, I'm completely unclear how I'm supposed to get the PS2 scan code and/or ADB codes for the caps lock and escape keys. debug mode?

You guessed right. Run debug version and examine the scan codes in Console as you press the keys. Then experiment with remapping them.
 
I got it working! Thank you so much Rehabman for you help with this and all of the other amazing things you do for OS X on hp probooks.

Not sure if anyone else is going to want to do exactly what I did, but I'll share a bit just in case.

When I was in debug mode, I saw different scan codes for "up" and "down" in my /var/log/system.log. At first I just tried to remap the codes for "down" and it didn't work. I then did it for "up" and "down" and now it works.

I ended up with adding these 2 lines to the <key>Custom PS2 Map</key> section of the Info.plist file.(from the link Rehabman provided)

<string>ba=81</string>
<string>3a=1</string>

These are the snippets that I saw when I had debug on in my system.log file that I used to arrive at what values to put in here.

capslock


Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x39 up
Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x3a
Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x39 down
Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0xba


escape


Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x35 up
Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x1
Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x35 down
Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x81
 
I got it working! Thank you so much Rehabman for you help with this and all of the other amazing things you do for OS X on hp probooks.

Not sure if anyone else is going to want to do exactly what I did, but I'll share a bit just in case.

When I was in debug mode, I saw different scan codes for "up" and "down" in my /var/log/system.log. At first I just tried to remap the codes for "down" and it didn't work.

Yes. These are refered to as 'make' (down) and 'break' (up) codes.

I then did it for "up" and "down" and now it works.

I don't think mapping the up is doing anything. The code strips the make/break bit before running through the mapping table:

Code:
    unsigned keyCodeRaw = scanCode & ~kSC_UpBit;
...
        keyCode = _PS2ToPS2Map[keyCodeRaw];
...
    UInt8 adbKeyCode = _PS2ToADBMap[keyCode];
...

I ended up with adding these 2 lines to the <key>Custom PS2 Map</key> section of the Info.plist file.(from the link Rehabman provided)

<string>ba=81</string>
<string>3a=1</string>

These are the snippets that I saw when I had debug on in my system.log file that I used to arrive at what values to put in here.

capslock


Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x39 up
Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x3a
Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x39 down
Dec 16 09:28:12 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0xba


escape


Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x35 up
Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x1
Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: ADB key code 0x35 down
Dec 16 09:30:08 localhost kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x81

If your intention is to swap the keys, you should do:

Code:
       <string>3a=1</string>
       <string>1=3a</string>

Otherwise, I think you loose capslock completely (it is escape), and escape is still escape.

But, of course, I haven't tried/tested it, so YMMV...

Edit: Tested... Works...
 
Status
Not open for further replies.
Back
Top