Changing the Microsoft 4000's Zoom Keys in Ubuntu


I'm in love with my keyboard! The Microsoft Natural Ergonomic Keyboard 4000 is a dream to type on. Large, well spaced keys, split keyboard, and a whole host of extra media buttons.
Microsoft 4000 Keyboard
There's only one tiny problem. Two of the buttons don't work in Linux - specifically, the keyboard scroll buttons. This is a long standing bug in Linux, but luckily it is fairly easy to fix.

Using Florian Diesch's tutorial at Ask Ubuntu, I've come up with this simple guide to get your keyboard working.

Update For 14.04: Don't follow this guide, please use this guide on AskUbuntu.

  1. Open a terminal. Sorry, this is all going to be command prompt based!
  2. Install the program evtest
    sudo apt-get install evtest
  3. You will need to find which input "event" corresponds to your keyboard. Run the following command
    sudo evtest /dev/input/event5

    When you press the scroll key on your keyboard, you should see an output like

    Event: time 1325072953.278713, type 4 (Misc), code 4 (ScanCode), value c022e
    Event: time 1325072953.278729, type 1 (Key), code 109 (PageDown), value 1
    Event: time 1325072953.278752, -------------- Report Sync ------------
    

    If you don't, cancel (using CTRL+C) and try another event number. Start at event0 and work your way up.

  4. Let's see what the keys are currently mapped to. Type the command
    sudo /lib/udev/keymap -i input/event5

    (or whatever "event" number you need). You should see an output like

    scan code: 0xC022D   key code: zoomin
    scan code: 0xC022E   key code: zoomout
  5. We need to create a file which contains the new keymapping. To do this, type
    sudo nano /lib/udev/keymaps/microsoft-4000
  6. Insert the following two lines into the file
    0xC022D pageup
    0xC022E pagedown

    If you would rather scroll line-by-line, you can use

    0xC022D up
    0xC022E down

    Save the file by pressing CTRL+X.

  7. Now, let's implement the remapped keys. Type
    sudo /lib/udev/keymap input/event5 /lib/udev/keymaps/microsoft-4000
  8. Your scroll buttons should now be working! If not... errr... try again?
  9. Assuming it is working, we need to make this permanent so that we don't have to type in a command every time we reboot. To open the keymapping file, type
    sudo nano /lib/udev/rules.d/95-keymap.rules
  10. Scroll through the file until you see
    #
    # The following are external USB keyboards
    #
    
    LABEL="keyboard_usbcheck"
    

    Past in the following line

    ENV{ID_VENDOR_ID}=="045e", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name microsoft-4000"

    The line needs to be above

    GOTO="keyboard_end"

    Save the file (CTRL+X).

  11. Reboot.

Hey presto! Your keys will now obey your commands.


Share this post on…

17 thoughts on “Changing the Microsoft 4000's Zoom Keys in Ubuntu”

  1. aefaradien says:

    at step 4 I think you mean:
    sudo /lib/udev/keymap -i input/event5
    (not the same command as step 3)

    Reply
  2. deric says:

    For the wireless model (Microsoft Keyboard 7000) use ENV{ID_MODEL_ID}=="071d"

    Reply
  3. Akshay says:

    Thanks a lot for this. Do you know how to map the zoom key to mouse like scrolling, as opposed to a simple up/down?
    I tried getting the code from the mouse event, but it said keycode reserved.

    Reply
  4. onur says:

    You're the BEST. I have been searching for this feature for a while now and this is the easiest, quickest solution that's out there.

    Reply
  5. Michael L. McQuown says:

    I reckon I don't get this because as far as I know, it requires Control/F1 to get into the shell, and none of the control keys are responding on this MS Natural 4000 keyboard

    Reply
    1. You may need to press the "F-Lock" key on your keyboard. That sets the function keys to act correctly.
      There are multiple ways to get to the terminal in Linux. Go to Applications - Accessories. Or, by pressing CTRL+ALT+T.

      Reply
  6. Michael L. McQuown says:

    Ctrl+Alt+T worked very nicely, thank you. It even worked on my Logitech keyboard. Since I can access the shell, I don't care much about the other function keys.

    Reply
  7. Jame Zeng says:

    That's a great article. It works like a charm. I'm on Fedora 19. It makes my Microsoft 4000 even more useful

    Reply
  8. says:

    I have Microsoft 7000 kit and I just use
    sudo /lib/udev/keymap /dev/input/by-id/usb-Microsoft_Microsoft®_2.4GHz_Transceiver_V1.0-if01-event-mouse 0xc022d pageup 0xc022e pagedown

    Reply
  9. nisargypandya@gmail.com says:

    Hi, I tried it on the Kubuntu 14.04 But came across couple of issues:
    It doesn't have keymap located in lib/udev folder, nor is the keymaps folder. Can you guide me more on how to deal with that?

    Reply

Trackbacks and Pingbacks

What links here from around this blog?

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre> <p> <br> <img src="" alt="" title="" srcset="">