Ask Your Question
2

How to create custom keymaps now that /lib/udev/keymap is gone?

asked 2013-12-23 12:02:37 -0500

Eirik gravatar image

updated 2014-06-16 10:07:44 -0500

I've been all over the internet after updating from FC18 to 20 this morning. I had two custom keymaps that no longer function: One mapped my Microsoft Natural Keyboard 4000's zoom scroll wheel to up and down, the other mapped Caps Lock to backspace. I can't find any information on how to create a custom keymap and not just use localectl to switch from QWERTY to DVORAK.

My head is spinning from reading Adam W's blog on the changes to xkbd, stared at bugs like this one and this one, even read through mostly-unrelated things like this question, and I'm still at a total loss.

This is the first Linux task I've been completely unable to figure out through Googling and reading and it's quite upsetting. I can't even find what it is, exactly, that changed and replaced a system that many other distributions seem to use.

How do I go from

 0xC022D up
 0xC022E down

in a keymap to whatever the new systemd stuff is looking for? This will be for both virtual terminals and an X session.

edit retag flag offensive close merge delete

Comments

Thanks, Ahmad. I don't have enough karma to even upvote your answer (askbot is a poor StackExchange clone, it would seem), let alone comment on it, but this was exactly what I needed. I can't find a way to trick systemd into applying a rule for all keyboards, so my caps lock hack is stuck as M$ specific for the moment, but at least it works! Now I know where to look the next time something funny happens to udev between Fedora upgrades--systemd.

Eirik gravatar imageEirik ( 2013-12-26 07:18:28 -0500 )edit

askbot has some annoying bits, for example I wasn't sent an email notification of your comment.

Have a look at https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes it has an example of how to match all keyboards.

Ahmad Samir gravatar imageAhmad Samir ( 2014-01-20 06:46:08 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2013-12-25 10:47:30 -0500

Ahmad Samir gravatar image

From /usr/share/doc/systemd/NEWS from the systemd package (udev has been merged into systemd):

  • The udev "keymap" data files and tools to apply keyboard specific mappings of scan to key codes, and force-release scan code lists have been entirely replaced by a udev "keyboard" builtin and a hwdb data file.

Have a look at /usr/lib/udev/hwdb.d/60-keyboard.hwdb, at the top there's an explanation of the new system.

That file actually has this in it:

# Microsoft Natural Ergonomic Keyboard 4000
keyboard:usb:v045Ep00DB*
 KEYBOARD_KEY_c022d=zoomin
 KEYBOARD_KEY_c022e=zoomout

so that makes things easier for you, just take those lines and put them in e.g. /etc/udev/hwdb.d/70-keyboard-custom.hwdb (create /etc/udev/hwdb.d), make the changes you want. Next as root:

udevadm hwdb --update

to create an updated /etc/udev/hwdb.bin, then just unplug/replug the keyboard to test the changes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-12-23 12:02:37 -0500

Seen: 5,761 times

Last updated: Jun 16 '14