Ubuntu – Make the zoom slider of Microsoft Natural Ergonomic Keyboard 4000 and 7000 scroll up and down, in 14.04 (Trusty)

14.04keyboardudev

I tried to use this tutorial to make scroll switch work on my Microsoft Natural Ergonomic Keyboard 4000. But I face following error:

sudo: /lib/udev/keymap: command not found

I have udev version 204-5ubuntu20.2 (the version found in Trusty)

I noticed that this version doesn't include keymap tool. But I notices that greater udev versions (which available for Debian, for example) include this tool.

Could somebody explain this diff for me? =) And what should I do in this case – install package from Debian repo?

Best Answer

If you look at /lib/udev/rules.d/60-keyboard.rules you'll see that everything has been messed around with. This is just part of the udev merger into systemd that has gone on.

All hardware rules are compiled into a binary hardware database. These follow a really strange format. The existing rules for keyboards that ship with udev live in /lib/udev/hwdb.d/60-keyboard.hwdb. Look at that but don't edit it (updates will probably overwrite it).

To add your custom rules, we'll create a new file in /etc/udev/hwdb.d/ by running sudoedit /etc/udev/hwdb.d/61-keyboard-local.hwdb. All you need to do is paste in the following -

If you are using the 4000 model:

keyboard:usb:v045Ep00DB*
 KEYBOARD_KEY_0c022d=pageup
 KEYBOARD_KEY_0c022e=pagedown

If you are using 7000 model:

keyboard:usb:v045Ep071D*
 KEYBOARD_KEY_0c022d=pageup
 KEYBOARD_KEY_0c022e=pagedown

This is adapated from the tutorial you posted so you might need to tweak based on your keyboard. Look at lsusb and make sure the vendor:product code above (as v####p####) is correct. It won't work if they don't match.

Once you're done editing, recompile the hwdb that udev uses:

sudo udevadm hwdb --update

And then you might need to re-plug. If it's a PS/2 keyboard you might need to reboot. In some cases you also need to reboot.