Hi folks,
I'm adding the following FAQ entry to the Debian X FAQ.
I would very much appreciate correction of any factual errors I have
made.
Also, because my FAQ is freely licensed[1], please feel free to borrow
as much of this as you may need for any other FAQ.
*) I'm using a Macintosh, and while the keyboard works correctly on a virtual
terminal, in X it's all messed up. What's the matter?
In most cases of which I am aware, this happens because the X server has
been configured with the XkbModel "macintosh", when it should be using
"macintosh_old".
The cause of the problem is the difference between "ADB keycodes" (ADB
means "Apple Desktop Bus") and "Linux keycodes". Traditionally, on
Macintosh computers running Linux, the kernel transmitted ADB keycodes that
listened to the keyboard in "raw" mode. ("Raw" mode is the mode the X
server uses to listen for events from the keyboard.) This is because the
keyboard was connected to the computer using the Apple Desktop Bus, and not
USB, which has been the bus of choice for Apple machines starting with the
"NewWorld" architecture: the iMac in August 1998 and the "Blue and White"
G3 in January 1999. However, since Debian GNU/Linux 3.0 ("woody") was
released, the stock configuration for the PowerPC port has been to use
Linux keycodes.
If you're using an m68k-based Macintosh, (that is, the output of the "uname
-m" command is not "ppc"), you should reconfigure the X server to use
"macintosh_old" for your XKB model. One way to do this with the command:
# dpkg-reconfigure xserver-xfree86
as the root user.
To date, no kernels with the feature of sending Linux keycodes exist for
m68k-based Macintoshes.
If you're using a PowerPC-based Macintosh, your system could configured to
send either ADB or Linux keycodes when they keyboard is in "raw" mode.
Furthermore, the kernel could be "locked" into one or the other, or permit
run-time switching. To see if your kernel can switch between ADB and Linux
keycodes, run the following command:
$ cat /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
If you get back "cat: /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes:
No such file or directory", then your kernel cannot switch, and will only
send one or the other.
If you get back "0", then your kernel can switch back and forth, and it is
currently sending ADB keycodes.
If you get back "1", then your kernel can switch back and forth, and it is
currently sending Linux keycodes.
On kernels that support switching, you can tell it to move back and forth
by simply echoing zero or one to this file, though you must be root to do
this.
For example:
To switch off Linux keycodes and use ADB keycodes:
# echo 0 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
To switch off ADB keycodes and use Linux keycodes:
# echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
If your kernel is not capable of switching back and forth, you can use the
kernel's configuration file to determine which set of keycodes are in use
by default. All official Debian kernels and kernels produced by the
"make-kpkg" command make this configuration file available by placing it
the "kernel-image" package which gets installed.
The following command will tell you how your kernel is configured:
$ grep CONFIG_MAC_ADBKEYCODES /boot/config-$(uname -r)
You will likely see one of the following in response:
CONFIG_MAC_ADBKEYCODES=y
The above means that your kernel is sending ADB keycodes in "raw" mode, and
you should use an XKB Model of "macintosh_old".
# CONFIG_MAC_ADBKEYCODES is not set
The above means that your kernel is sending Linux keycodes in "raw" mode,
and you should use an XKB Model of "macintosh".
[1] GNU GPL, version 2
--
G. Branden Robinson | Build a fire for a man, and he'll
Debian GNU/Linux | be warm for a day. Set a man on
branden@debian.org | fire, and he'll be warm for the
http://people.debian.org/~branden/ | rest of his life. - Terry Pratchett
Attachment:
pgpsUhM7qSp47.pgp
Description: PGP signature