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. 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.
- Open a terminal. Sorry, this is all going to be command prompt based!
- Install the program evtest
sudo apt-get install evtest
- 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 likeEvent: 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. - 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 likescan code: 0xC022D key code: zoomin scan code: 0xC022E key code: zoomout
- We need to create a file which contains the new keymapping. To do this, type
sudo nano /lib/udev/keymaps/microsoft-4000
- Insert the following two lines into the file
0xC022D pageup 0xC022E pagedown
If you would rather scroll line-by-line, you can use0xC022D up 0xC022E down
Save the file by pressing CTRL+X. - Now, let's implement the remapped keys. Type
sudo /lib/udev/keymap input/event5 /lib/udev/keymaps/microsoft-4000
- Your scroll buttons should now be working! If not... errr... try again?
- 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
- Scroll through the file until you see
# # The following are external USB keyboards # LABEL="keyboard_usbcheck"
Past in the following lineENV{ID_VENDOR_ID}=="045e", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name microsoft-4000"
The line needs to be aboveGOTO="keyboard_end"
Save the file (CTRL+X). - Reboot.
Hey presto! Your keys will now obey your commands.
aefaradien says:
at step 4 I think you mean: sudo /lib/udev/keymap -i input/event5 (not the same command as step 3)
Terence Eden says:
Thanks! Updated the post.
Michael Floering (@michaelfloering) says:
Thank you so much for posting this! I was hoping to do this exact thing and you spelled it out wonderfully. Now I can keep my keys on the main part of the keyboard even more!
Terence Eden says:
Glad it helped 🙂
deric says:
For the wireless model (Microsoft Keyboard 7000) use ENV{ID_MODEL_ID}=="071d"
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.
Terence Eden says:
Use page down.
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.
Michael Sounhein says:
Worked well on openSUSE 12.2. Thanks for the concise tutorial.
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
Terence Eden says:
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.
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.
dainick says:
Awesome, thank you very much for posting. Works perfectly for me with Ubuntu 13.04
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
trollie 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
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?