← Back to team overview

ubuntu-x-swat team mailing list archive

[Bug 313514] Re: MASTER: evdev driver ignores keycodes > 255

 

First of all I own a Logitech LX710 desktop kit, one single USB receiver
for both keyboard and mouse. You can have a look at the keyboard here
http://launchpadlibrarian.net/21698239/lx710.jpg and see what I mean for
extra/multimedia keys: on the left there is some image editing stuff, on
the left some music stuff, a few customizable shortcuts
(Fn+F9/F10/F11/F12) and some predefined ones (Word, Excel, Calendar,
Calculator, and so on), a few more like Search, Mail, VoIP (as you can
see no zoom slider, sorry). I just love the side keys (I wish I had them
on my laptop too), but unfortunately many of them didn't work out of the
box (all the left ones, the shuffle key, and some others). That's
because they are correctly mapped by the kernel (using the right
definitions in input.h) from scancodes (the way the hardware notifies a
key pressure) to keycode numbers above the 255 value (you can verify
this using showkey). So no chance to see them shown up by xev (note that
X reads kernel keycodes - from 1 to 255 - and maps them to different
keycodes and finally maps them to keysym). So, it is necessary to change
the scancode -> keycode mapping at kernel level for all those "dead"
keys, choosing from the ones not already assigned in the range 127-247
(have a look at input.h for keycode definitions and use showkey to avoid
collisions). This can be accomplished using udev-extra (read
/usr/share/doc/udev/README.keymap.txt for help), following two steps:

1) you have to define all the remappings that you need (in the form of
"scancode keycode" list) and place them in a file under
"/lib/udev/keymaps/" (for example I created logitech-lx710-cordless
there). You can find the scancodes using evtest ("sudo evtest
/dev/input/eventX", where X is your keyboard device. Be careful,
sometimes these extra keys are exposed through a different device or
your mouse interface: eg. event3 --> kbd, event4 --> mouse & extra
keys). Here some sample output:

Event: time 1294153475.909379, type 4 (Misc), code 4 (ScanCode), value c1028
"c1028" is the scancode value you're going to place in your keymap file, then pick up a number from input.h as described earlier and convert it to hexadecimal. Then write the remap pair in your file, maybe with a descriptive comment, like this:

0xC1028 0x9a # rotate button

Iterate for every key > 255.

2) you have to tell udev to apply this remapping file everytime it
encounters your keyboard, so edit the
"/lib/udev/rules.d/95-keymap.rules" file adding the udev rule that
matches your HW. Please don't ask me to define a rule for you. NOTE: you
can immediately apply your keymap file by yourself typing "sudo
/lib/udev/keymap /dev/input/eventX /lib/udev/keymaps/$YOUR_FILE" and
verify it with evtest once again.

Now, you can use the Gnome shortcuts editor to see that the keys are now
usable inside X and create new shortcuts. However it might happen that
no keysym is assigned to that keycode (so you'll see 0xXY instead of
XF86Foo). You can see current mappings through xmodmap -pke, save the
output into a file and edit it if you need (a full keysym code list is
available in "/usr/lib/X11/XKeysymDB"). Once you added the keysyms to
those keys you remapped, you can save this file as ~/.Xmodmap (or as
/etc/X11/Xmodmap if you wish to apply to every user).

At the end it's nice to see that I can use the rotate button for the
window selection, + and - for moving back and forth through my
workspaces and so on. Hope it helps!

I tried to keep it simple here, for further informations, improvements and details --> man udev, man xmodmap, /usr/share/doc/udev/README.keymap.txt, 
https://help.ubuntu.com/community/MultimediaKeys and http://dev-loki.blogspot.com/2006/04/mapping-unsupported-keys-with-xmodmap.html

-- 
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xorg-server in ubuntu.
https://bugs.launchpad.net/bugs/313514

Title:
  MASTER: evdev driver ignores keycodes > 255