From owner-freebsd-hackers@freebsd.org Mon Dec 28 22:41:44 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DE994C399F for ; Mon, 28 Dec 2020 22:41:44 +0000 (UTC) (envelope-from leres@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4XbX1Pqdz4q5S for ; Mon, 28 Dec 2020 22:41:44 +0000 (UTC) (envelope-from leres@freebsd.org) Received: from ice.alameda.xse.com (unknown [IPv6:2600:1700:a570:e20:f2ad:4eff:fe0b:a065]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: leres) by smtp.freebsd.org (Postfix) with ESMTPSA id E7276224BB for ; Mon, 28 Dec 2020 22:41:43 +0000 (UTC) (envelope-from leres@freebsd.org) From: Craig Leres Subject: Re: mouse tilt wheel between 12.1 and 12.2 References: <9bc997ae-096c-c38b-377d-3bf64f530715@freebsd.org> To: "freebsd-hackers@freebsd.org" Message-ID: <67274697-202d-f75c-9008-a11ca000904a@freebsd.org> Date: Mon, 28 Dec 2020 14:41:42 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <9bc997ae-096c-c38b-377d-3bf64f530715@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2020 22:41:44 -0000 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