Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2020 14:41:42 -0800
From:      Craig Leres <leres@freebsd.org>
To:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: mouse tilt wheel between 12.1 and 12.2
Message-ID:  <67274697-202d-f75c-9008-a11ca000904a@freebsd.org>
In-Reply-To: <9bc997ae-096c-c38b-377d-3bf64f530715@freebsd.org>
References:  <9bc997ae-096c-c38b-377d-3bf64f530715@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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 
session.

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"
     EndSection

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"
     EndSection

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

		Craig



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67274697-202d-f75c-9008-a11ca000904a>