Logitech MX-310 Mouse and Fedora Core

Okay, this was the second time I had to figure out how to get this type of mouse to fully function under Fedora, so it must be time to write up a quick howto, so that I will never again even have a need to know anything about doing anything to get a mouse to do anything.

I recently got a Logitech MX-310 mouse. It's got 5 buttons and a wheel. It is cool looking. It is a USB mouse, but I am using it with a PS/2 connector in order to minimize the USB devices I have to rely upon, because I don't trust USB to ever get anything right. Here are the complications Fedora threw me, and the fixes for them. I'm not sure if it matters, but the motherboard to which I'm connecting this mouse is an Asus P4R-800V Deluxe.

Problem #1: The mouse totally doesn't work at all

Bummer, huh? When running a 2.4 kernel (Red Hat Enterprise 3), it worked fine, no troubles. With a 2.6 kernel, as in Fedora Core 2 and up or RHEL 4, X would boot, but wiggling the mouse around didn't make the cursor move. No buttons, nothing. Just a big, dumb pointer, sitting in the middle of the screen, laughing at me. Even GPM on the text console didn't work. The first stupid thought that came into my head from years of experience getting hardware to work was: "Duh, unplug it and plug it in again." This turned out to be not so stupid, as it made the mouse work.

This is from /proc/bus/input/devices before unplugging it:

I: Bus=0011 Vendor=0002 Product=0001 Version=0000
N: Name="PS/2 Generic Mouse"
P: Phys=isa0060/serio1/input0
H: Handlers=mouse0 event1 
B: EV=7 
B: KEY=70000 0 0 0 0 0 0 0 0 
B: REL=3

...and this is afterward:

I: Bus=0011 Vendor=0002 Product=0006 Version=0072
N: Name="ImExPS/2 Logitech MX Mouse"
P: Phys=isa0060/serio1/input0
H: Handlers=mouse0 event1 
B: EV=7 
B: KEY=9f0000 0 0 0 0 0 0 0 0 
B: REL=103

See? It looks much happier. That's an input device that knows who it is and what it wants out of life.

Ultimately, though, reaching behind your machine to reconnect your mouse gets old, no matter how rarely you reboot. I checked out some kernel parameters, and this one seemed to help:


Add that to the kernel line(s) in grub.conf, and Bob's yer uncle. The /proc/bus/devices/input output now looks like this:

I: Bus=0011 Vendor=0002 Product=0006 Version=0000
N: Name="ImExPS/2 Generic Explorer Mouse"
P: Phys=isa0060/serio1/input0
H: Handlers=mouse0 event1 
B: EV=7 
B: KEY=1f0000 0 0 0 0 0 0 0 0 
B: REL=103 

...which is not quite the same as after unplugging/replugging the mouse as above, but what the hell, now it works, without having to unplug and replug. For me, at least.

Problem #2: The side buttons don't work

Right, this gets a little more involved. The expected behavior is that the left button works as the left button, the right button works as the right button, the wheel scrolls things up and down, clicking the wheel works as the "middle" button and usually pastes things, and the side buttons should scroll to the sides. The actual behavior, however, is that the side buttons initially do nothing.

To get them to do anything, you need this in xorg.conf:

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Device" "/dev/input/mice"
        Option     "Protocol" "ExplorerPS/2"
        Option     "ZAxisMapping" "6 7"
        Option     "Emulate3Buttons" "false"
        Option     "Buttons" "7"
        Option     "SendCoreEvents" "true"

This will seem to fuck things up even worse, but it sets the stage for getting everything completely unfucked. Before, x.org thought I only had a 5-button mouse. Now, it's expecting 7. This changes the buttons such that now the side buttons are scrolling things up and down instead of the wheel. To complete the fix, it's necessary to swap around the side buttons and the wheel in how x.org sees them. Add this to your .Xmodmap (or whatever bizarre place you keep your xmodmap settings in):

pointer = 1 2 3 6 7 4 5

This made some degree of perverted sense the first time I did it. The second time, it seems retardedly esoteric, and by now I've entirely forgotten all of the reasoning behind it, noting only that It Works. You could read the fine xmodmap(1) manual if you care about why.

There is yet another button, in the middle, in front of the wheel. I have no idea what this button is even supposed to do, much less how to make it do it. Quite frankly, I'm happy with it doing nothing, as there are already more than enough buttons on this thing, and I've grown to like having one button to click on that does nothing.

Good luck.

More notes