HOWTO: Logitech MX Revolution in Dapper
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 :rolleyes: 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.
Re: HOWTO: Logitech MX Revolution in Dapper
The buttons for the top wheel on my mouse are different than yours. Clicking the wheel isn't a button, but just changes the locking mechanism inside the mouse. Tilting the wheel to the left is 7 and to the right is 6.
Re: HOWTO: Logitech MX Revolution in Dapper
Quote:
The buttons for the top wheel on my mouse are different than yours. Clicking the wheel isn't a button, but just changes the locking mechanism inside the mouse. Tilting the wheel to the left is 7 and to the right is 6.
I forgot the tilt-buttons, I'll add them. And yes, you are right about the clicking. I mistook the click output on xev as button 7, when in fact I had tilted the wheel while pressing it. I'll fix this too.
A lot of other corrections are needed, this is the first time I've been able to edit the howto since I posted it. Figured out a bit afterwards (including the mistaken click-tilt thing).
Re: HOWTO: Logitech MX Revolution in Dapper
selari,
What did you do for the xorg.conf device section for the MX Revolution? Did you simply use a changing event number or did you make a udev? The udev method described as of now in the howto binds the MX Revolution USB receiver to a physical location, which means it can't be unplugged.
Or have you figured out something better?
Re: HOWTO: Logitech MX Revolution in Dapper
Hey Daou,
Thanks for the guide - very much appreciated.
Xev reports all the same button config's as yours.
As I'm a Ubun00b - could you please advise how and what you have mapped your mouse buttons to?:oops:
I can't for the life of me get the buttons to do anything. Ideally what I'd like to achieve:
Top-buttons
1: Left button = Single left click
3: Right button = Single right click
keycode 122: Search button = Open Firefox
Thumb-buttons
8: "the button nearest to you" = Double click
9: "the button away from you = Close app/Alt+F4
Top-wheel
4: Scroll-up = As is
5: Scroll-down = As is
6: Tilt-right = Scroll left
7: Tilt-left = Scroll right
Thumb-wheel
15: Pull = Minimize app
13: Push = Ctrl + Tab (Which will change active tab in Firefox)
17: Press = Open Nautilus home folder
Or am I completely dreaming, when I hope for this type of functionality? Are any of these do-able?:confused:
BTW I'm not using XGL/Compiz.
Cheers again,
Web Footed Chicken
Re: HOWTO: Logitech MX Revolution in Dapper
webfootedchicken,
I'm glad the howto helped.
detyabozhye's guide shows how to assign functionality to the buttons once they are recognized. Have a look at section 2 (part 1 and 3, I don't believe the cruise control is meant for MX Revo.) where he shows you how to install and configure xvkbd and xbindkeys. This should help.
Beryl (Compiz) provides an easy way to map buttons to functions so I haven't tried this myself. I ran out of buttons after mapping mine to useful Beryl functions :rolleyes: so I haven't tried the xvkbd and xbindkeys yet.
But I would image it will work for the MX Revo as well. Just fill in your correct mouse button number in the "b:#" parts and change the keyboard shortcut it calls (in his example, ALT+RIGHT).
A quick fix for the search button->firefox: go to System->Preferences->Keyboard Shortcuts. In the dialog, click on the text next to "Launch web browser" and then click the search button. It should map the function to a button "0x7a" which is hexadecimal for 122. That was the keycode your search button had. Worked for me.
Let me know what happens. If the method works, I'll add it to the howto. If it doesn't, I'll see if I can make it work.
Re: HOWTO: Logitech MX Revolution in Dapper
Thanks for the guide.
If any of you is wishing to get a "smaller" Revolution VX - the same guide applies to you, with the only difference being the key numbering.
So, for the VX:
button placement
1 left
2 wheel press
3 right
4 wheel up
5 wheel down
6 wheel right
7 wheel left
8 big thumb button
9 small thumb button
13 zoom slider +
14 zoom slider -
Binding to various beryl functionalities is a bliss.
Michal, playing with the new mouse...
Re: HOWTO: Logitech MX Revolution in Dapper
Quote:
Thanks for the guide.
You're most welcome.
Quote:
If any of you is wishing to get a "smaller" Revolution VX - the same guide applies to you, with the only difference being the key numbering.
I'll add a note about this in the howto and add the button numbers for the VX . But first, could you tell what Vendor, Product, and Version ID you get for VX Revolution with the "cat /proc/bus/input/devices" command? Also the name, if it is something other than "Logitech USB Receiver".
Actually, if you would give me the whole output for VX, would be much appreciated.
Re: HOWTO: Logitech MX Revolution in Dapper
Sure, I'll post when I get back home.
As for the numbers:
Vendor stays 046d, the rest I'll check.
Logitech USB receiver stays the same, too.
Small update for the layout:
search button on VX is of course keycode 122.
As for my laptop - the udev rule is perfectly valid and working even if I turn off my mouse and/or remove the receiver, as long as I plug it back into the same USB socket (I may have misunderstood that it won't be that good when unplugging :)). No worries when booting, no issues with the touchpad, too (which is redundant information, but may be encouraging for the frightened - even if you screw up your Rev config, the touchpad may save you).
I would underline that it's blahblah/input0 which is the real mouse.
blahblah/input1 is this (a bit weird) one-button keyboard being the search button.
On a VX switching between ratcheted and freewheel wheel is only manual (using a small lever underneath). No auto mode foreseen, but clicking the wheel is back normal :)
Cheers
Michal (sorry, my screen name here is just my usual login name, no fancy nickname)
Re: HOWTO: Logitech MX Revolution in Dapper
logitech revolution VX portion of /proc/bus/input/devices:
I: Bus=0003 Vendor=046d Product=c518 Version=4204
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.1-1/input0
S: Sysfs=/class/input/input7
H: Handlers=mouse2 event4 ts2<-This is the mouse
B: EV=7
B: KEY=ffff0000 0 0 0 0 0 0 0 0
B: REL=143
I: Bus=0003 Vendor=046d Product=c518 Version=4204
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.1-1/input1
S: Sysfs=/class/input/input8
H: Handlers=kbd event5 <-and this is the search button
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