I have been running Ubuntu on my netbook for around three years and using Linux for long enough that the UNIX-style highlight to copy and middle-click to paste is automatic to me.Â The Synaptics trackpad on the netbook only has two buttons, but three button emulation (where pressing both buttons sends a middle-click) wasn’t foreign to me, and after three years of heavy netbook use, it occurs instinctively.Â I recently introduced my Logitech MX Revolution cordless mouse to the netbook and the results were promising.Â Having a full featured pointing device with lots of buttons that was automatically detected and just worked (without breaking the trackpad, I might add) was great.Â Unfortunately, the middle button (which is also the scroll wheel) didn’t work.Â This triggered some old memories of setting up the mouse on its former desktop duty (running under openSUSE).Â The good part is that I remembered the middle button didn’t work there either, but that was okay since clicking it never felt quite right due to the wheel also delivering a horizontal scroll capability.Â On the openSUSE desktop, I had mapped the button on the thumbwheel to send a middle-click so it was just a matter of doing that again.
This project took a little longer than it should have since a lot of the guides I encountered were looking to do more than just remap a button and were suggesting the use of
xbindkeys which were unnecessary for my purpose.Â Peripheral device detection and dynamic Xorg.conf file generation with evdev were not as common when most of the guides I read were written, either.Â That change will be key to the eventual resolution below.
$ xmodmap -pke > ~/.Xmodmap
$ echo "pointer = 1 17 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2" >> ~/.Xmodmap
While this works, it affects all pointing devices,Â not just the Logitech mouse. To confine the fix to just the Logitech mouse, I crafted a dynamic configuration for it with the file
/usr/share/X11/xorg.conf.d/52-logitech.conf containing the following:
Â Identifier "Logitech MX Revolution"
Â MatchIsPointer "on"
Â MatchProduct "Logitech USB Receiver"
Â MatchVendor "Logitech"
Â Option "ButtonMapping" "1 17 3 4 5 6 7 8 9 10 11 12 13 14 15 16"
- Identifier is merely a user defined friendly name.
- MatchIsPointer is set to insure the detected device is a mouse or other pointing device.
- MatchProduct contains a pattern from the matching device as it is known in
- MatchVendor contains a unique pattern from the vendor id as found from
lsusb. (More verbose details of the device are found with
lsusb -vd 046d:c525in the case of this device. The two hex values are from the initial
- The Option statement puts the button input in the desired order like
Thanks to evdev this works like a champ and functions automatically when a matching device is plugged into a USB port while leaving non-matching input devices unaltered.