[FIXED] Invalid keyboard layout related to locale

You think you have found a bug? Let us know about it.
releasedinjapan
Posts: 9
Joined: 23. Sep 2009, 19:55

[FIXED] Invalid keyboard layout related to locale

Post by releasedinjapan »

Hi,

When installing Salix I chose to use the fr_CH locale. I didn't notice any problem until I rebooted, started an X session and tried to type some text: the keyboard layout wasn't a swiss french one but the default one (en_US).

Indeed, if I launch XFCE keyboard configuration tool, I see that the layout it set at "fr_CH" with no variant. This layout doesn't exist, so X falls back to the default layout. I had to change the setting for the layout to be "ch" and the variant "fr", which is the correct setting.
Does Salix autoconfigure X keyboard layout from the console one?
Last edited by releasedinjapan on 14. Oct 2009, 22:20, edited 1 time in total.
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Invalid keyboard layout related to locale

Post by JRD »

Godd that there is a swiss guy out there. I'm french and I wanted to changed the default variant (empty for now) for french. Gapan tell me about fr_CH and I was a bit suprised because I thought the layout for romanian swiss should be ch with variant fr. You apprently confirm this.
I don't know how the installation is guessing the Xorg (in fact HAL now) keybaord from the locale, but apprently is wrong in you situation.

In order to change this, you could edit /etc/hal/policy/10keyboard and search for the option.kbd.layout and option.kbd.variant names in tags and set them to "ch" for the first, then "fr" for the last. The path is from memory, I'm in Windows currently at staff.
You need to restart hal and X :

Code: Select all

service restart hald && gdm-restart
Image
User avatar
gapan
Salix Wizard
Posts: 6355
Joined: 6. Jun 2009, 17:40

Re: Invalid keyboard layout related to locale

Post by gapan »

releasedinjapan wrote:When installing Salix I chose to use the fr_CH locale. I didn't notice any problem until I rebooted, started an X session and tried to type some text: the keyboard layout wasn't a swiss french one but the default one (en_US).
OK, I'm a bit confused. The locale and keyboard layout are two different things. You select the keyboard layout (keymap) when installation starts, it's the first thing you do. You select the locale at the end of the installation process, after all packages have been installed. The keyboard layout is not set according to the locale. Did you select the fr_CH keymap when installation started? You could do the same after installation if you launch keyboardsetup as root or select "Keyboard layout" ("Configuration du clavier") from the menu. As far as I can see if you select the fr_CH keymap, that's the one that is going to be used.
Image
Image
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Invalid keyboard layout related to locale

Post by JRD »

Console keymap, locale and Xorg layout don't always match.
For exemple, for me (french) :
Console keymap : fr-latin9
Local : fr_FR.utf8
Xorg Layout : fr/oss

You cannot guess the Xorg Layout from the two first ones. There could have a corresponding table for each console keymap, but here is the real problem.
If he chose fr_CH keymap for the console, then maybe "fr_CH" was also used for Xorg layout, and it's a mistake. "ch/fr" must have been used.
Where is the corresponding between console keymap and xorg layout done ?
Image
User avatar
gapan
Salix Wizard
Posts: 6355
Joined: 6. Jun 2009, 17:40

Re: Invalid keyboard layout related to locale

Post by gapan »

I'm guessing that releasedinjapan didn't select a custom keymap at the beginning of installation, but stayed with the default, which is en_US. The locale setting at the end of the installation process has nothing to do with the keymap. If he had selected the fr_CH keymap, he would get an fr_CH keymap, that's what I see in the code anyway.
Image
Image
releasedinjapan
Posts: 9
Joined: 23. Sep 2009, 19:55

Re: Invalid keyboard layout related to locale

Post by releasedinjapan »

At the beginning of installation, I selected fr_CH as a keymap (qwertz/fr_CH.map). At the end of installation I selected fr_CH.UTF-8 as a locale.

fr_CH is a valid console keymap, but not a valid X.org keyboard layout (the correct one is layout "ch" with variant "fr"). However it seems the system was trying to set the X.org layout to the inexistant fr_CH automatically. As JRD pointed it out, it seems to come from HAL which is not setting the right xkb layout in /etc/hal/fdi/policy/10-keymap.fdi. Is this file configured during the installation ?
User avatar
gapan
Salix Wizard
Posts: 6355
Joined: 6. Jun 2009, 17:40

Re: Invalid keyboard layout related to locale

Post by gapan »

OK, now I get it! I thought that in fact fr_CH was a valid xorg layout. Nobody complained about this before. Thanks for the clarification releasedinjapan. A fix in the salixtools will be released soon, but the installation from the iso of course cannot be fixed now. It will be of course included in the next version of Salix.
Image
Image
User avatar
gapan
Salix Wizard
Posts: 6355
Joined: 6. Jun 2009, 17:40

Re: Invalid keyboard layout related to locale

Post by gapan »

releasedinjapan, can you please try this package?
http://pnboy.pinguix.com/gapan/salix/sa ... ch-1gv.txz

It should set the ch xkeymap with fr variant when you choose fr_CH or fr_CH-latin1. Please test if changes are applied on the fly, and that they also stick after a reboot.
Image
Image
releasedinjapan
Posts: 9
Joined: 23. Sep 2009, 19:55

Re: Invalid keyboard layout related to locale

Post by releasedinjapan »

It almost works ;) With this version my keyboard layout is changed on the fly after running keyboardsetup (I chose fr_CH), and sticks after a reboot, but it's the Swiss German layout, not the Swiss French one.

It's confirmed in /etc/hal/fdi/policy/10-keymap.fdi where I have

Code: Select all

<merge key="input.xkb.rules" type="string">base</merge>
      <merge key="input.xkb.model" type="string">evdev</merge>
      <merge key="input.xkb.layout" type="string">ch</merge>
      <merge key="input.xkb.variant" type="string" />
The correct code would be

Code: Select all

<merge key="input.xkb.rules" type="string">base</merge>
      <merge key="input.xkb.model" type="string">evdev</merge>
      <merge key="input.xkb.layout" type="string">ch</merge>
      <merge key="input.xkb.variant" type="string">fr</merge>
Digging a bit into /usr/sbin/keyboardsetup, I've seen the $xkbvariant variable which seems responsible for setting the XkbVariant. For a reason, this variable is empty when it should contain "fr".

Note: I also tried the keyboard in a VT outside of X. Letters with accents wouldn't display when I pressed the key, just nothing happened when pressing éöàäèü etc.

BTW, thanks for your help on the issue :)
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Invalid keyboard layout related to locale

Post by JRD »

I think it's an error in the sed expression.
I may take a look when I have time or perhaps gapan will do before me.

In /usr/sbin/keyboardsetup at line 231, there is:

Code: Select all

	sed -i "s/\"input.xkb.variant\" type=\"string\".*\"input.xkb.variant\" type=\"string\">"$xkbvariant"<\/merge>/" \
It should be:

Code: Select all

sed -i "s:\(<merge key=\"input.xkb.variant\" type=\"string\"\).*/\(merge\)\?>:\1>$xkbvariant</merge>:" \
Image
Post Reply