HowTo Logitech MX Revolution on Ubuntu

If you have a Logitech MX Revolution Mouse (or any other fancy mouse) this howto might help you to get all the special features working. If you are not using Ubuntu Intrepid Ibex, you should plug in the bluetooth usb stick of the MX Revolution before Xserver starts, otherwise it does not load the right driver.

Xorg.conf Modifications

If you are using Ubuntu Intrepid Ibex you can skip the “Xorg.conf Modifications” section, because this Ubuntu Version uses the evdev driver for your MX-Revolution out of the box.

You can find your X.org configuration file on /etc/X11/xorg.conf. Edit it with root rights (e.g. sudo gedit /etc/X11/xorg.conf).

  • Modify the ServerLayout section and add Inputdevice “My Mx Rev” “SendCoreEvents”. For example:
Section "ServerLayout"
	Identifier      "Default Layout"
	Screen		"Default Screen" 0 0
	Inputdevice     "Generic Keyboard"
	Inputdevice     "Configured Mouse"
	...
	Inputdevice     "My Mx Rev" "SendCoreEvents"
EndSection

This defines a new input device with the name “My Mx Rev”, you can use any name here, but make sure that you use the same name below.

Before Hardy Heron Ubuntu Versions

On Ubuntu versions before Hardy Heron (before 8.04), add the following section to your xorg.conf:

Section "InputDevice"
	Identifier      "My Mx Rev"
	Driver          "evdev"
	Option          "Protocol"      "Auto"
	Option          "Name"  "Logitech USB Receiver"
	Option          "Phys"  "usb-*/input0"
EndSection

Ubuntu Hardy Heron

On Ubuntu Hardy Heron (8.04), add this section to your xorg.conf instead:

Section "InputDevice"
	Identifier      "My Mx Rev"
	Driver          "evdev"
	Option          "Device"        "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse"
EndSection
After changing the xorg.conf do a Logoff/Logon to make the new configuration active.

Hotkeys

You will need the xbindkeys and xautomation packages to bind the mouse hotkeys. Install them with:

sudo apt-get install xbindkeys xautomation

Configure Xbindkeys

The xbindkeys daemon has to be running on you pc to do these hotkey bindings. Please do not forget to add xbindkeys to your session startup.
Edit a file called .xbindkeysrc in your home directory (e.g. with the command gedit ~/.xbindkeysrc, note that files starting with a dot (dotfiles) are hidden in the file browser by default).

Now you can configure the hotkey bindings in this config file. When the mouse hotkey is pressed, the xbindkeys tool executes a bash command (format is: command to start &). With the xte program you can emulate keystrokes.
Use the following config file as an example on what can be done. Comment lines start with an '#'.

# Right Scroll Wheel - Super_L (Windowskey) + b
"/usr/bin/xte 'keydown Super_L' 'key b' 'keyup Super_L' &"
  b:6

#Second Scroll Wheel press
"/usr/bin/xte 'keydown Super_L' 'key c' 'keyup Super_L' &"
  b:17

#Increase Volume
"/usr/bin/xte 'key XF86AudioRaiseVolume' &"
  b:9

#Decrease Volume
"/usr/bin/xte 'key XF86AudioLowerVolume' &"
  b:8

#Start (or toggle minimize/maximize) Amarok
"amarok -m &"
  b:13

#Second Scroll Wheel Down -  Start Firefox
"firefox &"
  b:15

Button Assignments for the MX Revolution

Name Xbindkeys Number
Left click b:1
Right click b:3
Main Wheel press down b:2
Main Wheel press left b:7
Main Wheel press right b:6
Second Wheel press down b:17
Second Wheel press forward b:13
Second Wheel press backward b:15
Button Up b:9
Button Down b:8

To know how to map the search button, read the Assign Keysyms to Keycodes section below. You have to assign a keysym to the search button keycode, because .xbindkeyrc only wants keysyms and not keycodes.

Add Xbindkeys to Session Startup

Goto System→Preferences→Sessions and add the “xbindkeys” command as startup program.

Scroll Wheel

And now the fun part: how to get the scroll wheel switching feature working. The following packages are needed:

sudo apt-get install build-essential gcc

The revoco program enables you to change the behavior of the MX Revolution scroll wheel. Download it from: http://goron.de/~froese/revoco. Unpack the source and compile it with the command:

make

After a successful compile (hope so), you get more info with the command ”./revoco –help”.
For example: sudo ./revocco -manual 6 will unlock/lock the scroll wheel when pressing the search button. There is also a mode that switches the wheel behavior triggered by scroll speed (same as in Windows).

Keysyms and Keycodes

Assign Keysyms

With the xmodmap -pke > .xmodmaprc command, you can dump your current keymap table to a file. There you can assign Keysyms to the Keycodes. Example:

keycode 173 =
keycode 174 = XF86AudioLowerVolume
keycode 175 =
keycode 176 = XF86AudioRaiseVolume
keycode 177 =

These names can then be used in .xbindkeysrc or in the System→Preferences→Keyboard Shortcuts tool. When a keysym is defined and you assign a hotkey in the Keyboard Shortcuts tool, the keysym will be shown instead of the keycode.

The Search Button of the MX Revolution has the keycode 0xe5 = keycode 229 (convert the hex values to decimal with your gcalctool). Note that the search key has the same keycode as the search button on many computer keyboards. When you reassign it, the keyboard button may be reassigned too.

Find out the Keycode/Keysym

To find out other keycodes, use the xev program on the command line. When the xev window is focused (it has a black square in it) the keycodes of all pressed keys will be printed on the command line. Such an output should look like this:

KeyPress event, serial 30, synthetic NO, window 0x2000001,
    root 0x75, subw 0x0, time 1893959559, (107,359), root:(1552,407),
    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "
    XmbLookupString gives 1 bytes: (20) " "
    XFilterEvent returns: False

If you get something like the following, another program catched the hotkey before xev could. Maybe the Gnome Keyboard Shortcuts catch this hotkey. A hotkey can only be used once.

FocusOut event, serial 30, synthetic NO, window 0x2000001,
    mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 30, synthetic NO, window 0x2000001,
    mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
	 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
devlog/blog/howto_logitech_mx_revolution_on_ubuntu.txt · Last modified: 2009/03/02 21:59 by gomel
Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! DevLog Atom feed Valid XHTML 1.0