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:
sudo /lib/udev/keymap -i input/event5
(not the same command as step 3)
deric says:
Akshay says:
I tried getting the code from the mouse event, but it said keycode reserved.
onur says:
Michael L. McQuown says:
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:
Jame Zeng says:
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:
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?