Sunday, February 19, 2012

Linux: Razer Diamondback


There are probably not many people that still use the Razer Diamondback optical mouse. And unfortunetaly Razer do not make these models anymore. Which is a damn shame since I have broken all of their other models, but my first original Diamondback is still in one piece which is suprising considering that it has take a lot more abuse than all of the other models I own.

Anyway I've noticed that the back and forward buttons on the mouse is mapped incorrectly. Usually the back and forward functions are mapped to the two buttons on either side of the mouse. Most commonly on the left side. However on my desktop I move backwards with one button the left side of the mouse and forward with one button the right side of the mouse. This needs to be fixed and I'll tell you how to do it here.


First we need to figure out which id your mouse has.
$ xinput list

For me this list looks something like this. Notice that the “id” number of my device is “12”.
$ Virtual core pointer id=2 [master pointer (3)]
$ Virtual core XTEST pointer id=4 [slave pointer (2)]
$ Razer Razer Diamondback Optical Mouse id=12 [slave pointer (2)]
$ Wacom Intuos3 6x8 id=13 [slave pointer (2)]
$ Logitech USB Receiver id=15 [slave pointer (2)]

Now we can input this into the terminal to remap our buttons. Change the first value which for me is “12”. Naturally you should change the number to match whatever id number your device has on your system.
$ xinput -set-button-map 12 1 2 3 4 5 6 7 9 10 8 11 12 13 14 15

What we did above here is nothing special we just rearranged the button order, which you can easily see by looking at the line above. By default all of the numbers are in a consecutive order however that creates the wrong button mapping for our Razer Diamondback mouse. To solve that I've simply rearranged button numbers 8-10 to work the way I want it to work.

You can quickly figure out which numbering your buttons have by running the command “xev” in a terminal. Then you must move your cursor inside the “xev” window and press whatever button you want to see the corresponding number in the terminal. However do not place your cursor inside the little black frame, that will give us another value used for something else.

Technically you can use this method to remap any mouse buttons on any mouse you have. The only thing that differs between all of the mice is the button numbering. However I do not need to do this with any of my other Razer mouses or even Logitech mouses, they behave correctly by default.

No comments:

Post a Comment