Author Topic: [05/11/09] I want some testing on updated VoodooPS2Keyboard  (Read 40711 times)

0 Members and 1 Guest are viewing this topic.

trip2me

  • Observer
  • Posts: 21
Hello.
I'm updating VoodooPS2Keyboard source code.
But I have a laptop only. I can't test keys that I don't have.
If you have a time, test it and report some problem or requirements please.
After testing is done, I will submit result to VoodooPS2Controller svn repository.

I'm a ANSI and Korean keyboard user.
So I'm curious that other Language layout keyboard such as Europe and Japanese works well with this.
Because some Language keyboard have special keys and special input method, it have to be considerd making kernel extension. such as Japanese Kana, Eisu and ISO keyboard's  §±
And other special keys such as sleep, power, volume up, play/pause, ...

main update issues are
  • Update PS2ToADBMap table in ApplePS2ADBMap.h to change easily.
    So we just simply change PS2ToADBMap without concerning conflict between normal and extended scancode.
  • Enable media keys( play, next track, ...), F16~F20 by updating appleUSAKeyMap in VoodooPS2Keyboard.cpp
  • Add some custom options in Info.plist
    • Select between ANSI and ISO layout
    • Support Korean Keyboard(Hangul, Hanja) and Japanese JIS(Henkan, Muhenkan, ... not implemented completely yet. report please.)
    • Change Application(Windows Context menu) key into right windows key.(useful for laptop users)
    • Change Application key into Apple Fn key (not implemented completely yet.)
      just Fn key recognizes, other key combo need to be developed
    • Enable to assign custom keyboard type (for changing keyboard layout)
      you can check changed keyboard layout using 'Show Keyboard Viewer'

You can get more info about keyboard ID. look at below thread
http://forum.voodooprojects.org/index.php/topic,115.msg1071.html#msg1071
Keyboard type affect your input method and input layout. It's very important.
 
I want to tell you about all detail changes. But I'm not a good English speaker. Sorry about that.

I think we have to get more information about ApplePS2ADBMap, appleUSAKeyMap table. Still I don't know well.
But I added some comments to the source code. I wish it would help you.
To support apple Fn key perfectly, maybe appleUSAKeyMap have to be discovered more.

If you check your keyboard's PS/2 scancode, build VoodooPS2Keyboard with Development configuration.
It generates scancode log that you press to /var/log/system.log
It maybe use for report bug or requirements.


P.S. default custom setting value of VoodooPS2Keyboard.kext/Contents/Info.plist
Code: [Select]
<key>Make Application key into Apple Fn key</key>
<true/>
<key>Make Application key into right windows</key>
<false/>
<key>Make right modifier keys into Hangul and Hanja</key>
<false/>
<key>Swap capslock and left control</key>
<false/>
<key>Swap command and option</key>
<true/>
<key>Use ISO layout keyboard</key>
<false/>
<key>alt_handler_id</key>
<integer>3</integer>

alt_handler_id means keyboard type.

It determine F12 eject function enable or not.
To enabling F12 eject key, refer above link which was already mentioned.
I think it's enough for users to use some values. There are...
Code: [Select]
// below layouts are SUPPORT F12 Eject function
Unknown 3rd party keyboard.                   =   3 // it's possible to change keyboard layout in System Preferences.

original USB Domestic (ANSI) Keyboard         = 198
original USB International (ISO) Keyboard     = 199
original USB Japanese (JIS) Keyboard          = 200

// below layouts are NOT SUPPORT F12 Eject function

USB Pro Keyboard Domestic (ANSI) Keyboard     = 204
USB Pro Keyboard International (ISO) Keyboard = 205
USB Pro Keyboard Japanese (JIS) Keyboard      = 206

If you are a Japanese keyboard user, it's very important too.
Look at below attached picture. There are some keys which only works on JIS layout only, and which keys are remapped into mac keyboard.

So it's a good choice 200 or 206 for 'alt_handler_id' if you want to use kotoeri Japanese input method.
In addtion, if you are a qwerty laptop keyboard user, enabling 'Make right modifier keys into Hangul and Hanja' into true makes right alt key into Japanese Kana key and right control key into Japanese Eisu key.

If you are a Europe ISO layout keyboard user, change 'Use ISO layout keyboard' to '<true/>'.
It replace Europe 1'`~' key which is to the left of '1' into between Left shift and 'z' keys.
And Europe 2 key is inserted into the place which was Europe 1 key's place.
and you may change 'alt_handler_id' to what you want.
 


[updated 05/09/09]
fixed Korean Hangul, Hanja keys repeat problem.
If you don't use Korean 103 or 106 keyboard, you can ignore this update.

371 line in VoodooPS2Keyboard.cpp
Code: [Select]
if (scanCode == 0xf2 || scanCode == 0xf1) {
         clock_get_uptime(&now);
         dispatchKeyboardEvent( PS2ToADBMap[scanCode], true, *((AbsoluteTime*)&now) );
}
patched into
Code: [Select]
if (scanCode == 0xf2 || scanCode == 0xf1) {
         clock_get_uptime(&now);
         dispatchKeyboardEvent( PS2ToADBMap[scanCode], true, *((AbsoluteTime*)&now) );
         clock_get_uptime(&now);
         dispatchKeyboardEvent( PS2ToADBMap[scanCode], false, *((AbsoluteTime*)&now) );
         return true;
}


[updated 05/11/09]
fixed video mirroring toggle problem when F1 key is pressed.
It's my mistake. really sorry.

891 line in VoodooPS2Keyboard.cpp
Code: [Select]
        NX_KEYTYPE_VIDMIRROR,   0x7a,patched to
Code: [Select]
        NX_KEYTYPE_VIDMIRROR,   0x70,
« Last Edit: May 28, 2009, 03:17:01 AM by trip2me »
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

lebidou

  • Resident
  • Posts: 133
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #1 on: May 05, 2009, 11:42:03 AM »
Hello,
I'm testing it on a French ISO keyboard and seems to work great here. Backlight/Sound Control keys are working (I won't test sleep because the Ati graphics won't wake up). F12 ejects the optical drive. The Make the Application key ino Right Window key option is very useful on laptops.

I'm testing this with regular ApplePS2Controller because I still have sutck keys with the voodoo one (a mysterious instance of AppleACPIPS2Nub.kext seems to load from nowhere, even if I clear all the boot caches, but this is another story).

anyway, thank you for adding some useful things to it!

trip2me

  • Observer
  • Posts: 21
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #2 on: May 05, 2009, 01:38:40 PM »
Hello,
I'm testing it on a French ISO keyboard and seems to work great here. Backlight/Sound Control keys are working (I won't test sleep because the Ati graphics won't wake up). F12 ejects the optical drive. The Make the Application key ino Right Window key option is very useful on laptops.

I'm testing this with regular ApplePS2Controller because I still have sutck keys with the voodoo one (a mysterious instance of AppleACPIPS2Nub.kext seems to load from nowhere, even if I clear all the boot caches, but this is another story).

anyway, thank you for adding some useful things to it!


Thanks for reporting.

Maybe backlight works without kext, in my laptop it works as hardware level. Actually apple has special keytypes
Code: [Select]
#define NX_KEYTYPE_ILLUMINATION_UP 21
#define NX_KEYTYPE_ILLUMINATION_DOWN 22
#define NX_KEYTYPE_ILLUMINATION_TOGGLE 23
#define NX_KEYTYPE_BRIGHTNESS_UP 2
#define NX_KEYTYPE_BRIGHTNESS_DOWN 3
#define NX_KEYTYPE_CONTRAST_UP 11
#define NX_KEYTYPE_CONTRAST_DOWN 12

in my test, these are not worked with my laptop. : )
To work with these key event, need to make a new kernel extension, DSDT patch or other mod. I don't know well.

Update was adapted on VoodooPS2Keboard only. so you can refer to ApplePS2ToADBMap.h, VoodooPS2Keyboard.h, VoodooPS2Keyboard.cpp for patching ApplePS2Keyboard.
just copy and paste. it will work. : )
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

lebidou

  • Resident
  • Posts: 133
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #3 on: May 05, 2009, 02:16:47 PM »
About the ApplePS2Controller.kext, I'm actually using your pre-complied kext, I just edited the plist to replace the org.voodoo.driver.PS2Controller dependency by com.apple.driver.ApplePS2Controller and it works like charm. I did the same with with PS2Trackpad to bring me double finger scroll. There is actually no need to recompile the whole kext to make it work, voodoo ps2 drivers can be used with original applePS2controller (and reverse) with only plist editing.

For the backlight thing, I agree with you, it's probably a hardware thing but the first time I tried voodooPS2controller, it worked well except it broked backlight control as well as F12 key for some reason. And yes, on real Macs there is AppleBacklight.kext to handle backlight control via keyboard. On some laptops, adding PNLF device in dsdt is enough to make it works the "Mac way", but for others (like mine) it's completly useless.

dadaz

  • Entrant
  • Posts: 9
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #4 on: May 05, 2009, 04:50:34 PM »
Hi

I will test it tonight on my EeePC 1000H.

Can you tell me which key should I use for volume, brightness... and is it possible to change them ?

Thanks.


trip2me

  • Observer
  • Posts: 21
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #5 on: May 05, 2009, 05:57:23 PM »
Can you tell me which key should I use for volume, brightness... and is it possible to change them ?

Hi. Thanks for testing in advance.

Volume keys and media keys have own standard scan code.
Also support special events on OS X. that means there are some way to assign keys.

in PS2ToADBMap at ApplePS2ToADBMap.h says:
Code: [Select]
    ADB,       PS/2,  key legend
    0x49,   // e0 2e  Volume Down
    0x48,   // e0 30  Volume Up
    0x34,   // e0 22  Play/Pause
    0x42,   // e0 19  Scan Next Track
    0x4d,   // e0 10  Scan Previous Track
DEADKEY,// e0 24  Stop
tells '0xe0 0x2e' PS/2 scancode is translated '0x49' ADB key code.
You can find Volume down key's standard scancode of PS/2 keyboard with MS HID to PS/2 table's 'PS/2 Set 1 Make' column
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf

It concludes non-scancode making keys are not remapped with VoodooPS2Keyboard without any special modify.
But it also means that if you have a key which make scancode, remap it with any ADB key!

In attached files, I'm trying to remap the keys reasonably for public use.
So you can remap some specific key to already mapped keys.
For example, I'm a thinkpad X60 tablet user, I assigned Sysreq into Volume down, Break into Volume Up, WWW Back into Page down, WWW Forward into Page up and Media Stop into video mirror toggle.


What is for '0x49' ADB key code?

in appleUSAKeyMap at VoodooPS2Keyboard.cpp says:
Code: [Select]
        ...
        // special key definition
        0x0b, // number of special keys
        // ( NX_KEYTYPE,        Virtual ADB code )
        ...
        NX_KEYTYPE_MUTE,        0x4a,
        NX_KEYTYPE_SOUND_UP,    0x48,
        NX_KEYTYPE_SOUND_DOWN,  0x49,
        ...
        NX_KEYTYPE_PLAY,        0x34,
        NX_KEYTYPE_NEXT,        0x42,       // if this event repeated, act as NX_KEYTYPE_FAST
        NX_KEYTYPE_PREVIOUS,    0x4d        // if this event repeated, act as NX_KEYTYPE_REWIND
You can find more info about appleUSAKeyMap on below site.
http://www.xfree.org/current/dumpkeymap.1.html

Special keys are generally defined making no unicode charater. special keys worked with kernel's other parts or kexts. For example, brightness special key need a display kernel extension which support bright-control.

there are NX_KEYTYPE keys. borrowed from ev_keymap.h:
Code: [Select]
#define NX_KEYTYPE_SOUND_UP 0
#define NX_KEYTYPE_SOUND_DOWN 1
#define NX_KEYTYPE_BRIGHTNESS_UP 2
#define NX_KEYTYPE_BRIGHTNESS_DOWN 3
#define NX_KEYTYPE_CAPS_LOCK 4
#define NX_KEYTYPE_HELP 5
#define NX_POWER_KEY 6
#define NX_KEYTYPE_MUTE 7
#define NX_UP_ARROW_KEY 8
#define NX_DOWN_ARROW_KEY 9
#define NX_KEYTYPE_NUM_LOCK 10

#define NX_KEYTYPE_CONTRAST_UP 11
#define NX_KEYTYPE_CONTRAST_DOWN 12
#define NX_KEYTYPE_LAUNCH_PANEL 13
#define NX_KEYTYPE_EJECT 14
#define NX_KEYTYPE_VIDMIRROR 15

#define NX_KEYTYPE_PLAY 16
#define NX_KEYTYPE_NEXT 17
#define NX_KEYTYPE_PREVIOUS 18
#define NX_KEYTYPE_FAST 19
#define NX_KEYTYPE_REWIND 20

#define NX_KEYTYPE_ILLUMINATION_UP 21
#define NX_KEYTYPE_ILLUMINATION_DOWN 22
#define NX_KEYTYPE_ILLUMINATION_TOGGLE 23
I confirmed that SOUND_UP, SOUND_DOWN, MUTE, CAPS_LOCK, NUM_LOCK, HELP, POWER, EJECT, VIDMIRROR, PLAY,  NEXT, PREVIOUS, FAST, REWIND worked well.

If you understand relation between appleUSAKeyMap & PS2ToADBMap, you can remap most keys what you want.
Maybe it's possible to include above table definition into Info.plist. but i think it's not a good idea.
« Last Edit: May 05, 2009, 06:45:45 PM by trip2me »
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

dadaz

  • Entrant
  • Posts: 9
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #6 on: May 05, 2009, 10:34:39 PM »
Ok thanks for your great explanation.

But, it doesn't work really good for me. Keyboard work but not mouse (I've removed trackpad stuff as it doesn't work for me).

But when I try to boot in single mode, no way to type anything, I have "PS2CODE....." instead of what it must be.

And for the Volume... key, I don't have a keyboard which match (volume key are combination of Fn+F10/F11/F12) and brightness doesn't work.


trip2me

  • Observer
  • Posts: 21
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #7 on: May 06, 2009, 03:55:23 AM »
Ok thanks for your great explanation.

But, it doesn't work really good for me. Keyboard work but not mouse (I've removed trackpad stuff as it doesn't work for me).

But when I try to boot in single mode, no way to type anything, I have "PS2CODE....." instead of what it must be.

And for the Volume... key, I don't have a keyboard which match (volume key are combination of Fn+F10/F11/F12) and brightness doesn't work.

Sorry for your result.

But this update is limited in VoodooPS2Keyboard.kext only. No any modification was applied other kexts.
Your mouse problem aren't fixed with this. Or maybe you have a install mistaken. It needs more specific information about your failure to determine answer.

It's weird that you can't type anything in single mode. I think that it has some conflict your other kexts.

Trying to lebidou's method.
http://forum.voodooprojects.org/index.php/topic,304.msg1085.html#msg1085
I already said, this update is applied to ApplePS2Keyboard.kext identically.

in case of your volume and brightness key, you have to find scancodes yourself.
You may compile attached sourcecode to DEBUG mode, or you have to boot windows or linux and use xev like tool to find scancode.
Or it just works without kext support if it works with hardware method.
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

dadaz

  • Entrant
  • Posts: 9
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #8 on: May 06, 2009, 12:10:35 PM »
I use official VoodooPS2 (without trackpad Kext) and I have NO problem with mouse.


trip2me

  • Observer
  • Posts: 21
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #9 on: May 06, 2009, 01:34:32 PM »
I use official VoodooPS2 (without trackpad Kext) and I have NO problem with mouse.


Unfortunately, I am assured that there isn't a relationship between a mouse problem and updated VoodooPS2Keyboard.kext at all.

If you don't believe this, use the diff tool.
And just change VoodooPS2Keyboard of official VoodooPS2Controller.kext with updated one.
That answers all about your mis-understanding.
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

cnnn

  • Entrant
  • Posts: 4
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #10 on: May 09, 2009, 04:51:19 PM »
This works so great on my ideapad.
But I still have some media keys unused such as 5 EQ keys and 2 custom ones. I want to activate them. How can I find the code of them?

trip2me

  • Observer
  • Posts: 21
Re: I want some testing on updated VoodooPS2Keyboard
« Reply #11 on: May 09, 2009, 06:16:10 PM »
This works so great on my ideapad.
But I still have some media keys unused such as 5 EQ keys and 2 custom ones. I want to activate them. How can I find the code of them?

I am sorry. I don't know about that.
If these keys make a scan code, you can simply remap it.
You can check scan code by watching console log with debug VoodooPS2Keyboard.kext version,
or showkey tool on linux, etc...

Or not, you have to make some special kext for it.

« Last Edit: May 09, 2009, 06:45:56 PM by trip2me »
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

f00barzes

  • Entrant
  • Posts: 5
Re: [05/11/09] I want some testing on updated VoodooPS2Keyboard
« Reply #12 on: May 16, 2009, 12:37:47 PM »
Hello trip2me,

great to see someone working on making the full glory of PS2-Keyboards working!
If I might suggest some feature:
 
  • Enable the remap of e.g. the right Control-Key to an Apple Command-Key (the one with the funny rounded symbol)
  • Rationale: Quite some keyboards are still provided without a Windows-Key (e.g. the IBM UltraNav USB) and OS X is not really that usable without an Command-Key
  • Under Windows and Linux this is a standardfix, for Windows there's even a tool provided by IBM/Lenovo.
  • If I find some time, I'll might even try to add it myself, although I think that it might just be a (plist-based) remap of one one scancode.

Update: Partly fail: While there are quite some Thinkpads that do not have Windows keys (everything before the 60 series, although they're all pre-Core processors), they keyboard mentioned was USB.
I've tried to rearrange the keys using DoubleCommand which worked more or less at some point. Although the comfort is rather low since DoubleCommand sets it for all keyboards and without profiles, so if one's switching input devices to the integrated keyboard which has windows-keys one gets a strange layout.
If one has some suggestions on how to handle this problem, maybe it could be discussed in another topic. (

Again, your efforts are highly welcome! Wish you lots of success and luck :D
Greets
f00barzes
« Last Edit: May 16, 2009, 01:57:11 PM by f00barzes »

trip2me

  • Observer
  • Posts: 21
Re: [05/11/09] I want some testing on updated VoodooPS2Keyboard
« Reply #13 on: May 16, 2009, 05:18:46 PM »
If I might suggest some feature:
 
  • Enable the remap of e.g. the right Control-Key to an Apple Command-Key (the one with the funny rounded symbol)
  • Rationale: Quite some keyboards are still provided without a Windows-Key (e.g. the IBM UltraNav USB) and OS X is not really that usable without an Command-Key
  • Under Windows and Linux this is a standardfix, for Windows there's even a tool provided by IBM/Lenovo.
  • If I find some time, I'll might even try to add it myself, although I think that it might just be a (plist-based) remap of one one scancode.

Update: Partly fail: While there are quite some Thinkpads that do not have Windows keys (everything before the 60 series, although they're all pre-Core processors), they keyboard mentioned was USB.
I've tried to rearrange the keys using DoubleCommand which worked more or less at some point. Although the comfort is rather low since DoubleCommand sets it for all keyboards and without profiles, so if one's switching input devices to the integrated keyboard which has windows-keys one gets a strange layout.
If one has some suggestions on how to handle this problem, maybe it could be discussed in another topic.
(

Again, your efforts are highly welcome! Wish you lots of success and luck :D
Greets
f00barzes

Hello f00barzes,

I'd be happy for your suggestion. :)
I will consider your R_Ctrl->R_Cmd remapping  and other suggestions next update.

P.S.
I can't follow the sentences which are bold.
Do you have at least two ports of PS/2 keyboard on one computer?
and This project  don't support USB interface keyboards.

Sincerely,
trip2me
Let's be a realist, however, keep impossible dream in our mind. -Che Guevara
All good that I do or have done is from Allah, and only the mistakes have been mine.  -Malcolm X

f00barzes

  • Entrant
  • Posts: 5
Re: [05/11/09] I want some testing on updated VoodooPS2Keyboard
« Reply #14 on: May 17, 2009, 10:43:00 PM »
Hello f00barzes,

I'd be happy for your suggestion. :)
I will consider your R_Ctrl->R_Cmd remapping  and other suggestions next update.

P.S.
I can't follow the sentences which are bold.
Do you have at least two ports of PS/2 keyboard on one computer?
and This project  don't support USB interface keyboards.

Sincerely,
trip2me

Glad to hear that you think it's worthwhile! :D
The reason why I wrote "fail" was that I thought about an USB-Keyboard (http://www.amazon.com/IBM-USB-Keyboard-UltraNav-31P8950/dp/B00009APTK) while writing and only later I remembered that this was a project for PS/2 keyboards.
And the issue with multiple keyboards with different key-sets (with Windowskey/without Windowskey) was my PS/2 internal+USB external keyboard.

DoubleCommand (http://doublecommand.sourceforge.net/) is a tool to remap some of your keys even on USB-Keyboards, nevertheless made for Mac-Keyboards, providing one set of setting for all connected keyboards, no loadable/storable profiles and therefore a little bit uncomfortable for the task of making a windows-key-less keyboard working nice with OSX.
There is a second tool (http://www.pqrs.org/tekezo/macosx/keyremap4macbook/list.html) which might be usefull for that job.

Anyhow, that obviously is a second, different discussion that should not spoil and offtopicize your development thread.