mouse tilt wheel between 12.1 and 12.2

Craig Leres leres at
Mon Dec 28 22:41:44 UTC 2020

On 10/29/20 1:36 PM, Craig Leres wrote:
> working with firefox (e.g. tilt-left does not go back a page).

I finally solved this. Here are details.

First I noticed that left/right tiltwheel would cause firefox to 
horizontally scroll left and right. (I'm sure this is desired behavior 
for some.)

Looking in /var/log/Xorg.0.log I (re)confirmed that I'm using evdev. 
That lead me to some references to xinput. To find out the input device 
number of the mouse use:

     ice 2 %  xinput --list | fgrep mouse
         System mouse               id=6    [slave  pointer  (2)]

Once you have the device number you can see the current button map:

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

I was able to confirm that the tiltwheel buttons were 6 and 7 using xev; 
turn the mouse upside down so it doesn't generate any movement events 
and then click the wheel left and right. You can see the mouse button 
labels with:

     xinput --list 6 | fgrep label
                     Button labels: "Button Left" "Button Middle" 
"Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel 
Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button 
Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" 
"Button Unknown" "Button Unknown"

I found an ubuntu reference that indicated that left tiltwheel is button 
8 and right is 9. So in theory we need to map 6 to 8 and 7 to 9. 
Previously I had used:

     moused_flags="-m 4=6 -m 5=7"

in rc.conf. So changed rc.d, kill moused, replug the usb mouse and test; 
I couldn't get it to work with the new desired mappings.

Next I tried using xinput:

     xinput -set-button-map 6 1 2 3 4 5 8 9 6 7

but for whatever reason this does not take effect during the current X 

Looking at the evdev man page I found you can define a ButtonMapping 
option in the mouse inputclass section so I added this:

     Section "InputClass"
             Identifier   "mouse defaults"
             Driver       "evdev"
             Option       "ButtonMapping" "1 2 3 4 5 8 9 6 7"

After restarting X I was able to confirm the new mapping with xinput:

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

also with xev and with (importantly) firefox.

As a bonus here is the inputclass I use to map caps lock to ctrl:

     Section "InputClass"
             Identifier   "keyboard defaults"
             MatchIsKeyboard "on"
             Option       "XkbLayout" "us"
             Option       "XKbOptions" "caps:ctrl_modifier"

Hopefully it'll be a long time before the next time the X gods change 
the mouse button numbers.


More information about the freebsd-hackers mailing list