12/18/2009

How to Remap Input Devices Button on Ubuntu - Using Kensington Expert Mouse as Example

Using Kensington Expert Mouse in Ubuntu

The default button mapping is hard to use, but there is no driver or utility to configure it. We can use xinput to change the button mapping.

First we have to find the device name of the mouse.
[list all plugged input devices]
$ xinput list

You will find the device named "Kensington Kensington Expert Mouse"(Notes, there is 6 blank characters between those two Kensington). That's the device we want to configure. Then try to get the button map of the device.
[get button map - print out all button id]
$ xinput get-button-map "Kensington Kensington Expert Mouse"

The result shows it has 12 buttons mapped, but we don't know the mapping to actual buttons. You can click on a button then use the following command to check whick id was in down state.
[query device state - print out button up or down]
$ xinput query-state "Kensington Kensington Expert Mouse"

Now we can remap the button mapping. In this case I want to set the right-upper button to be the "right button" of a regular mouse. so I use the following command.
[Set button map - setting button mapping]
$ xinput set-button-map "Kensington Kensington Expert Mouse" 1 2 3 4 5 6 7 3 9 10 11 12

Btw, If you want to know the vendor id or product id, use the following command.
vendor_id and product_id
$ cat /proc/bus/input/devices

沒有留言: