On Thu, Apr 04, 2019 at 10:00:38AM +0200, Hans de Goede wrote: > > I played with my Evoluent Vertical mouse and I found that it reports > > BTN_EXTRA for button under scroll wheel, BTN_SIDE for the button on the > > side of the mouse and BTN_FORWARD for the 2nd button on the side. This > > means that not all mice have these buttons in forward/back positions... > > Well that mouse seems to be quite special, most mice with more then 3 > buttons have the back/forward side buttons as buttons 4 and 5. > > Although I myself in the meantime have found a no-name bluetooth mouse > which has button 4 forward button 5 back (so swapped compared to what > userspace expects). > > I will try to borrow some mice with more then 3 buttons from people at > my local hackerspace and see if there is some consistency there, > at least the microsoft page I pointed to suggests that what my logitech > mice are doing is the default Windows behavior. > > And I just plugged the receiver for these Logitech mice into a win10 > machine and without installing any logitech drivers, the buttons > correctly do back / forward in the webbrowser there. > > I also tried the bt mouse with the swapped buttons with win10 and > indeed the buttons work in the wrong direction there, so that seems > to be a hardware-misfeature of that mouse. > > So it still seems to me that the default Linux userspace behavior > (at least in Firefox) with button 4 is back and button 5 is forward > is correct. > > Still I find the existing BTN_FORWARD and BTN_BACK defines misleading > and as e.g. the m560 code in drivers/hid/hid-logitech-hidpp.c shows > various drivers to try to use them as if userspace will actually > interpret them the way the name suggests, which it typically will not. > > So maybe just rename all 5 defines for buttons 4-8 to BTN_EXTRA1 - BTN_EXTA5? > > With maybe a comment that userspace may interpret BTN_EXTRA4 as back and > BTN_EXTRA5 as forward (or maybe even BTN_APP_FORWARD and BTN_APP_BACK aliases?) ? might be better, because both xorg-evdev and libinput enumerate the buttons as they are available on the device. So in the niche case that you have only BTN_APP_FORWARD but not BACKWARD, that button will be button number 8 (i.e. back) and BTN_EXTRA1 would be 9 (i.e. forward) . Cheers, Peter > > And then as Peter suggested in another thread about other extra mouse buttons > (on which you were not Cc-ed) we really need userspace to have a mapping UI > for special / broken cases. > > Regards, > > Hans