# [solved] Keyboard acting weird

## indy.dk

Hi,

I have just installed Gentoo 2006.1 a few days ago and I have some issues with my keyboard. I'm not an experienced user so please forgive me if it is a dummy question. so here is the problem: I have a laptop computer (HP Pavillon zd7349ea) which has a french keyboard (therefore azerty + letters with accents):

Symptoms of my ill keyboard:

- the letters with accents (among some others) are outputing something completely different as they should do. Here is a little summary of what key do what:

é => {

è => }

ç => /

à => @

ù => |

etc...

- another thing is that the AltGr key is not working at all

- my keyboard is acting like that either in the console (with X started or not) or in a text editor.

I did set the keyboard layout as a french keyboard in the xorg.conf file, and I did precise with the localedef that I wanted to use UTF-8. Here is the section from the xorg.conf:

```
Section "InputDevice"

   Identifier   "Keyboard0"

   Driver   "kbd"

   Option   "CoreKeyboard"

   Option  "XkbLayout" "fr"

   Option   "XkbRules" "xorg"

   Option   "XkbModel" "pc105"

   Option   "XkbOptions" "grp:toggle,grp_led:scroll"

   Option   "XkbVariant" "utf8"

EndSection
```

And here is what the locale command outputs:

```
LANG=

LC_CTYPE="fr_FR.UTF-8"

LC_NUMERIC="fr_FR.UTF-8"

LC_TIME="fr_FR.UTF-8"

LC_COLLATE="fr_FR.UTF-8"

LC_MONETARY="fr_FR.UTF-8"

LC_MESSAGES="fr_FR.UTF-8"

LC_PAPER="fr_FR.UTF-8"

LC_NAME="fr_FR.UTF-8"

LC_ADDRESS="fr_FR.UTF-8"

LC_TELEPHONE="fr_FR.UTF-8"

LC_MEASUREMENT="fr_FR.UTF-8"

LC_IDENTIFICATION="fr_FR.UTF-8"

LC_ALL=fr_FR.UTF-8
```

I did search on the forum and I tried a few things from there:

- setting the LC_xxx variables with the localedef command to fr_FR.UTF-8

- trying three different layouts in the xorg.conf for the "XkbVariant": latin1, latin9 and utf8

- trying to unemerge keyboard-config and emerge kbddata instead: I had an error message when I rebooted the computer, so I did the opposite and unemerged kbddata and re-emerge keyboard-config, but I still have that error message... (That was a smart thing to do... Did I told you I was not very experienced?...)

- trying to set the "XkbModel" to pc104 and pc105: none of them changed anything. A little precision is that my laptop computer does have a numeric keypad, and therefore 105 keys.

- trying to emerge sys-apps/kbd: it didn't changed anything

So now you know everything about my problem. Please heLp Me I am clOsE frOM a NerVoUs BreaKDOWNNNNNNNN... arghhhhhhhhhhhhhhhhhhh....

...

Just Kidding  :Mr. Green:  but if someone do have an idea that could help me it would be very nice! Thanks a lot   :Mr. Green: 

Indy.dkLast edited by indy.dk on Sun Oct 08, 2006 9:03 am; edited 1 time in total

----------

## wynn

You might like to try emerge'ng x11-misc/xkeycaps.

When you run it you can choose the keyboard (it has 105-key French keyboard) and then pressing keys on the real keyboard will show up on the onscreen keyboard.

This may help you see what it going wrong.

----------

## indy.dk

Thanks for your answer wynn!

I tried xkeycaps but I don't know how to interpret the results. When I push the AltGr key in the software, the AltGr key lights on. It shows me that when I try to use AltGr + any other key, I get the wrong entry in the ascii table.

For example

AltGr + '6' should be '|' and outputs '-' instead.

What xkeycap outputs:

KeyCode:  6  -  |    0x0F  15  017

KeySym: minus 6

ASCII:   -   0x2D   45    055

Do you have any idea how I could restore the good keymap?

----------

## wynn

What were you using before to get the 'good' output?

Have you set "KEYMAP" in /etc/conf.d/keymaps to "azerty"? There are some other possibilities, the directory in /usr/share/keymaps/i386/azerty/ has

```
azerty.map.gz fr-latin1.map.gz fr-pc.map.gz wangbe.map.gz

be-latin1.map.gz fr-latin9.map.gz fr.map.gz wangbe2.map.gz
```

so I imagine you could use "fr", "fr-latin1", "fr-pc", or "fr-latin9" instead.

----------

## indy.dk

Actually I have installed Gentoo and Windows on the same computer. When I use windows I don't have any issue with the keyboard, it's working fine. But under gentoo it doesn't.   :Sad: 

I have already set "KEYMAP" in /etc/conf.d/keymaps to "fr" (I have tried fr, fr-latin1 and fr-pc, which were all the same, and fr-latin9 which was acting even weirder :p) but it doesn't seem to be the problem... The accents won't work, neither will the AltGr.

As I was telling you, I have an error message (in French) that tells me I have a problem while activating the XKB configuration. 

It gives me 3 reasons that could be the cause of the error message:

- a bug in the library xklavier

- a bug in the X server (xkbcomp, xmodmap utils)

- an incompatible libxkfile in the X server

So it asks me to try either xprop -root | grep XKB or gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd to solve the problem. However I must say that the error message appeared after I unemerged and re-emerge keyboard-config. My keyboard was acting weird before I did that so it might not be the cause of the main problem. 

Here is what the 2 commands output:

For xprop -root | grep XKB

```
_XKB_RULES_NAMES_BACKUP(STRING) = "xorg", "pc105", "fr", "utf8", "grp:toggle,grp_led:scroll"

_XKB_RULES_NAMES(STRING) = "xorg", "pc105", "fr", "utf8", "grp:toggle,grp_led:scroll"
```

For gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd

```
 layouts = [fr]

 model = pc105

 options = [grp grp:toggle,grp_led      grp_led:scroll]

 overrideSettings = false

```

Does it mean anything special to you? Do you see any problem with this?

----------

## wynn

I've had a look at xf86-input-keyboard to see if there is any trail which leads to a keymap but I can't see one. It says it uses the OS standard read_input function and it handles scancodes so these must be mapped to characters by a keymap. It also handles modifiers, the usual Caps and Shift as well as Alt and Control.

Looking for keymaps there is only the /usr/share/X11/xkb/rules directory and it is hard to make out what's going on.

There is An Unreliable Guide to XKB Configuration.

Nice quotation from it *Quote:*   

>     Oh yes. I've been through there on my trip around the image. The giant vaulted Klein bottles covered with mosaics of other, different, Klein bottles ... the rows of gargoyles on the roof, each holding a sign reading ``See Previous Gargoyle'' ... the little food stands around the base, where they sell you food stand vouchers, redeemable for food stand vouchers at all food stands except this one ... the hall of the penitents ... the giant Romanesque stained glass windows, built out of thousands of tiny LooksLike blocks, lit from behind by the radiance of the great Aka ... 
> 
>     Truly one of the architectural wonders of our age. I've been there alright. And I bought postcards. 
> 
> Steve Taylor, talking about software completely unrelated to XKB

 

----------

## indy.dk

I'm starting to understand a little bit what's going on. When I look at the xmodmap -pk to see the keycodes that are currently attributed to my keyboard, here is what I get:

```
    KeyCode     Keysym (Keysym) ...

    Value       Value   (Name)  ...

      8

      9         0xff1b (Escape)

     10         0x0026 (ampersand)      0x0031 (1)

     11         0x0000 (NoSymbol)       0x0032 (2)

     12         0x0022 (quotedbl)       0x0033 (3)

     13         0x0027 (apostrophe)     0x0034 (4)

     14         0x0028 (parenleft)      0x0035 (5)

     15         0x002d (minus)  0x0036 (6)

     16         0x0000 (NoSymbol)       0x0037 (7)

     17         0x005f (underscore)     0x0038 (8)

     18         0x0000 (NoSymbol)       0x0039 (9)

     19         0x0000 (NoSymbol)       0x0030 (0)

     20         0x0029 (parenright)

     21         0x003d (equal)  0x002b (plus)

     22         0xff08 (BackSpace)

     23         0xff09 (Tab)

     24         0x0061 (a)      0x0041 (A)

     25         0x007a (z)      0x005a (Z)

     26         0x0065 (e)      0x0045 (E)

     27         0x0072 (r)      0x0052 (R)

     28         0x0074 (t)      0x0054 (T)

     29         0x0079 (y)      0x0059 (Y)

     30         0x0075 (u)      0x0055 (U)

     31         0x0069 (i)      0x0049 (I)

     32         0x006f (o)      0x004f (O)

     33         0x0070 (p)      0x0050 (P)

     34         0xfe52 (dead_circumflex)        0xfe57 (dead_diaeresis)

     35         0x0024 (dollar)

     36         0xff0d (Return)

     37         0xffe3 (Control_L)

     38         0x0071 (q)      0x0051 (Q)

     39         0x0073 (s)      0x0053 (S)

     40         0x0064 (d)      0x0044 (D)

     41         0x0066 (f)      0x0046 (F)

     42         0x0067 (g)      0x0047 (G)

     43         0x0068 (h)      0x0048 (H)

     44         0x006a (j)      0x004a (J)

     45         0x006b (k)      0x004b (K)

     46         0x006c (l)      0x004c (L)

     47         0x006d (m)      0x004d (M)

     48         0x0000 (NoSymbol)       0x0025 (percent)

     49

     50         0xffe1 (Shift_L)

     51         0x002a (asterisk)

     52         0x0077 (w)      0x0057 (W)

     53         0x0078 (x)      0x0058 (X)

     54         0x0063 (c)      0x0043 (C)

     55         0x0076 (v)      0x0056 (V)

     56         0x0062 (b)      0x0042 (B)

     57         0x006e (n)      0x004e (N)

     58         0x002c (comma)  0x003f (question)

     59         0x003b (semicolon)      0x002e (period)

     60         0x003a (colon)  0x002f (slash)

     61         0x0021 (exclam)

     62         0xffe2 (Shift_R)

     63         0xffaa (KP_Multiply)

     64         0xffe9 (Alt_L)

     65         0x0020 (space)

     66         0xffe5 (Caps_Lock)

     67         0xffbe (F1)     0xffca (F13)

     68         0xffbf (F2)     0xffcb (F14)

     69         0xffc0 (F3)     0xffcc (F15)

     70         0xffc1 (F4)     0xffcd (F16)

     71         0xffc2 (F5)     0xffce (F17)

     72         0xffc3 (F6)     0xffcf (F18)

     73         0xffc4 (F7)     0xffd0 (F19)

     74         0xffc5 (F8)     0xffd1 (F20)

     75         0xffc6 (F9)

     76         0xffc7 (F10)

     77         0xff7f (Num_Lock)

     78         0xff14 (Scroll_Lock)

     79         0xffb7 (KP_7)

     80         0xffb8 (KP_8)

     81         0xffb9 (KP_9)

     82         0xffad (KP_Subtract)

     83         0xffb4 (KP_4)

     84         0xffb5 (KP_5)

     85         0xffb6 (KP_6)

     86         0xffab (KP_Add)

     87         0xffb1 (KP_1)

     88         0xffb2 (KP_2)

     89         0xffb3 (KP_3)

     90         0xffb0 (KP_0)

     91         0xffae (KP_Decimal)

     92

     93

     94         0x003c (less)   0x003e (greater)

     95         0xffc8 (F11)

     96         0xffc9 (F12)

     97         0xff50 (Home)

     98         0xff52 (Up)

     99         0xff55 (Prior)

    100         0xff51 (Left)

    101

    102         0xff53 (Right)

    103         0xff57 (End)

    104         0xff54 (Down)

    105         0xff56 (Next)

    106         0xff63 (Insert)

    107         0xffff (Delete)

    108         0xff8d (KP_Enter)

    109         0xffe4 (Control_R)

    110         0xff13 (Pause)

    111

    112         0xffaf (KP_Divide)

    113         0xffea (Alt_R)

    114         0xff6b (Break)

    115

    116

    117

    118

    119

```

I stop there but it goes up to 255. I see that when it should output for example a '@' the keysim is 

```
19         0x0000 (NoSymbol) 
```

I have to find out why I don't have any keysims in my keyboard layout. I'll read the guide to XKB configuration and hope to find a tip that could help me. Thanks wynn  :Wink: 

----------

## exhortae

Salut 

here's the howto I followed to get a full functionnal french system (keyboard, apps ...)

http://fr.gentoo-wiki.com/HOWTO_Localisation_de_Gentoo_en_fran%C3%A7ais

----------

## wynn

I expect that exhortae's link will do the trick (don't change from UTF-8 though) but, just to satisfy my curiosity, could you paste the output of "xmodmap -pke" to somewhere like http://pastebin.ca/? I'd like to compare it with what I get here. Could you also preface it with the settings in

```
Section "InputDevice"

    Identifier     "Keyboard0"

    Driver         "kbd"

    Option         "XkbModel" "pc105"

    Option         "XkbLayout" "gb"

EndSection
```

in your xorg.conf.

Thanks in advance.

{Added} I've just come across the Ubuntu 6.06 xmodmap.fr, I've pasted it into http://pastebin.ca/190834; to use it, copy it into your home directory as .Xmodmap. When you restart X, it will replace the default keyboard map which you are having trouble with. At any time you can return to the status quo by renaming the file and restarting X.

If it's not quite what you want, there's xmodmap.fr-2 and xmodmap.fr_x86 to try instead   :Very Happy: 

The link to XKB Configuration in the previous post is beginning to dissipate the clouds around "modifiers", "ISO_Level3_Shift" and so on.

----------

## indy.dk

Hi wynn!

I wanted to thank you for everything I did try exhortae's link but it didn't worked. However the tip you gave me with the .Xmodmap worked perfectly!!

Thanks for everything!

=> problem solved   :Razz: 

----------

