Skip to:

Making the Mad Catz R.A.T.7 Contagion gaming mouse not suck in X11

I have done this several times, across multiple installs on my desktop, laptop and work computer.

The Mad Catz R.A.T.7 is a great mouse that I bought on a whim not because I'm much of a gamer (I'm not) but because it fit my hand and I felt a pang of Retail Acquisition Syndrome while looking at the damn thing. It turns out that the selectable DPI setting is great for switching between a Linux desktop machine and the OSX at work. I could never get the standard acceleration setting in OSX to behave like I wanted, but turning the DPI down in hardware on my mouse worked great!

Anyway, this mouse has 17 buttons, and X11 freaks out because some of them do not generate a ButtonRelease event.

I have searched for the correct X11 config file for the Cyborg R.A.T7 mouse a few times and I have found different X11 configs for it. Here is mine:

Section "InputClass"
    Identifier "R.A.T.7 Mouse"
    MatchProduct "R.A.T.7"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "Buttons" "17"
    # 1 2 3 4 5 - standard mouse buttons
    # RAT7 has no button 6 or 7 which are horizontal scroll...
    # The horizontal scroll buttons on this mouse map to
    # 10 and 11, we remap the 10 signal to 7 and the 11 to 6
    # by putting 7 in the 10th position and 6 in the 11th position
    # The remaining buttons should never generate key presses,
    # so we set to 0

    # the profile switcher on the RAT 7 generates 2 key presses,
    # using buttons 13 14 15.
    # This gives 3 combinations: 13,14 13,15 and 14,15.
    # These are used by the driver to switch mouse profiles
    Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 7 6 0 0 0 0 0 0"
    Option "ZAxisMapping" "4 5 6 7"
EndSection

Positions 10, 11 correspond to the horizontal scroll that my mouse is sending to X11. Signal 12-17 are for the sensitivity up/down and mode switch buttons.

As mentioned in the comments in my X config, buttons 13, 14 and 15 are used for the profile/mode switcher button. The mouse sends two keypresses for each press of the button, one to disable the previous mode and enable the new mode. So, you may see signal 13 and 14, 14 and 15 or 15 and 13, as the mouse cycles through the modes. It's a clever idea, but it does not play well with X11.