Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use a Microsoft Natural Ergonomic Keyboard 4000 on Ubuntu 10.10. The multimedia keys (Volume, Play/Pause) work, the Mail and Calculator button as well.

Now I would love to use the zoom slider, if it were possible I'd like to use page scrolling with that. Is there some way to enable that?

share|improve this question

5 Answers 5

The problem is that evdev driver ignores keycodes > 255.
The solution, thanks to Marco Chiappero:

1) you have to define all the remappings that you need (in the form of 
"scancode keycode" list) and place them in a file under "/lib/udev/keymaps/" 
(for example I created logitech-lx710-cordless there). You can find the 
scancodes using evtest ("sudo evtest /dev/input/eventX", where X is your 
keyboard device. Be careful, sometimes these extra keys are exposed through 
a different device or your mouse interface: eg. event3 --> kbd, event4 --> 
mouse & extra keys). Here some sample output:

Event: time 1294153475.909379, type 4 (Misc), code 4 (ScanCode), value c1028
"c1028" is the scancode value you're going to place in your keymap file, then 
pick up a number from input.h as described earlier and convert it to 
hexadecimal. Then write the remap pair in your file, maybe with a descriptive 
comment, like this:

0xC1028 0x9a # rotate button

Iterate for every key > 255.

2) you have to tell udev to apply this remapping file everytime it encounters 
your keyboard, so edit the "/lib/udev/rules.d/95-keymap.rules" file adding 
the udev rule that matches your HW. Please don't ask me to define a rule for 
you. 
NOTE: you can immediately apply your keymap file by yourself typing 
"sudo /lib/udev/keymap /dev/input/eventX /lib/udev/keymaps/$YOUR_FILE" and 
verify it with evtest once again.

Now, you can use the Gnome shortcuts editor to see that the keys are now 
usable inside X and create new shortcuts. However it might happen that no 
keysym is assigned to that keycode (so you'll see 0xXY instead of XF86Foo). 
You can see current mappings through xmodmap -pke, save the output into a 
file and edit it if you need (a full keysym code list is available in
"/usr/lib/X11/XKeysymDB").
Once you added the keysyms to those keys you remapped, you can save this file
as ~/.Xmodmap (or as /etc/X11/Xmodmap if you wish to apply to every user).
share|improve this answer
    
I figures out that the buttons I want are c022d and c022e, but I cannot find the input.h. –  queueoverflow Apr 24 '11 at 13:19
    
As I understand (but I can't test because I don't have this hardware) you don't really need input.h, you just need to edit this file: /lib/udev/rules.d/95-keymap.rules. (May be here at launchpad you can find people with the same hardware therefore more able to help bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/313514 ). Have you edited the file I mentioned above? –  desgua Apr 24 '11 at 13:37
1  
This is far too technical and disorganized an answer for most people. A few serious gaps: no help on determining the appropriate /dev/input/eventX, unclear steps mixed in with contextual information and requests not to ask for instructions for creating keymaps. –  Alain O'Dea Aug 5 '11 at 0:16
1  
evtest isn't even installed by default making this even worse. –  Alain O'Dea Aug 5 '11 at 0:21
    
Through trial and error I found that my keyboard is /dev/input/event3 and evtest doesn't pick up any events from the zoom slider. –  Alain O'Dea Aug 5 '11 at 0:26

On my machine, extra keys (HomePage, Search, Calc, etc.) and zoom input were sent though /dev/input/event5 whereas ordinary keys were sent through /dev/input/event4. Zoom key value agree with queueoverflow's.

share|improve this answer

I wrote a post specifically about this:

share|improve this answer
    
Thanks, is there a quick n' easy way to do the same with the favorites hotkeys? or just evtest? –  Ghost Mar 20 '13 at 2:34
    
@Ghost no that I know of. –  rebelliard Mar 20 '13 at 5:57
    
Link target missing –  Manwe Feb 20 at 10:13
    
@Manwe thanks. Fixed now. –  rebelliard Feb 20 at 14:07

Create the file /etc/udev/rules.d/98-ms-ergo.rules with the following contents:

ACTION=="remove", GOTO="keyboard_end"
KERNEL!="event*", GOTO="keyboard_end"
ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end"
SUBSYSTEMS!="usb", GOTO="keyboard_end"

SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"

ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d pageup 0xc022e pagedown"

GOTO="keyboard_end"

This will map the zoom key to page-up/page-down without changing the installed files in /lib/udev.

Once added, you just need to unplug and replug your keyboard for it to start working.

share|improve this answer
    
This worked for me flawlessly using Fedora 19. –  Rubens Mariuzzo Jul 9 at 15:53
    
Also worked for me with Debian Wheezy. Thanks! –  Gabe Kopley Sep 16 at 0:11
    
doesn't work with the 7000 model, Ubuntu 14.04, prior to rebooting at least... does it imply I should have anything relevant under /lib/udev to start with? there's no ms file there for me. –  matt Sep 18 at 16:01
    
not working also after reboot –  matt Sep 18 at 22:24

On Xubuntu 13.10 (perhaps on Ubuntu 13.10 too) the same can be done as follows:

Edit key mappings in /lib/udev/hwdb.d/60-keyboard.hwdb:

###########################################################
# Microsoft
###########################################################

# Microsoft Natural Ergonomic Keyboard 4000
keyboard:usb:v045Ep00DB*
 KEYBOARD_KEY_c022d=pageup
 KEYBOARD_KEY_c022e=pagedown

Run sudo udevadm hwdb --update

Reboot.

share|improve this answer
    
Worked on 14.04 for me –  uval Jun 4 at 22:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.