Saturday, July 26, 2014

Using the Zoom slider on Microsoft Natural Ergonomic Keyboard 4000 for scrolling

I got the Microsoft Natural Ergonomic Keyboard 4000 a while back, and thought about using the zoom slider for scrolling quite early on. After a bit of googling, it was clear that I wasn't the only one who had that idea. It did seem quite complicated though... so I kept putting it of. Now I decided to finally give it a real try, and due to some changes, it turns out to be quite simple :)

To be honest, this is not true scrolling, I'm mapping the zoom in and out to page up and down. Those buttons already exist, so some might think it redundant, but I find that the zoom slider is nicely placed in the middle of the keyboard, so it works for me. Also, you could, using this method, map it to just about any function.

The changes that have been made in Linux, in particular, the integration of systemd and udev, means that a lot of the older solutions you might find do not work. The keymap command no longer exists, for example.

  1. Create a file: /etc/udev/hwdb.d/61-keyboard-local.hwdb
  2. Paste the following text (exclude the "1."):
    1. # Microsoft Natural Ergonomic Keyboard 4000
      keyboard:usb:v045Ep00DB*
       KEYBOARD_KEY_c022d=pageup
       KEYBOARD_KEY_c022e=pagedown
  3.  In terminal, rebuild the HW DB index: sudo udevadm hwdb --update
  4. Reboot
  5. Your zoom in/out slider should now function as page up/down.

In case anyone is interested in how I came to this...

The reason I didn't need to fiddle about with evtest and event numbers etc, is that the work has already been done. If you look in  /lib/udev/hwdb.d/60-keyboard.hwdb, there is already an entry for this keyboard, and for these keys:
# Microsoft Natural Ergonomic Keyboard 4000
keyboard:usb:v045Ep00DB*
 KEYBOARD_KEY_c022d=zoomin
 KEYBOARD_KEY_c022e=zoomout
Now, you could just change it in that file, but that means that it will stop working if it is updated, better to add a separate file. So all that is needed is a hwdb file with a higher index (under etc rather than lib, to keep it separate). The point is that we can use the syntax, including VID, PID, and keycodes, in our new config file.

As I said in the beginning, you could map them to pretty much anything you like. I tried, but did not get scroll up/down to work for some reason... Anyway, if you feel like trying other things, here is a link to the list of key-mappings that you could use to map it to.
 

No comments:

Post a Comment