[gutsy] Finnish/Swedish MacBook § and < keys are swapped (keycodes 49 and 94 swapped)

Bug #139833 reported by Mikko Ohtamaa
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
xkeyboard-config
Invalid
Medium
xkeyboard-config (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Gutsy Gibbon tribe 5 / Alternate install CD / Macbook 13" with Finnish/Swedish keyboard layout.

Keyboard model: Macbook/Macbook pro.

Keyboard layout: Finnish (MacBook). Other layouts affected as well.

Keys < > and § ° are swapped. Pressing § procudes < and vice versa.

Revision history for this message
In , Bertrand Rousseau (bertrand-rousseau) wrote :

Created an attachment (id=6008)
modified files for swapping the keys in macbook french keyboards

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

Are you talking about xkeyboard-config or xkbdata? IIRC it was fixed at some
point. Could you please have a look at xkeyboard-config CVS - and, if possible,
attach a patch against it.

Revision history for this message
Mikko Ohtamaa (mikko-red-innovation) wrote : [gutsy] Finnish/Swedish MacBook § and < keys are swapped

Gutsy Gibbon tribe 5 / Alternate install CD / Macbook 13" with Finnish/Swedish keyboard layout.

Keyboard model: Macbook/Macbook pro.

Keyboard layout: Finnish (MacBook). Other layouts affected as well.

Keys < > and § ° are swapped. Pressing § procudes < and vice versa.

Revision history for this message
Mikko Ohtamaa (mikko-red-innovation) wrote :

This is the xev output when pressing top left key (labeled as §)

KeyPress event, serial 31, synthetic NO, window 0x4400001,
    root 0x69, subw 0x0, time 238273110, (517,372), root:(529,477),
    state 0x4000, keycode 49 (keysym 0x3c, less), same_screen YES,
    XLookupString gives 1 bytes: (3c) "<"
    XmbLookupString gives 1 bytes: (3c) "<"
    XFilterEvent returns: False

Then, if you look at file /usr/share/X11/xkb/macintosh you find something mysterious:

default xkb_keycodes "macintosh" {
   include "xfree86"

   <FK13> = 182;
   <FK14> = 183;
   <FK15> = 184;
   <KPEQ> = 157;

};

xkb_keycodes "badmap" {
    <TLDE> = 94;
    <LSGT> = 49;
};

xkb_keycodes "goodmap" {
    <TLDE> = 49;
    <LSGT> = 94;
};

Looks like "goodmap" has Tilde mapped right. However, if you look at /usr/share/X11/xkb/rules

$macbooks = macintosh+macintosh(badmap)

You find that Macbooks are mapped with "badmap".

Then I found this blog post:

http://simon.vanderlinden.eu.org/2007/02/26/macbook-keyboard-now-works-perfectly-with-xorg/

Looks like the problem would be one line change, but it is not patched to the distribution yet.

Revision history for this message
Mikko Ohtamaa (mikko-red-innovation) wrote :

Found more info:

This depends on kernel option

https://bugs.freedesktop.org/show_bug.cgi?id=8242

This updated patch adds apple:badmap into rules/base.xml.in.
Macbooks use this option, so when the kernel gets fixed, keys
will be swapped again, which is why apple:goodmap is provided
so that users can fix their XKB configuration without upgrading
xkeyboard-config. I do not know though if apple:goodmap should
also be put in rules/base.xml.in

So looks like Ubuntu ships with conflicting kernel + xkeyboard-config settings!

Revision history for this message
Mikko Ohtamaa (mikko-red-innovation) wrote :

Quote:

But international Macintosh keyboards are special, 2 keys are swapped.
Kernel handles this situation, it swaps the keycodes returned by these
two keys when he detects such a keyboard. Of course, this autodetection
sometimes fails, this is why people complained about these 2 swapped
keys.
Currently macbook7{8,9} models have keycodes
  macintosh+macintosh(badmap)
because it is known that Linux kernel misdetect it. It will hopefully
be fixed in the future, and macintosh(badmap) will have to be dropped,
otherwise keys are swapped again.
This can be done by upgrading xkeyboard-config (but this is difficult
because keycodes configuration depend on kernel version), or with
this apple:goodmap option which cancels macintosh(badmap).
So for now this option is useless, but it will become useful in the
future if kernel gets fixed.

Revision history for this message
Mikko Ohtamaa (mikko-red-innovation) wrote :

From http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.18.3

commit 26192851aed037f2c928d9cc5d42f507876625b5
Author: Olaf Hering <email address hidden>
Date: Wed Nov 8 19:58:07 2006 -0800

    [PATCH] correct keymapping on Powerbook built-in USB ISO keyboards

    similar to the version in adbhid_input_register(): The '<>' key and the
    '^°' key on a german keyboard is swapped. Provide correct keys to
    userland, external USB keyboards will not work correctly when the
    'badmap'/'goodmap' workarounds from xkeyboard-config are used.

    It is expected that distributions drop the badmap/goodmap part from
    keycodes/macintosh in the xkeyboard-config package.

    This is probably 2.6.18.x material, if major distros settle on 2.6.18.

    Signed-off-by: Olaf Hering <email address hidden>
    Cc: Greg KH <email address hidden>
    Cc: Dmitry Torokhov <email address hidden>
    Cc: Benjamin Herrenschmidt <email address hidden>
    Cc: <email address hidden>
    Signed-off-by: Andrew Morton <email address hidden>
    Signed-off-by: Chris Wright <email address hidden>

Changed in xkeyboard-config:
status: Unknown → Incomplete
Revision history for this message
In , Benjamin-close (benjamin-close) wrote :

Bugzilla Upgrade Mass Bug Change

NEEDSINFO state was removed in Bugzilla 3.x, reopening any bugs previously listed as NEEDSINFO.

  - benjsc
    fd.o Wrangler

Changed in xkeyboard-config:
status: Incomplete → Confirmed
Revision history for this message
Michael Nagel (nailor) wrote : Re: [gutsy] Finnish/Swedish MacBook § and < keys are swapped

is this still an issue?

Revision history for this message
Manuel Lucena (mlucena) wrote :

This is still happening in Intrepid Ibex Alpha 6

(Macbook Santa Rosa 4,1, spanish keyboard)

Revision history for this message
Sebastian Thürrschmidt (thuerrschmidt) wrote :

This bug also affects Intrepid Beta (2 October), fresh install on a Macbook 4,1, German keyboard. The key below ESC does what the key beside the left-hand SHIFT key is supposed to do and vice versa.

Daniel T Chen (crimsun)
Changed in xkeyboard-config:
status: New → Confirmed
Revision history for this message
Manuel Lucena (mlucena) wrote :

Same problem in Intrepid RC

Revision history for this message
In , Sergey V. Udaltsov (svu) wrote :

No answer fo 2.5 years

Changed in xkeyboard-config:
status: Confirmed → Invalid
Revision history for this message
Bryce Harrington (bryce) wrote :

Near as I can understand it, this issue has been fixed now. At least, the badmap/goodmap stuff seems to be gone, and TLDE is mapped to 58 instead of 94/49.

So, if there is still some issues after you test Jaunty, it's a different thing so please file a new bug ("ubuntu-bug xkeyboard-config").

Changed in xkeyboard-config:
status: Confirmed → Fix Released
Revision history for this message
Sebastian Thürrschmidt (thuerrschmidt) wrote :

On my MacBook 4,1 the keys in question are still swapped in Jaunty, Alpha 5 (live CD session with Germany layout). What's worse, the "Swap keycodes of two keys when Mac keyboards are misdetected" option is no longer present in the "Miscellaneous compatibilty options" section. I really hope this will be fixed in Jaunty final.

Revision history for this message
Daniel Graziotin (dgraziotin) wrote :

I can confirm that the bug is still present on Jaunty Beta. Macbook 3,1 Italian Layout. < and \ keys are swapped and there is no more the "Swap keycodes of two keys when Mac keyboards are misdetected" option in the "Miscellaneous compatibilty options" section.

Revision history for this message
Sebastian Thürrschmidt (thuerrschmidt) wrote :

As a temporary workaround I can recommend using xmodmap (install it if necessary) to swap the two keys into their right places. Proced as follows:

1. Open a terminal and ensure you're in your home directory.

2. Enter these commands:

   xmodmap -pke | grep 'keycode *49' >>.Xmodmap
   xmodmap -pke | grep 'keycode *94' >>.Xmodmap

3. Open ~/.Xmodmap in an editor, replace the number 49 with 94 and vice versa.

4. Run xmodmap. At the start of your next user session a dialog box may appear asking you to confirm loading .Xmodmap from now on. Do so.

This will correct the keyboard layout in all applications. It will not work in places like virtual machines. To swap the keys in my VirtualBox Windows XP environment too, I used Microsoft Keyboard Layout Creator (Google it), a .NET-based GUI for creating keyboard layouts. That was a bit more difficult than accomplishing the same thing in Ubuntu.

Revision history for this message
Sebastian Thürrschmidt (thuerrschmidt) wrote :

The issue remains unresolved in Karmic Alpha 5, and the compatibility option hasn't come back. The workaround suggested above is still valid.

Revision history for this message
Sebastian Thürrschmidt (thuerrschmidt) wrote :

International keyboard on MacBook 4,1 still not properly supported in Lucid Alpha 3. Keys in question are swapped as before.

Changed in xkeyboard-config:
importance: Unknown → Medium
Changed in xkeyboard-config:
importance: Medium → Unknown
Changed in xkeyboard-config:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.