Genius Ergo 525 on Linux

I'm the owner of a Genius Ergo 525 mouse and I'm satisfied with it. Okay, the left button became unreliable after 4 years (the first one's scrollwheel after 3). I'd say it served me well.

It's working great out-of-the-box on Linux, except for two minor issues. The first one is the fact that the Forward and Back side-buttons are swapped. The second one isn't really an issue, but extra functionality which I wanted from the mouse: remapping the middle side button to "Refresh".

Forward/Back buttons

Swapping them to restore the expected functionality was pretty easy. First I used xinput to find out the number of available buttons on my mouse.

$ xinput get-button-map 8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The 8 after "get-button-map" is our device ID, which you can find out by running xinput without any arguments. Next you need to find out which number our Forward and Back buttons are. Run xinput with the "query-state" command while holding down the respective button.

$ xinput query-state 8
...
    button[7]=up
    button[8]=down
    button[9]=up
...

To swap the buttons, you can use xinput's "set-button-map" option. Just literally swap the 8 and 9 when you're entering the command.

$ xinput set-button-map 8 1 2 3 4 5 6 7 9 8 10 11 12 13 14 15

To make this behaviour permanent, you can run the above command on every login. I didn't like that, since I prefer having a neat Xorg configuration file instead. I added this section to my Xorg configuration file and it's working as intended. The MatchUSBID ID can be found out from the lsusb output. It's the two 4-character words separated by a colon.

Section "InputClass"
    Identifier "Ergo Mouse"
    MatchUSBID "0458:0087"
    Option "ButtonMapping" "1 2 3 4 5 6 7 9 8 10"
EndSection

Binding the other button to "Refresh"

I used udev to handle the binding. There's a nice guide on this blog. As explained in there, I used evtest to find out the scancode and added it into our udev hwdb file.

There was one important difference: the blog said to use keyboard:usb:vXXXXpXXXX*, but it didn't work for me. I found the solution on another blog. Using evdev:input:b*vXXXXpXXXX* worked perfectly. I don't know why, because I can't find any documentation online about that specific syntax.

Here's how my /etc/udev/hwdb.d/10-genius-mouse.hwdb looks like:

evdev:input:b*v0458p0087*
 KEYBOARD_KEY_90006=f5

Finally, you have to run these two commands to update the database:

udevadm hwdb --update
udevadm trigger