# [SOLVED] Logitech MX Revolution - Scroll Wheel Behavior

## jk3us

I'm quite suprised I can't find any discussion on this here (or anywhere)....

I just got the Logitech MX Revolution Mouse, and have most of the buttons working.  The big problem I'm having is the scroll wheel.  The default behavior of a scroll wheel click is to switch the wheel from "click-to-click" mode to the hyperspeed scroll mode, not sending any events to the computer.  This alone is almost a deal breaker for me; the middle click is my best friend.  

Under windows, using Logitech's SetPoint Software, you can change the behavior of clicking the scroll wheel (windows actually sends some commands to change how the mouse physically and electronically acts, not just contol how the OS responds to events sent from the mouse).  Has anyone figured out how to get that same control in linux?Last edited by jk3us on Tue Nov 28, 2006 1:03 am; edited 2 times in total

----------

## jk3us

Anyone?  Does anyone have this and use it in linux?  How do you get by with no middle click / paste button?

----------

## johoe

I've got this mouse and have the same behavior. Maybe you can try it with the "mouse" driver and Emulate3Buttons or you can remap the "search button" to emulate a middle click.

Also see my post: https://forums.gentoo.org/viewtopic-t-502426-highlight-revolution.html - I would be interessted in your config files...

  johoe

----------

## jk3us

Using the search button as middle click wouldn't be so bad... but right now that button is sending a keycode event (keycode 122).  How would I go about mapping that to mouse button 2?

As far as my config, I would paste it in from my console, but my middle click doesn't work to paste it  :Sad: 

----------

## johoe

Fast solution for the moment:

```
    Driver      "mouse"

    Option "Protocol"    "auto"

    Option "Device"   "/dev/input/mouse0"

    Option "Emulate3Buttons"

```

with this config you loose your tilt wheel buttons but can "emulate" the middle click by pressing buttons 1 and 2 at the same time...

johoe

----------

## jk3us

I was playing around with this some more today.... My plan was to plug the receiver into the windows box, and get the mouse set up just so, then take the mouse far away so it couldn't recieve any more commands, plug it back into this box, and bring the mouse back, hoping that it would remain in that configuration.

However, When I got far enough away, the mouse went back into the default configuration where a click of the wheel toggles the clickiness instead of sending a button 2 event.  Seems like that would require kernel/driver modification instead of just a program like logitech-applet to get this working right.  That's pretty frustrating.

So, is there a way to may a keypress (the search button) to a mouse button so I can have a middle mouse button?  I don't really like the emulate3buttons solution.

If a dev is interested in writing the drivers/software required to get it to work, I'd be willing to chip to help you buy the mouse.

----------

## jk3us

 *jk3us wrote:*   

> If a dev is interested in writing the drivers/software required to get it to work, I'd be willing to chip to help you buy the mouse.

 

Allow me to answer my own question (I think): from http://www.jwz.org/xkeycaps/man.html

 *Quote:*   

> It is also not possible to make a keyboard key behave as a mouse button.

 

So, no mapping the search "button" (keycode 122) to mouse button 2.

----------

## johoe

But you can emulate a mouse button click with the keyboard. Shift-NumLock enables mouse keys on your numpad. Use 2/4/6/8 as down/left/up/right, respectively. 5 clicks a mouse button, + toggles whether it's the left or right one. * produces a middle-click.

You can even emulate double clicks.

  johoe

----------

## lucida

got this mouse in aug, and i finally decide to fix the middle button thing today...so here is the result.

this a quick and dirty hack, anyway, it works fine, at least in my system   :Razz:   :Razz: 

```

This program is ripped from joymouse-linux(http://sourceforge.net/projects/joymouse-linux)

All credit goes to the original author

A quick and dirty hack to make MX Revolution "Search button" works

as middle click

1. Compile it by 

"gcc memu.c -o memu"

2. As root, set suid(not safe, need fix) 

"chmod u+s memu" 

"cp memu /usr/local/bin"

3. Install xbindkeys

4. add

    "memu 2"

        m:0x10 + c:122

to ~/.xbindkeysrc

The parameter is which button the program needs to generate, 2 stands for middle button.

5. Configure xorg.conf(from "man joymouse")

       Add these lines to your /etc/X11/xorg.conf :

           Section "InputDevice"

               Identifier   "Joystick"

               Driver      "mouse"

               Option      "Protocol"       "ExplorerPS/2"

               Option      "Device"         "/dev/mxmouse"

               Option      "SendCoreEvents" "true"

               Option      "ZAxisMapping"       "4 5 6 7"

           EndSection

       In  the  "ServerLayout"  section  you  should have 2 InputDevice lines,

       i.e.:

           InputDevice "Mouse"      "CorePointer"

           InputDevice "Joystick"

6. Restart X, and run xbindkeys

```

```

/*

/*

##############################################

Rip from joymouse-linux(http://sourceforge.net/projects/joymouse-linux) 

All credit goes to the original author                                   

                                                                         

for more info and usage, check README                                              

lucida_at_gmail_dot_com                                                  

10/08/2006                                                               

##############################################

*/

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <string.h>

#include <linux/joystick.h>

#include <fcntl.h>

#include <sys/ioctl.h>

#include <sys/stat.h>

#include <errno.h>

#include <signal.h>

#include <math.h>

static char *fout="/dev/mxmouse";

int WriteMouseData(int fd,char x,char y,int zx,int zy,unsigned char buttons)

{   /* Write all the data in a certain format to the given file */

#if (1) /* This is ImPS/2 or ExplorerPS/2, not quite sure :-S */

   char data[4];

   data[0]=(0x08)|(buttons&0x07)|((x<0)?0x10:0)|((y<0)?0x20:0);

   data[1]=x;

   data[2]=y;

   data[3]=0x00;

   if (zx)data[3]|=(zx<0)?2:-2;

   if (zy)data[3]|=(zy<0)?1:-1;

#endif

   if (write(fd,data,sizeof(data))!=sizeof(data))return 0;

   return 1;

}

int main(int argc, char *argv[])

{

   int i;

   int fdout;

   int e=mkfifo(fout, 0666);

   fdout=open(fout,O_RDWR|O_SYNC);

   i = atoi(argv[1])-1;

        WriteMouseData(fdout, 0,0,0,0,2<<i);

        WriteMouseData(fdout, 0,0,0,0,0);

   close(fdout);

    return EXIT_SUCCESS;

}

```

----------

## jk3us

I found the mvmouse program that does the trick (just a little slower than an actual click): http://hocwp.free.fr/movemouse.html .  It's the mvmouse version (not movemouse) that can do clicks.... I Don't do french, but it works

----------

## lucida

I searched..but didnt find this program.  :Sad: 

anyway, my hack works pretty well, and cant feel any delay. It seems that "MicroGear"  cant be set under Linux at all, xev reports nothing when press the wheel down.

----------

## jk3us

I just came across a little program that does exactly what I need:  http://goron.de/~froese/revoco-0.1.tar.gz .  It allows you to switch between click and free, and/or let's you assign a button that will toggle (ie, change it from middle click).  You do have to have HID and the /dev/usb/hiddevX device file support turned on in your kernel for it to work.  and you need to run it as root, I just put '/path/to/revoco manual=6' in /etc/conf.d/local.start, which makes the search button toggle it, and returns real middle click functionality.

And here's a post from a gentoo dev about it, indicating that it will eventually be in portage: http://planet.gentoo.org/developers/betelgeuse/2006/11/26/getting_mx_revolution_setup_in_gentoo .  

Anyway... with this little utility makes the mx revolution the best mouse I've ever owned... I don't think I have any other complaints about it... marking solved.

----------

## thewhale

I have discovered a simple workaround for mapping the 'search' button to 'middle click':

1. Add

```
keycode 122 = Pointer_Button2
```

 to your ~/.Xmodmap file and make sure it's considered when X starts.

2. Press

```
SHIFT+NUMLOCK
```

(or

```
SHIFT+FN+NUMLOCK
```

on a laptop) once X is up.

A bit klugdy, I know, but it works for now.

----------

## thewhale

Upon further investigation, I have come up with a more permanent solution, involving only standard tools, for the remapping problem:

You will need xte, xset and xbindkeys; thus

```
emerge xautomation xset xbindkeys
```

Remap the offending keycode (122) to an unused key (e. g. F20) by modifying your ~/.Xmodmap file:

```
keycode 122 = F20
```

Make sure this file is considered when X starts.

Add the following lines to your ~/.xbindkeysrc file:

```
"xte 'mousedown 2'"

    F20

"xte 'mouseup 2'"

    F20+Release
```

Make sure xbindkeys is started when X starts.

Make sure

```
xset -r 122
```

is executed when X starts.

These steps will map the search key of your Logitech Revolution to mouse button 2.

----------

## johoe

Hi arround there - found another great tool for the MX Revolution, which lets you configure the middle wheel:

http://goron.de/~froese/revoco/revoco-0.3.tar.gz

Here the usage help:

```
Usage:

  revoco free                      free spinning mode

  revoco click                     click-to-click mode

  revoco manual[=button[,button]]  manual mode change via button

  revoco auto[=speed[,speed]]      automatic mode change (up, down)

Prefixing the mode with 'temp-' (i.e. temp-free) switches the mode

temporarily, otherwise it becomes the default mode after power up.

Button numbers:

  0 previously set button   7 wheel left tilt

  3 middle (wheel button)   8 wheel right tilt

  4 rear thumb button       9 thumb wheel forward

  5 front thumb button     11 thumb wheel backward

  6 find button            13 thumb wheel pressed
```

For this we'va all been waiting for. Hope you find this useful...

johoe

----------

## funeagle

thewhale thanks for the tip, this is exactly what I needed. I wanted the search button to work as the middle click and use the numeric keypad as well  :Smile: 

You are my hero today!

----------

