3

I have Razer DeathAdder(left handed edition) and A4Tech wireless mouse. My problem is I don't know how to change wireless mouse keymapping(swaping left/right click). Can somebody guide me how to do such thing?

List of my devices:

⎡ Virtual core pointer                       id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=8    [slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder                    id=11   [slave  pointer  (2)]
⎜   ↳ A4TECH USB Device                         id=12   [slave  pointer  (2)]
⎜   ↳ A4TECH USB Device                         id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Logitech USB Keyboard                     id=9    [slave  keyboard (3)]
    ↳ Logitech USB Keyboard                     id=10   [slave  keyboard (3)]

This is my Razer xinput:

Device 'Razer Razer DeathAdder':
    Device Enabled (121):   1
    Coordinate Transformation Matrix (123): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (246): 0
    Device Accel Constant Deceleration (247):   5.000000
    Device Accel Adaptive Deceleration (248):   1.000000
    Device Accel Velocity Scaling (249):    10.000000
    Device Product ID (240):    5426, 22
    Device Node (241):  "/dev/input/event4"
    Evdev Axis Inversion (250): 0, 0
    Evdev Axes Swap (252):  0
    Axis Labels (253):  "Rel X" (131), "Rel Y" (132), "Rel Vert Wheel" (274)
    Button Labels (254):    "Button Left" (124), "Button Middle" (125), "Button Right" (126), "Button Wheel Up" (127), "Button Wheel Down" (128), "Button Horiz Wheel Left" (129), "Button Horiz Wheel Right" (130), "Button Side" (269), "Button Extra" (270), "Button Forward" (271), "Button Back" (272), "Button Task" (273), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243)
    Evdev Middle Button Emulation (255):    0
    Evdev Middle Button Timeout (256):  50
    Evdev Third Button Emulation (257): 0
    Evdev Third Button Emulation Timeout (258): 1000
    Evdev Third Button Emulation Button (259):  3
    Evdev Third Button Emulation Threshold (260):   20
    Evdev Wheel Emulation (261):    0
    Evdev Wheel Emulation Axes (262):   0, 0, 4, 5
    Evdev Wheel Emulation Inertia (263):    10
    Evdev Wheel Emulation Timeout (264):    200
    Evdev Wheel Emulation Button (265): 4
    Evdev Drag Lock Buttons (266):  0

And this is my wireless mouse xinput:

Device 'A4TECH USB Device':
    Device Enabled (121):   1
    Coordinate Transformation Matrix (123): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (246): 0
    Device Accel Constant Deceleration (247):   1.000000
    Device Accel Adaptive Deceleration (248):   1.000000
    Device Accel Velocity Scaling (249):    10.000000
    Device Product ID (240):    2522, 1359
    Device Node (241):  "/dev/input/event16"
    Evdev Axis Inversion (250): 0, 0
    Evdev Axes Swap (252):  0
    Axis Labels (253):  "Rel X" (131), "Rel Y" (132), "Rel Horiz Wheel" (245), "Rel Vert Wheel" (274)
    Button Labels (254):    "Button Left" (124), "Button Middle" (125), "Button Right" (126), "Button Wheel Up" (127), "Button Wheel Down" (128), "Button Horiz Wheel Left" (129), "Button Horiz Wheel Right" (130), "Button Side" (269), "Button Extra" (270), "Button Forward" (271), "Button Back" (272), "Button Task" (273), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243)
    Evdev Middle Button Emulation (255):    0
    Evdev Middle Button Timeout (256):  50
    Evdev Third Button Emulation (257): 0
    Evdev Third Button Emulation Timeout (258): 1000
    Evdev Third Button Emulation Button (259):  3
    Evdev Third Button Emulation Threshold (260):   20
    Evdev Wheel Emulation (261):    0
    Evdev Wheel Emulation Axes (262):   0, 0, 4, 5
    Evdev Wheel Emulation Inertia (263):    10
    Evdev Wheel Emulation Timeout (264):    200
    Evdev Wheel Emulation Button (265): 4
    Evdev Drag Lock Buttons (266):  0

2 Answers 2

4

Instructions for your wireless mouse: I noted it has 2 ids, but I think no. 12 should be the one you want to use (if not, try the others).

I see in your first codeblock you have got the device ids for your hardware (this can be done just by entering xinput). Now, with that in mind, select the id you want to use, e.g. 12, and gain the detailed readout of your device with xinput list-props 12, as you have indeed done in your third codeblock.

Now to get the button arrangement, run

xinput get-button-map 12

which will get you the list of button labels, which will be a list, say probably from 1-24 in the case of your wireless mouse. The information listed with xinput list-props 12 (in your third codeblock) has a 'button labels' section and the list of button labels there (24) usually directly correlates with the list of digits given by the xinput get-button-map command. This means that 1 will refer to 'button left' from the 'button labels' information, so we need to swap 'button left' (1) and 'button right' (3). To do this, remembering to specify the device id (12), we can shorten the command to 13 digits:

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

This method should work for any mouse, as I can confirm it works for mine.

This answer may also be of interest, as it is related to xinput:

1

Try btnx: https://launchpad.net/btnx

I haven't used it in a while, but as i remember it, it was guided and easy to use.

1
  • This will do, but I am looking for console based solution.
    – zuberuber
    Nov 6, 2012 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .