Sample Header Ad - 728x90

Xinput button mapping and middle button emulation

4 votes
2 answers
4075 views
I have a mouse with 4 physical buttons (Kensington Slimblade Trackball), let's call them A B C D, plus 3 axes: mouse X, Y, and scroll wheel. Buttons A and B work out of the box as primary (button 1) and right click (button 3). Pressing A + B together generates a middle click (button 2), which is also great. Now I'd like to map buttons C and D for my own purposes, but **I cannot find how to map button C separately from the A+B emulation.** With the default button map, I get this mapping: physical buttons: A C B D xinput button-map: 1 2 3 4 5 6 7 8 9 10 11 12 If I try to map button C to 8 and D to 9, with xinput set-button-map, then pressing A+B is mapped to button 8 too! physical buttons: A C B D xinput button-map: 1 8 3 0 0 0 0 9 ^ A+B emulation becomes 8 too! How can I map button C to an arbitrary button number, while keeping the A+B emulation as button 2? Should I work on a lower level than Xinput? How? Should I use a different Xinput setting? Edit: here are the evtest codes for the 4 buttons: A: type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 type 1 (EV_KEY), code 272 (BTN_LEFT), value 1 B: type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002 type 1 (EV_KEY), code 273 (BTN_RIGHT), value 1 C: type 4 (EV_MSC), code 4 (MSC_SCAN), value ff000001 type 1 (EV_KEY), code 274 (BTN_MIDDLE), value 1 D: type 4 (EV_MSC), code 4 (MSC_SCAN), value ff000002 type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
Asked by Tobia (739 rep)
Oct 6, 2016, 05:48 PM
Last activity: Feb 11, 2025, 07:47 PM