UPDATE - May 26, 2007 : A new method
MX and VX users can now use btnx to easily get additional functionality from their buttons. The thread for btnx is here: http://ubuntuforums.org/showthread.php?p=2727025
All discussion relating to btnx has been moved there.
OLD GUIDE:: stop here if you used the method above
--------------------------------------------------------------------------------------
This is a guide to get your Logitech MX Revolution to work under Dapper (or Edgy). I have heard that it works for VX Revolution just as well, with the button numbers mapped differently. This guide is based on detyabozhye's "HOWTO: Configuring Logitech mice in Ubuntu 6.06: New Guide" and Andy's "Logitech MX Revolution in Linux". For configuring Logitech mice, other than the MX/VX Revolution, have a look at detyabozhye's great howto.
Color guide:
Red: You should really read these.
Blue: Optional, but recommended reading.
NOTE: This guide is actually heavily
based on detyabozhye's guide (link above). This guide adds to his, describing how to get MX/VX Revolution to work. I decided to make a new guide because of the number of tweaks required.
1. Make sure the USB receiver is plugged in and that you have evdev installed:
Code:
$ sudo apt-get install xserver-xorg-input-evdev
2. The first part of detyabozhye's guide binds the mouse to an event. It works, but after a reboot the event can change and xserver might fail to start. For me it happened every time and I always had to check and edit in the new event. The other method that the guide explains is making a udev. This is what we will do, but his method for making a udev rule will not work for an MX/VX Revolution.
Now let's find some info about your input devices. Type:
Code:
$ cat /proc/bus/input/devices
A whole bunch of text should have been dumped on your terminal. Here is mine:
Code:
I: Bus=0003 Vendor=046d Product=c51a Version=4101
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:02.0-3/input0 <----- Mouse USB location
S: Sysfs=/class/input/input0
H: Handlers=mouse0 event0 ts0
B: EV=7
B: KEY=ffff0000 0 0 0 0 0 0 0 0
B: REL=143
I: Bus=0003 Vendor=046d Product=c51a Version=4101
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:02.0-3/input1 <---- Mouse search button, works already so we don't need it
S: Sysfs=/class/input/input1
H: Handlers=kbd event1
B: EV=f
B: KEY=c0002 400 0 0 1 f80 78000 6039fa d84157ad 8e0000 0 0 0
B: REL=40
B: ABS=1 0
I: Bus=0010 Vendor=001f Product=0001 Version=0100
N: Name="PC Speaker"
P: Phys=isa0061/input0
S: Sysfs=/class/input/input2
H: Handlers=kbd event2
B: EV=40001
B: SND=6
I: Bus=0011 Vendor=0002 Product=0006 Version=0042
N: Name="ImExPS/2 Logitech MX Mouse"
P: Phys=isa0060/serio1/input0
S: Sysfs=/class/input/input3
H: Handlers=mouse1 event3 ts1
B: EV=7
B: KEY=ff0000 0 0 0 0 0 0 0 0
B: REL=143
I: Bus=0003 Vendor=046d Product=c512 Version=3007
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:02.0-2/input0
S: Sysfs=/class/input/input4
H: Handlers=kbd event4
B: EV=120003
B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe
B: LED=1f
I: Bus=0003 Vendor=046d Product=c512 Version=3007
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:02.0-2/input1
S: Sysfs=/class/input/input5
H: Handlers=kbd mouse2 event5 ts2
B: EV=7
B: KEY=7fffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 0 0 1878 d800d100 1e0000 0 0 0
B: REL=143
The output contains your keyboard, mice, etc. I highlighted the important part. If you are like me, you have more than one Logitech mouse and need to know which one of these sections point to the MX/VX Revolution. You need to find the section where the product and version ID is:
--------------------IDs for MX Revolution--------------------
Vendor=046d Product=c51a Version=4101
Name="Logitech USB Receiver"
--------------------IDs for VX Revolution--------------------
Vendor=046d Product=c518 Version=4204
Name="Logitech USB Receiver"
There are two of these, both are for the MX/VX Revolution, but you need to use the the section where the output looks like:
Phys=usb-XXXX:XX:XX.X-X/input0
Handlers=mouseX eventX
The X is a number. For example, in my output it was "Phys=usb-0000:00:02.0-3/input0" and "Handlers=mouse0 event0". This refers to the mouse. The most important part of information in the section is the physical location because this is what we bind the udev rule to:
P: Phys=usb-0000:00:02.0-3/input0
Your physical USB location will be different. Make sure you copy the info after the "Phys=" word from YOUR
output.
Note: The other section with the same IDs, but with "input1" for the physical location (Phys) and "Handlers=kbd eventX" also refers to the mouse, but it interprets events from that input as keyboard events. Apparently this is for the search button, but we don't have to take it into consideration.
3. With the physical location you can now make a udev rule. Make sure you have udev installed. Type:
Code:
$ sudo apt-get install udev
Now make the udev rule. Type:
Code:
sudo gedit /etc/udev/rules.d/19-local.rules
Now add the following line into the new text file, but edit the bolded part:
Code:
KERNEL=="event[0-9]*", SYSFS{../name}=="Logitech USB Receiver", SYSFS{../phys}=="usb-0000:00:02.0-4/input0", NAME="input/event9"
Replace the bold text with whatever you got for the USB location in step 2.
Note: why bind the rule to a physical location? After all, this means that whenever you remove the USB RF-receiver and plug it back in into a different port, the physical location will change. This means the xserver will not boot.
One reason: it's the only way udev can know which device you want to bind to an event (event9 in this case). If we were to bind it to a name like "Logitech USB Receiver", udev would see at least two devices with that name, or in my case 4! It would not know which one to choose. The rule cannot be made with the SysFs input number because these change. The rule cannot be made using the vendor id, product id, and version number, because MX/VX Revolution has two of these. One is recognized as a mouse and the other as a keyboard (for the mouse search button). The only way to make the udev work is by binding it to a physical location. Remember to always plug it in into the same port.
If someone finds a fix for this, please let me know.
4. Now, with the udev rule, you can start editing your xorg.conf file. If you aren't familiar with your xorg.conf file (meaning you don't know it by heart), make sure you make a backup of it:
Code:
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
Now open it for editing:
Code:
$ sudo gedit /etc/X11/xorg.conf
Add the following section into the xorg.conf:
Code:
Section "InputDevice"
Identifier "MX Rev" #VX Rev users can type "VX Rev"
Driver "evdev"
Option "Device" "/dev/input/event9"
Option "Protocol" "auto"
Option "CorePointer"
EndSection
Now find the "Section "ServerLayout"" in the xorg.conf file. Add the following line inside the section:
Code:
InputDevice "MX Rev"
or if you are a VX Rev user and typed "VX Rev" into the identifier,
Code:
InputDevice "VX Rev"
You might also want to comment your old mouse from the server layout (Input Device "Configured Mouse"), also also the Section "InputDevice" with the same name ("Configured Mouse"). Commenting a line is done with a '#' character.
For example, after editing my ServerLayout, this is what it looked like:
Don't copy this straight into your xorg.conf
Code:
Section "ServerLayout"
Identifier "Default Layout"
Screen "Samsung Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "MX Rev"
#InputDevice "Configured Mouse"
EndSection
There, your xorg.conf file is ready. You backed up the previous one? Yes? Good. You can restart your computer now, but if you run into trouble (something went wrong in the xorg.conf file or udev rule, and you can't load xserver), then follow the guide below.
-------------------- BEGIN if xserver wont start-------------------------
Remove the udev rule and restore your xorg.conf:
Code:
$ sudo rm /etc/udev/rules.d/19-local.rules
$ sudo cp /etc/X11/xorg.conf.bak /etc/X11/xorg.conf
Or, if you think you just made a silly typo, you can use nano to edit it from command line:
Code:
$ sudo nano /etc/X11/xorg.conf
or
Code:
$ sudo nano /etc/udev/rules.d/19-local.rules
Then to start udev and xserver again, type
Code:
$ sudo /etc/init.d/udev restart
$ sudo /etc/init.d/gdm restart
-------------------- END if xserver wont start-------------------------
5. Congrats, now you should have functionality for all the buttons. You can test this by using xev. Install it if you don't have it.
Code:
$ sudo apt-get install xev
Then run it by typing xev. A window should open. Test all you mouse buttons on the screen. Your terminal should output something everytime you press a button. For example, if I pull the thumb-wheel towards myself, I get:
Code:
ButtonRelease event, serial 31, synthetic NO, window 0x3800001,
root 0x52, subw 0x0, time 1207998740, (66,85), root:(1000,153),
state 0x10, button 17, same_screen YES
This means the button is mapped as mouse button 17.
----------------------- MX Revolution buttons---------------------------
Here are all the button numbers, at least the ones I got:
Top-buttons
1: Left button
3: Right button
keycode 122: Search button
Thumb-buttons
8: "the button nearest to you"
9: "the button away from you
Top-wheel
4: Scroll-up
5: Scroll-down
6: Tilt-right
7: Tilt-left
Thumb-wheel
15: Pull
13: Push
17: Press
----------------------- VX Revolution buttons---------------------------
Top-buttons
1: Left button
3: Right button
Wheel
2: Press
4: Scroll-up
5: Scroll-down
6: Tilt-right
7: Tilt-left
Other buttons
8: Big thumb button
9: Small thumb button
13: Zoom slider +
14: Zoom slider -
Keycode 122: Search button
------------------------------------------------------------------------
Go ahead and map them as you like. It's great with Compiz (or Beryl). I mapped the thumbwheel to rotate the cube and the thumb buttons to rotate apps from one workspace to the other etc.
If you aren't using anything like Beryl and want to bind the buttons to keyboard shortcuts like "Alt+Tab", go look at detyabozhye's guide. Have a look at section 2 (part 1 and 3) where he shows you how to install and configure xvkbd and xbindkeys. This should help. I haven't tried it myself, so please let me know how it works out.
detyabozhye's guide also shows how to install configure lomoco. It's a utility to get increased resolution for the laser, the full 800dpi for an MX Revolution. However, as of writing this lomoco does not have support for the MX Revolution. I don't about VX's status, but I highly doubt there is support for it either.
Just remember that you might have to edit your udev rule if you plug in your RF receiver to a different USB port. In that case, you have to use the cat command like in step 2 to find the device location and edit the udev rule, replacing the old location with the new one and restarting udev+xserver.
Hope this helped.
------------------------------------------------------------------------
Optional tips and tricks:
Search button-> mouse wheel click
There is no mouse wheel click on the MX Revolution. One option is to bind it to the search button (below the top mouse wheel). There are several ways to do this, but using xkbset turns out to be the best approach. Thanks to NobodySpecial for bringing up xkbset and knn for polishing up the method.
1. Install xkbset:
Code:
sudo apt-get install xkbset
2. Open the mousekeys config file for editing:
Code:
sudo gedit /usr/X11R6/lib/X11/xkb/compat/mousekeys
3. Remove all text after the line "// Keypad actions" and before "// New Keysym Actions", and save the file. If you are unsure about what to remove, use this example from knn as a reference.
4. Use the following command to map the search button to mouse button 2:
Code:
echo "keycode 122 = Pointer_Button2" >> ~/.Xmodmap
5. Tell gconf to load the .Xmodmap at startup by giving these two commands:
Code:
gconftool-2 --list-type string --type list --set /desktop/gnome/peripherals/keyboard/general/known_file_list "[.Xmodmap]"
gconftool-2 --list-type string --type list --set /desktop/gnome/peripherals/keyboard/general/update_handlers "[.Xmodmap]"
7. Finally, add "xkbset m" to your sessions so it begins on startup (System -> Preferences -> Sessions->Startup Programs).
8. Now restart X (CTRL+ALT+BACKSPACE) and try clicking a link in Firefox with the search button. If the link opens up in a new tab, it worked.
Switch mouse wheel tilt functions
By default, tilting the mouse wheel left in Firefox goes forwards and tilting it right goes backwards in your page history. This is counter-intuitive. You can switch the directions of the tilts by adding a line to you ~/.Xmodmap file:
Add this line to the file:
Code:
pointer = 1 2 3 4 5 7 6 8 9 10 11 12 13 14 15 16 17 18 19 20
Now restart X (CTRL+ALT+BACKSPACE).
Mouse wheel tilt for horizontal scrolling
This tip is used to switch the mouse wheel tilt function to horizontal scroll in Firefox. Thanks to knn for suggesting this tip.
1. Go to about:config by typing "about:config" in the URL field of Firefox.
2. Set mousewheel.horizscroll.withnokey.action "Value" field to 0. NOTE: If you've swapped the wheel tilt buttons as described in the "Switch mouse wheel tilt functions" tip above, the direction will be reversed. In this case, change mousewheel.horizscroll.withnokey.numlines "Value" to 1.
EDIT1: Fixed mouse tilts. Thanks selari.
EDIT2: Added the udev rule step.
EDIT3: Added note about VX and its button numbers. Thanks Michał.
EDIT4: Howto changed to include VX.
EDIT5: Added note about lomoco.
EDIT6: Works in Edgy.
EDIT7: Added search button-> mouse-wheel click bind. Thanks MonkeyWrench32
EDIT8: Added mouse wheel tilt switch.
EDIT9: Changed the search button-> mouse-wheel click bind method. Thanks NobodySpecial and knn.
EDIT10: Added "Mouse wheel tilt for horizontal scrolling" tip. Thanks knn.
EDIT11: A completely new way to do the howto with btnx.