Difference between revisions of "Logitech MX Revolution"

From ArchWiki
Jump to: navigation, search
(Created page with '---- '''Originally Posted by NobodySpecial on the forums''' April 12, 2007: Many of us were using BTNX to run the buttons on the MX Revolution. But BTNX is now broken with the ...')
 
m (Configure file moved.)
(22 intermediate revisions by 12 users not shown)
Line 1: Line 1:
----
+
[[ru:Logitech MX Revolution]]
'''Originally Posted by NobodySpecial on the forums''' April 12, 2007:
+
[[Category:Mice]]
  
Many of us were using BTNX to run the buttons on the MX Revolution. But BTNX is now broken with the new XORG.  The good news is, the new XORG is good enough that you don't really need BTNX, for the most part.
+
Xorg is able to auto-detect this mouse just fine. However, it has a 17 key mapping:
  
Here's how I use mine.
+
  $ nano /etc/X11/xorg.conf
First, I'm not even using the evdev driver - I guess you could. But "mouse" works fine:
+
 
/etc/X11/xorg.conf
+
Edit your mouse section to say something like:
  
 
     Section "InputDevice"
 
     Section "InputDevice"
    Identifier   "MX Rev"
+
        Identifier "Mouse0"
    Driver       "mouse"
+
        Driver     "mouse"
    Option       "CorePointer"
+
        Option     "Protocol" "auto"
    Option       "Device"       "/dev/input/mice"
+
        Option     "Device" "/dev/input/mice"
    Option       "Protocol"        "auto"
+
        Option     "ZAxisMapping" "4 5"
    Option        "ZAxisMapping"       "4 5"
+
        #Option     "XAxisMapping" "6 7" #uncomment if you want horizontal scrolling with mouse wheel
    Option       "Emulate3Buttons"   "no"
+
        Option     "Buttons"   "17"
    Option       "Buttons"       "3"
+
 
     EndSection
 
     EndSection
  
To start, install a couple packages:
+
Next install the following packages
  
     sudo pacman -S xbindkeys xvkbd
+
     pacman -S xbindkeys xvkbd
  
Then find the buttons you want with xev and enter in ~/.xbindkeysrc
+
We'll put all of the settings into ~/.xbindkeysrc
My code under ~/.xbindkeysrc makes the thumb buttons go forward/back and also the middle mouse wheel rock left/right will change tabs in firefox:
+
  
 +
    touch ~/.xbindkeysrc
 +
    nano ~/.xbindkeysrc
  
     "/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[Left]""
+
 
 +
You'll want to put in ~/.xbindkeysrc events to send to xvkbd. Here is a sample:
 +
 
 +
     "/usr/bin/xvkbd -text "\[Alt_L]\[Left]""
 
       m:0x0 + b:8
 
       m:0x0 + b:8
     "/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[Right]""
+
     "/usr/bin/xvkbd -text "\[Alt_L]\[Right]""
 
       m:0x0 + b:9
 
       m:0x0 + b:9
     "/usr/bin/xvkbd -xsendevent -text "\[Control_L]\[Page_Up]""
+
     "/usr/bin/xvkbd -text "\[Control_L]\[Page_Up]""
 
       m:0x0 + b:6
 
       m:0x0 + b:6
     "/usr/bin/xvkbd -xsendevent -text "\[Control_L]\[Page_Down]""
+
     "/usr/bin/xvkbd -text "\[Control_L]\[Page_Down]""
 
       m:0x0 + b:7
 
       m:0x0 + b:7
  
To automate, add /usr/bin/xbindkeys to System -> Pref -> Sessions.
+
For some reason some combinations of keyboard events refuse to work with certain buttons for me.
Next, I like the left-sided wheel to rotate the desktop in compiz:
+
 
Compiz Settings -> Desktop -> Rotate Cube -> Bindings -> Initate "Button17", Rotate Left "Button13", Rotate Right "Button15"
+
m:0x0 refers to your first mouse. The "+b:8" refers to the button you push. Here is a list of all the buttons:
Finally, its annoying to me that the middle button below the scroll wheel is set to "search". Its far handier to have it as the middle mouse click. The only way I found to do this is through Xmodmap, which isn't ideal, but works (PLEASE post here if you know a better way).
+
 
To list xmodmap keys: xmodmap -pk  OR  xmodmap -pke
+
    # Mappings for keys for MX Revo
Under xev above, my button gives "keycode 225", so I do this:
+
    # b:1 - left mouse button
 +
    # b:2 - left and right mouse button together
 +
    # b:3 - right mouse button
 +
    # b:4 - mouse wheel up
 +
    # b:5 - mouse wheel down
 +
    # b:6 - mouse wheel left
 +
    # b:7 - mouse wheel right
 +
    # b:8 - back button
 +
    # b:9 - forward button
 +
    # b:10 - -none-
 +
    # b:11 - -none-
 +
    # b:12 - -none-
 +
    # b:13 - media wheel up
 +
    # b:14 - -none-
 +
    # b:15 - media wheel down
 +
    # b:16 - -none-
 +
    # b:17 - media wheel press
 +
 
 +
To remap the seach button to something instead of search, put something along the lines of the following into ~/.xbindkeysrc
 +
Example here is to remap it to alt+f4 to close a window.
 +
 
 +
    "/usr/bin/xvkbd -text "\[Alt_L]\[F4]""
 +
    c:0xE1
 +
 
 +
Alternatively, Gnome will recognize the small middle search button as a keyboard event. Thus, you just have to go into keyboard shortcuts and remap that to something. This is probably the most reliable way to go about using this key.
 +
 
 +
It is possible to use xmodmap to register the button press as a middle click. Begin by assigning the key event to Pointer_Button 2.
 +
 
 +
    echo "keycode 225 = Pointer_Button2" >> ~/.Xmodmap
 +
 
 +
Now, just create a startup script that feeds that input into xmodmap when your window manager starts. In KDE4 create ~/.kde4/Autostart/middleclick with the following contents.
  
     echo "keycode 225 = Pointer_Button2" >> ~/.xmodmaprc
+
     #!/bin/sh
 +
    xmodmap ~/.Xmodmap
  
Log out and in again - gnome should autodetect the ~/.xmodmaprc file.
+
And do not forget to give it execute permissions.
The trick only works when "mousekeys" are on.
+
So either gnome-keyboard-properties -> Mousekeys -> Enable pointer OR toggle with SHIFT-ALT-NUMLOCK (you want to be able to toggle so you can use the numeric keypad at times).
+
However, the xmodmap trick has one more issue - it messes up keybindings in vmware. This solved it for me:
+
  
     su
+
     chmod +x ~/.kde4/Autostart/middleclick
    echo "xkeymap.nokeycodeMap = true" >> /etc/vmware/config
+
  
----
+
The trick only works when "mousekeys" are on. So either gnome-keyboard-properties -> Mousekeys -> Enable pointer OR toggle with SHIFT-ALT-NUMLOCK (you want to be able to toggle so you can use the numeric keypad at times). Or in KDE System Settings -> Keyboard & Mouse -> Mouse -> Mouse Navigation -> Check "Move pointer with keyboard (using the num pad)"
'''Originally Posted by WCentauri on the forums''' August 14, 2008:
+
  
I suggest a slightly different way to handle the mapping of the search button to middle click.  The output from xev lists the button as XF86Search, and it can also be referenced as c:0xE1.  It should be possible to map the search button with xbindkeys by referring to c:0xE1 or XF86Search and using the xmacro package available in the AUR. The corresponding entry for xbindkeys is
+
Lastly, add xbindkeys to your startup and you should be good to go.
  
    "echo 'ButtonPress 2 ButtonRelease 2' | xmacroplay :0"
 
      c:0xE1
 
  
I'm not sure that xvkbd can remap mouse buttons.  Perhaps this is why xmodmap was used in the first place. xmacro can handle keyboard and mouse buttons, so the other entries in .xbindkeysrc could be transformed to xmacroplay callsI don't have a compelling reason (besides aesthetics) for doing so, other than anecdotal claims that xmacro has less overhead than xmacroThis may or may not be true, and it may not matter for practical purposes anyway.
+
The best way to map the search button to middle click is to add the following two lines to {{ic|/etc/sysctl.d/50-mouse.conf}}:
 +
# Enable mouse button emulation
 +
dev.mac_hid.mouse_button_emulation = 1
 +
  # Set 2nd button to 217 - the middle button of MX Revolution mouse.
 +
  dev.mac_hid.mouse_button2_keycode = 217
  
There is a big thread ([http://ubuntuforums.org/showthread.php?t=968530&highlight=btnx]) brewing on the Ubuntu forums about the death of btnx, and that is where this technique comes from.
+
== Mouse Wheel Mode ==
 +
In order to enable or disable mouse wheel's free spinning, you can use [https://aur.archlinux.org/packages.php?ID=8436 revoco]. Giving the following command from shell, or, alternatively, putting it in a script executed at the startup should enable/disable free spinning.
 +
# revoco free  # in order to enable free spinning
 +
# revoco click # in order to disable free spinning
 +
More Info can be found [http://www.toosweettobesour.com/2009/05/13/logitech-mx-revolution-revoco-in-ubuntu-904-jaunty-click-to-click-even-after-a-resumewakeup/ here]

Revision as of 12:23, 13 November 2013


Xorg is able to auto-detect this mouse just fine. However, it has a 17 key mapping:

$ nano /etc/X11/xorg.conf

Edit your mouse section to say something like:

   Section "InputDevice"
       Identifier  "Mouse0"
       Driver      "mouse"
       Option      "Protocol" "auto"
       Option      "Device" "/dev/input/mice"
       Option      "ZAxisMapping" "4 5"
       #Option      "XAxisMapping" "6 7"  #uncomment if you want horizontal scrolling with mouse wheel
       Option      "Buttons"    "17"
   EndSection

Next install the following packages

   pacman -S xbindkeys xvkbd

We'll put all of the settings into ~/.xbindkeysrc

   touch ~/.xbindkeysrc
   nano ~/.xbindkeysrc


You'll want to put in ~/.xbindkeysrc events to send to xvkbd. Here is a sample:

   "/usr/bin/xvkbd -text "\[Alt_L]\[Left]""
     m:0x0 + b:8
   "/usr/bin/xvkbd -text "\[Alt_L]\[Right]""
     m:0x0 + b:9
   "/usr/bin/xvkbd -text "\[Control_L]\[Page_Up]""
     m:0x0 + b:6
   "/usr/bin/xvkbd -text "\[Control_L]\[Page_Down]""
     m:0x0 + b:7

For some reason some combinations of keyboard events refuse to work with certain buttons for me.

m:0x0 refers to your first mouse. The "+b:8" refers to the button you push. Here is a list of all the buttons:

   # Mappings for keys for MX Revo
   # b:1	-	left mouse button
   # b:2	-	left and right mouse button together
   # b:3 	-	right mouse button
   # b:4	-	mouse wheel up
   # b:5	-	mouse wheel down
   # b:6	-	mouse wheel left
   # b:7	-	mouse wheel right
   # b:8	-	back button
   # b:9	-	forward button
   # b:10	-	-none-
   # b:11	-	-none-
   # b:12	-	-none-
   # b:13	-	media wheel up
   # b:14	-	-none-
   # b:15	-	media wheel down
   # b:16	-	-none-
   # b:17	-	media wheel press

To remap the seach button to something instead of search, put something along the lines of the following into ~/.xbindkeysrc Example here is to remap it to alt+f4 to close a window.

   "/usr/bin/xvkbd -text "\[Alt_L]\[F4]""
   c:0xE1

Alternatively, Gnome will recognize the small middle search button as a keyboard event. Thus, you just have to go into keyboard shortcuts and remap that to something. This is probably the most reliable way to go about using this key.

It is possible to use xmodmap to register the button press as a middle click. Begin by assigning the key event to Pointer_Button 2.

   echo "keycode 225 = Pointer_Button2" >> ~/.Xmodmap

Now, just create a startup script that feeds that input into xmodmap when your window manager starts. In KDE4 create ~/.kde4/Autostart/middleclick with the following contents.

   #!/bin/sh 
   xmodmap ~/.Xmodmap

And do not forget to give it execute permissions.

   chmod +x ~/.kde4/Autostart/middleclick

The trick only works when "mousekeys" are on. So either gnome-keyboard-properties -> Mousekeys -> Enable pointer OR toggle with SHIFT-ALT-NUMLOCK (you want to be able to toggle so you can use the numeric keypad at times). Or in KDE System Settings -> Keyboard & Mouse -> Mouse -> Mouse Navigation -> Check "Move pointer with keyboard (using the num pad)"

Lastly, add xbindkeys to your startup and you should be good to go.


The best way to map the search button to middle click is to add the following two lines to /etc/sysctl.d/50-mouse.conf:

# Enable mouse button emulation
dev.mac_hid.mouse_button_emulation = 1
# Set 2nd button to 217 - the middle button of MX Revolution mouse.
dev.mac_hid.mouse_button2_keycode = 217

Mouse Wheel Mode

In order to enable or disable mouse wheel's free spinning, you can use revoco. Giving the following command from shell, or, alternatively, putting it in a script executed at the startup should enable/disable free spinning.

# revoco free  # in order to enable free spinning
# revoco click # in order to disable free spinning

More Info can be found here