I promised to post this piece that Sylvain OBEGI did on how to switch back
and forth between Linux and Mac keymaps:

--------------------------------- snip -------------------------------

Keymaps/keycodes with Mandrake Linux Cooker/8.2 PPC     [EMAIL PROTECTED]

Historically, Linux on PowerPC hardware uses ��mac keycodes��, a ��keycode�� 
is the code returned to the Operating System by the keyboard when a key is 
pressed. Mac keycodes and x86 (PS/2) keycodes are different, so they need 
different keymaps. A keymap is a file storing the information which character 
matches which keycode. 

Pro : the keymap is really adapted to the mac keyboard. 
Con : there are only few mac keymaps available (currently : us, fr and de)

Mandrake Linux 8.0 PPC uses the mac keycodes.

But there is another way to do things : the ��linux keycodes�� way. This 
options makes a mac keyboard acts as a pc keyboard, and so gives access to 
all the traditionnal pc keymaps. But, (of course there is a ��but��) this 
can shake the keyboard a little. Let me explain : some Mac keyboards (I'm 
especially talking of foreign language keyboards) are not the same as their 
PC equivalent, the place of some keys are differents, some other keys are 
missing (��\�� for example on mac fr keyboard, which is a bit annoying when 
dealing with Wind*ws stuff). With Mac keycodes (and specific keymaps), the 
character you see on a key is the one you get when pressing this key.. with 
Linux keycodes you get the one the PC keyboard has on it, which is better 
when you want some key missing on the standard Mac keyboard, and if you know 
where it is..

As of today (02/13/2002) Cooker-PPC uses Linux keycodes.

Both ways have pros and cons, you can test by yourself and choose the one you 
prefer by following theses instructions :

in /etc/sysctl.conf
dev.mac_hid.keyboard_sends_linux_keycodes=
1 (default) : Linux keycodes
0 : mac keycodes

in /etc/sysconfig/keyboard
KEYTABLE=
default : a pc keymap matching your language setting
to change to mac keycodes, choose a keymap in /usr/lib/kbd/keymaps/mac
(in /usr/lib/kbd/keymaps/i386/xxxx for Linux keycodes)

in /etc/X11/XF86Config-4
Option ��XkbModel��
pc105 (default) : Linux keycodes
macintosh : mac keycodes

Option ��XkbLayout��
xx (default) : keymap for Linux keycodes
macintosh/xx : keymap for mac keycodes (is it exists, see 
/etc/X11/xkb/symbols/macintosh/)

And then reboot. Key style should have been changed. Happy tweaking.

Join us live on irc.openprojects.net #cooker-ppc !

---------------------------- snip -----------------------------

You can probably avoid the reboot, by creating a small script. Run this
with X shut down (runlevel 3), as root (call it swapkeys.sh or whatever
you like), after you've edited the files mentioned above.

#!/bin/sh
if [ -z "$1" ];then
    echo "usage: $0 mac or $0 linux...."
    exit 1
else
    if [ $1 = "mac" ]; then
        NEWCODE=0
    fi
    if [ "$1" = "linux" ]; then
        NEWCODE=1
    fi
    if [ -n "$NEWCODE" ]; then
        echo $NEWCODE > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
        service keytable restart
    else
        echo "usage: $0 mac or $0 linux...."
        exit 1
    fi
fi

--------------------------- snip ---------------------------

Thanks again Sylvain!
Stew Benedict

-- 
MandrakeSoft    OH/TN, USA http://people.mandrakesoft.com/~sbenedict/
PPC FAQ: http://www.linux-mandrake.com/en/demos/PPC/FAQ/



Reply via email to