Multimedia keyboard howto

So thanks to Crispin
and the people commenting on his blog I at least figured out how
one creates new keyboard profiles for X11.

Step 1: Get the numerical code for the key using the ‘xev’ tool shipping with X

Step 2: Figure out the X11 code by looking up those numbers in /usr/share/X11/xkb/keycodes/xfree86

Step 3: Add a section to /usr/share/X11/xkb/symbols/inet with those codes linking them to relevant XFree86 codes. (make a backup copy first) For my laptop that ended up with:

// Laptop/notebook Dell Inspiron 8xxx
partial alphanumeric_keys
xkb_symbols "inspiron" {
    key <I22>   {       [ XF86AudioPlay, XF86AudioPause ] };
    key <I10>   {       [ XF86AudioPrev         ]       };
    key <I19>   {       [ XF86AudioNext         ]       };
    key <I24>   {       [ XF86AudioStop         ]       };
    key <I30>   {       [ XF86AudioRaiseVolume  ]       };
    key <I2E>   {       [ XF86AudioLowerVolume  ]       };
    key <I20>   {       [ XF86AudioMute         ]       };
};

Step 4: Then make a unified patch by doing:

diff -u inet inet.backup > inet.patch

Step 5: And finally submit
a bug into the freedesktop bugzilla

4 Responses to “Multimedia keyboard howto”

  1. Ken says:

    I have one key that even xev doesn’t respond to. Is it hopeless? Or does this mean that I need to dig around in obscure configuration files (which is pretty much the same thing)? :-)

  2. Christian says:

    No idea Ken, I guess if Xev doesn’t respond to it simply isn’t registered being pressed at all.

  3. textshell says:

    If xev doesn’t show the keypresses at all, maybe the kernel is missing information about the keys (as on my laptop)
    take a look at the kernel messages and man google for setkeycodes.

    I hope that helps ;)

  4. Marius says:

    I had the very same problem, some keys are not recognized by xev. Check the comments on this blog for a solution:
    http://linuxgangster.org/modules.php?name=Content&file=viewarticle&id=17

    Whenever you hit a key and see nothing in xev a message is logged to /var/log/messages, using info from the log you will have to map the keycode using setkeycodes.

    Marius