Page 1 of 2

SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 04, 2011 1:04 am
by Anastasius
Image

SpecialKeys
I created a Preference Pane utility for Mac OS X and modified some kext extensions to remap various keys and combinations, like Volume, Tablet Buttons, Fn+F10 etc. to the real Mac's system actions with a GUI interface on-the-fly. Currently it is based on VooodooPS2Keyboard by Voodoo team and ThinkpadHotkeyController by Wencheng FANG.
I will put the sources very soon to public domain.

You can create several layouts, edit them, remap almost any key on your internal keyboard (including tablet buttons and redefine some Fn+X combinations) and in the future I plan to add an ability to change layouts depending on current application and tablet orientation.

You can download it here: http://code.google.com/p/specialkeys/

INSTALLATION:
1) Unpack this archive and put VoodooPS2Keboard.kext from archive's VoodooPS2Controller.kext/Contents/PlugIns into /S/L/E/VoodooPS2Controller.kext/Contents/PlugIns
2) Install SpecialKeys.prefpane by double-clicking it
3) Put SpecialKeysTray to /Applications and set it to run on boot (to remap keyboard after restart)

USAGE:
Run System Preferences and then click SpecialKeys

It can create multiple layouts that are being saved to ~/Library/Preferences/SpecialKeys/*.xml

CURRENT VERSION: 0.2b
SUPPORTED: Thinkpad PS/2 Keyboard, X61/X60 Tablet buttons, some Fn+combinations supported
KNOWN BUGS: Some shortcuts cannot be mapped to the keys and some Fn+combinations are not being recognized
TESTED ON: Lenovo X61 tablet, and Snow Leopard 10.6.5 but it should work on other Thinkpad models and OSes.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 04, 2011 7:47 am
by Sebinouse
I was able to download and install everything, but I can't get it to load properly. The application fails to load and the prefpanel also. I also have this error message on console :

Code: Select all

04/01/11 14:42:48	Dock[210]	LSOpenFromURLSpec(file://localhost/Applications/SpecialKeysTray.app/) failed with -10661
I have this screen, if it helps : ScreenShot

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 04, 2011 5:39 pm
by CP-Geek
I'm having some similar errors (X61 + 10.6.5), in my case the prefpane can't conneect to keyboard subsystem.

Will try to dig into that in few days.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 04, 2011 5:58 pm
by Anastasius
Sebinouse wrote:I was able to download and install everything, but I can't get it to load properly. The application fails to load and the prefpanel also. I also have this error message on console :

Code: Select all

04/01/11 14:42:48	Dock[210]	LSOpenFromURLSpec(file://localhost/Applications/SpecialKeysTray.app/) failed with -10661
...
Thanks for the log and screenshot. I'll try to find out what could've gone wrong...

CP-Geek wrote:I'm having some similar errors (X61 + 10.6.5), in my case the prefpane can't conneect to keyboard subsystem.

Will try to dig into that in few days.
It seems you're not using the correct VoodooPS2Keyboard.kext - it must be inside VoodooPS2Controller.kext.
And there should be no other VoodooPS2Controller neither inside /Extra nor inside /S/L/E. Only one, with VoodooPS2Keyboard injected from the archive above.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 04, 2011 11:42 pm
by CP-Geek
Could You upload Your VoodooPS2Controller.kext? There might be version differences?

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Fri Jan 07, 2011 10:51 am
by CP-Geek
Allright, after some diggin' in to system:

- Only one VoodooPS2Controller.kext in S/L/E
- VoodooPS2Keyboard.kext is in Plugins
- SpecialKeysTray is in startup items

Still the same thing, Prefpane can't connect to keyboard subsystem. Very strange.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Sat Jan 08, 2011 8:27 am
by Sebinouse
Do you boot in 64 bit on your X61 ?

Because I only use 32 bit on my X60t (L2400 CoreDuo) ...

And do you plan to share the source code ?, so I can compile it (i386 for me).

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Sat Jan 08, 2011 12:35 pm
by CP-Geek
Anastasius:

I boot also in 32-bit since display is not accelerated in 64-bit?

Could You share Your VoodooPS2Controller.kext since there might be version differences, also do You boot in 32- or 64-bit?

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Mon Jan 10, 2011 9:50 am
by Great Gatsby
Anastasius wrote: SpecialKeys
I created a Preference Pane utility for Mac OS X and modified some kext extensions to remap various keys and combinations, like Volume, Tablet Buttons, Fn+F10 etc. to the real Mac's system actions with a GUI interface on-the-fly. [...]
Thank you, this looks very promising indeed! :-) :thumbs-UP: Does this mean that strokes on the ThinkPad's special keys like Volume Up/Down will finally result in seeing the OS X OnScreen Display? :!: :?:

Image

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Mon Jan 10, 2011 3:15 pm
by CP-Geek
Volumekeys (up/down, not mute) already work? It's the other that won't.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Mon Jan 10, 2011 6:01 pm
by Great Gatsby
CP-Geek wrote:Volumekeys (up/down, not mute) already work? It's the other that won't.
To avoid misunderstandings: That screenshot above was not mine and it was not taken using Anastasius' tool, I just posted it to clarify what I meant by the term 'OS X OnScreen Display'.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 11, 2011 11:10 am
by CP-Geek
Oh, my bad :)

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Wed Jan 12, 2011 3:40 pm
by Anastasius
CP-Geek

Here I include my VoodooPS2Controller with SpecialKeys and driver for TrackPoint injected. Sorry for a delay.
http://www.mediafire.com/?ujzul1323qqrg9o

Great Gatsby

Yes, the OnScreen display works perfectly for me and volume buttons as well.
And the buttons that control multimedia play back (Fn+Up,Down,Right etc.) too.
Sebinouse wrote:Do you boot in 64 bit on your X61 ?

Because I only use 32 bit on my X60t (L2400 CoreDuo) ...

And do you plan to share the source code ?, so I can compile it (i386 for me).
I'm booting kernel in 32-bit mode. Yep, I plan to post the code on this week

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Wed Jan 12, 2011 5:32 pm
by Great Gatsby
Anastasius wrote:Great Gatsby
Yes, the OnScreen display works perfectly for me and volume buttons as well.
And the buttons that control multimedia play back (Fn+Up,Down,Right etc.) too.
That's great news, thank you! :-) I think I'll try this out as soon as I have the time to do so. - Please continue your work, it's highly appreciated! :thumbs-UP:

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Fri Jan 14, 2011 4:13 pm
by CP-Geek
Anastacius thanks for the upload, the test however failed miserably, the keyboard sent the sign @ in millions so it was not so good.

I'll tryu to dig into this.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Fri Jan 14, 2011 9:07 pm
by Anastasius
Great Gatsby wrote: That's great news, thank you! :-) I think I'll try this out as soon as I have the time to do so. - Please continue your work, it's highly appreciated! :thumbs-UP:
8)
CP-Geek wrote:Anastacius thanks for the upload, the test however failed miserably, the keyboard sent the sign @ in millions so it was not so good.

I'll tryu to dig into this.
Do you have trackpad or do you have trackpoint? My version comes with trackpoint driver. Maybe that's the case.
Try also removing ApplePS2Controller.kext from /S/L/E - they may interfere.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Sat Jan 15, 2011 6:28 am
by Sebinouse
I have tried to boot with your VoodooPS2Controller in SLE (nothing else on PS2 in EE or in SLE).
It panics almost every times ...
I've this error during boot when it works :

Code: Select all

15/01/11 13:13:23	kernel	Kernel Extensions in backtrace (with dependencies):
15/01/11 13:13:23	kernel	org.voodoo.driver.PS2Controller(1.1.0)@0x41c20000->0x41c25fff
15/01/11 13:13:23	kernel	PS2Controller: Created dev /ps2controllerUsing new IRQ layout 0,1
I also have a lot of these (each time I press a key ?) :

Code: Select all

15/01/11 13:25:46	kernel	ApplePS2Keyboard: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [0x589ec00] 88
15/01/11 13:25:46	kernel	ApplePS2Keyboard:!!! SEND MESSAGE TO CLIENTS
15/01/11 13:25:46	kernel	ApplePS2Keyboard:!!! SEND MESSAGE TO CLIENTS OK
15/01/11 13:25:46	kernel	ApplePS2Keyboard: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>> [0x589ec00] 47 -> 9
One more thing, when keyboard works trackpoint doesn't and when track point works keybaord doesn't ... (no trackpad on my X60t)

I think we are getting closer ... I just have to be able to load your special key app !

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Sat Jan 15, 2011 9:49 am
by CP-Geek
Anastacius: Alright, we have some improvment! The kext itself works now, mouse & kbd is okay, dmesg also shows keys pressed. Looks like AppleACPIPS2Nub.kext was the guilty one. Tray-app is running, but the prefpane doesn't load, System Preferences-window just shows "Loading SpecialKeys..." and nothing happens.

Any ideas?

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Sat Jan 15, 2011 3:57 pm
by Anastasius
CP-Geek, Sebinouse
I've put the new version to repository.
I hope it fixes all the current bugs, improves stability and removes debug messages.
Please, note that SpecialKeys pref pane currently may not work in 32-bit mode - I mean 32-bit mode of the System Preferences app. It's OK if you have a 32-bit (or 64-bit) kernel - just make sure that there's no (32-bit mode) message in the title of the System Preferences, when loading SpecialKeys (it may happen after running TabletMagic).
When you just open System Preferences for the first time and then immediately run SpecialKeys - all should be OK.
I'm working to fix it in the next version.
Sebinouse wrote:I have tried to boot with your VoodooPS2Controller in SLE (nothing else on PS2 in EE or in SLE).
It panics almost every times ...
I've this error during boot when it works :

Code: Select all

15/01/11 13:13:23	kernel	Kernel Extensions in backtrace (with dependencies):
15/01/11 13:13:23	kernel	org.voodoo.driver.PS2Controller(1.1.0)@0x41c20000->0x41c25fff
15/01/11 13:13:23	kernel	PS2Controller: Created dev /ps2controllerUsing new IRQ layout 0,1
I'm not sure what is that - did you try use VoodooPS2Keyboard with your own VoodooPS2Controller?
Sebinouse wrote: I also have a lot of these (each time I press a key ?) :

Code: Select all

15/01/11 13:25:46	kernel	ApplePS2Keyboard: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [0x589ec00] 88
15/01/11 13:25:46	kernel	ApplePS2Keyboard:!!! SEND MESSAGE TO CLIENTS
15/01/11 13:25:46	kernel	ApplePS2Keyboard:!!! SEND MESSAGE TO CLIENTS OK
15/01/11 13:25:46	kernel	ApplePS2Keyboard: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>> [0x589ec00] 47 -> 9
Sorry for that! Fixed in the new version

Sebinouse wrote: One more thing, when keyboard works trackpoint doesn't and when track point works keybaord doesn't ... (no trackpad on my X60t)
I think we are getting closer ... I just have to be able to load your special key app !
Did it work with previous version of VoodooPS2Controller?

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Mon Jan 17, 2011 9:31 am
by CP-Geek
This is strange.

Installed the 0.2 version, now the prefpane loads fine, also using exactly your kext and nothing PS2-related.

In start prefpane loads fine, doesn't do anything to key-combos. (For example www-back, brightness etc). The app is running fine, don't seem to find anything in logs either, gotta dig deeper some evening.

but hey, it's getting closer! :)

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Mon Jan 17, 2011 12:33 pm
by Anastasius
That's cool. Can you try redefining, for example - Alt key, can you remap it to any letter, let's say "A"?
(I switched off the logs, btw.)

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 18, 2011 9:39 am
by grandflash
Hi Anastasius,

your Keyboard controller kext is working in my x61 tablet too. I can load special keys but cant modify a previous entry. I will try to change the layout xml file itself and see what happens.

Off topic. You wrote that you are using SwitchXRes to rotate your display and that it is working. Can you post your modified tabletmagic deamon / plist whatever file, you mentioned here:

http://forum.thinkpads.com/viewtopic.ph ... 59#p611959

How did you flip it?

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Wed Jan 19, 2011 7:58 pm
by Anastasius
grandflash wrote:Hi Anastasius,

your Keyboard controller kext is working in my x61 tablet too. I can load special keys but cant modify a previous entry. I will try to change the layout xml file itself and see what happens.
Yep. In the current version, to edit the key you have to remove it and create the new one. I didn't make the editing of the keys yet.
grandflash wrote: Off topic. You wrote that you are using SwitchXRes to rotate your display and that it is working. Can you post your modified tabletmagic deamon / plist whatever file, you mentioned here:

http://forum.thinkpads.com/viewtopic.ph ... 59#p611959

How did you flip it?
Here's the modified TabletMagic along with daemon. http://www.mediafire.com/?v6dddh1zmp7140w
I added two checkboxes in the Mapping area - Invert X and Invert Y
Please, keep in mind, that it is not finished - I could not make it to save these settings permanently. They will reset on reboot. I'm working on this with the Scott, the developer of this great thing. He promises to put such kind of options in the releases that will follow, btw.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Thu Jan 20, 2011 3:33 am
by grandflash
Hi Anastasius,

thank you very much, reverting x and y axis with your file worked. By the way, how does 90 and 270° rotation looks at your screen? I have the same x61tablet as you and my screen is garbled at 90 and 270°. Do you changed something else with SwitchResX? Maybe a special Monitor override file in SYSTEM/LIBRARY/DISPLAYS/OVERRIDES/?

I thought about automatic rotation and enabling the x y reverting by script and have a shortcut defined for a certain resolution in SwitchResX?

Telling the Tabletmagic Deamon what he have to do:
Terminal_
launchctl submit -l tabletMagic -- /Library/PreferencePanes/TabletMagic.prefPane/Contents/Resources/TabletMagicDaemon -c -n-20 -L0 -T0 -R24701 -B18473 -l0 -t0 -r1279 -b799 -M1:1 -M2:7 -M3:2 -M4:6 -F -pserial0

With:
Terminal_
ps aguxww | grep -i tab

the running deamon tells you which options are enabled and maybe there is also the x y state as option

But i dont know how to enable x y reverting by terminal????? MAybe you may ask Scott?

Bye, Alex

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Thu Jan 20, 2011 3:39 am
by Sebinouse
I may have found the reason why your app doesn't load on my X60 : my proc !

It is only a CoreDuo and sometimes it is not recognised as a proper intel proc ... I don't know why.

Can you try to compile your app "Universal" ?

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Thu Jan 20, 2011 8:34 am
by Great Gatsby
Yes, could you compile it universal? I must admit I did not try it yet, because chances are very few it'll work on my ThinkPad X60 Tablet when it doesn't on Sebinouse's machine. Our ThinkPads are pretty much the same except for the Atheros stuff and the display. - Thanks! :-)

By the way: Would you accept translations of SpecialKeys' strings to build a preference pane localised for more than one language? I would like to translate the pane into German. :-)

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Mon Jan 24, 2011 9:18 pm
by adidasprince
@Anastasius

GREAT WORK!!! I'll try it these days.
Anastasius wrote: KNOWN BUGS: Some shortcuts cannot be mapped to the keys and some Fn+combinations are not being recognized
(You may find the answer already.)
Every hotkey can be enabled/disabled by command MHKM,
including Fn+F4 (=Sleep) and Fn+F2 I think.
I'll looking into it if you share your codes.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Tue Jan 25, 2011 5:44 am
by adidasprince
tried 0.2 beta, but no luck ......

1. May need a universal SpecialKeysTray.app.
2. Prefpane shows nothing.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Fri Feb 04, 2011 11:26 pm
by Anastasius
adidasprince wrote:tried 0.2 beta, but no luck ......

1. May need a universal SpecialKeysTray.app.
2. Prefpane shows nothing.
Thanks! Actually it's a Universal app - i386 and x86_64 architectures both selected. Maybe the problem lies in something else....
Don't know. I will try to find time and put the sources to public in the next few days.

Re: SpecialKeys - remap keyboard, Fn, tablet buttons on the fly

Posted: Fri Feb 18, 2011 7:23 am
by Great Gatsby
Just to stay informed, did you already publish the sources? :?: