Solved Mouse - wheel tilt

I have a Logitech mouse with a fancy wheel and want to provide programs such LibreOffice or Firefox with ability to scroll window content horizontally. Can you suggest how to do this? Mouse must send specific events on that?

Code:
[  50.056] (II) Using input driver 'mouse' for 'sysmouse'
[  50.056] (**) sysmouse: always reports core events
[  50.056] (**) Option "Device" "/dev/sysmouse"
[  50.056] (==) sysmouse: Protocol: "Auto"
[  50.056] (**) sysmouse: always reports core events
[  50.056] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[  50.056] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[  50.056] (**) sysmouse: Buttons: 5
[  50.056] (**) Option "config_info" "devd:sysmouse"
[  50.056] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[  50.056] (**) sysmouse: (accel) keeping acceleration scheme 1
[  50.056] (**) sysmouse: (accel) acceleration profile 0
[  50.056] (**) sysmouse: (accel) acceleration factor: 2.000
[  50.056] (**) sysmouse: (accel) acceleration threshold: 4
[  50.056] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[  50.056] (II) sysmouse: SetupAuto: protocol is SysMouse
[  50.056] (II) config/devd: device /dev/ums0 already opened

x11/xev
Code:
ButtonPress event, serial 37, synthetic NO, window 0x2c00001,
  root 0x291, subw 0x0, time 11013814, (87,84), root:(958,620),
  state 0x10, button 8, same_screen YES

ButtonRelease event, serial 37, synthetic NO, window 0x2c00001,
  root 0x291, subw 0x0, time 11013962, (87,84), root:(958,620),
  state 0x10, button 8, same_screen YES

ButtonPress event, serial 37, synthetic NO, window 0x2c00001,
  root 0x291, subw 0x0, time 11014579, (87,84), root:(958,620),
  state 0x10, button 9, same_screen YES

ButtonRelease event, serial 37, synthetic NO, window 0x2c00001,
  root 0x291, subw 0x0, time 11014793, (87,84), root:(958,620),
  state 0x10, button 9, same_screen YES

For Firefox wheel tilt works as back/forward, Libreoffice seems to ignore tilt completely.
 
The following resources might be helpful:

In particular, the details for ZAxisMapping:
Code:
5.2. ZAxisMapping

This option maps the Z axis (wheel) motion to buttons or to another
axis.


Option "ZAxisMapping" "X"
Option "ZAxisMapping" "Y"
Option "ZAxisMapping" "N1 N2"
Option "ZAxisMapping" "N1 N2 N3 N4"



The first example will map the Z axis motion to the X axis motion.
Whenever the user moves the wheel/roller, its movement is reported as
the X axis motion. When the wheel/roller stays still, the real X axis
motion is reported as is. The third example will map negative Z axis
motion to the button N1 and positive Z axis motion to the button N2.
If this option is used and the buttons N1 or N2 actually exists in the
mouse, their actions won't be detected by the X server.

The last example is useful for the mouse with two wheels of which the
second wheel is used to generate horizontal scroll action, and the
mouse which has a knob or a stick which can detect the horizontal
force applied by the user. The motion of the second wheel will be
mapped to the buttons N3, for the negative direction, and N4, for the
positive direction. If the buttons N3 and N4 actually exist in this
mouse, their actions won't be detected by the X server.

NOTE #1: horizontal movement may not always be detected by the current
version of the X11R7.5 X servers, because there appears to be no
accepted standard as to how the horizontal direction is encoded in
mouse data.

NOTE #2: Some mice think left is the negative horizontal direction,
others may think otherwise. Moreover, there are some mice whose two
wheels are both mounted vertically, and the direction of the second
vertical wheel does not match the first one's.

You need to edit the xorg.conf file by hand to change this option if
the default value of "4 5 6 7" does not match the needs of your
configuration.

Looking at your xev output, it looks like you might need to add something like the following to your /etc/X11/xorg.conf file:
Code:
Section "ServerLayout"
    Option         "AutoAddDevices" "false"
EndSection

Section "InputDevice"
    Identifier     "Mouse1"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/sysmouse"
    Option         "ZAxisMapping" "4 5 8 9"
EndSection
 
AFAIK, input sections are obsolete new as automatic device detection is on by default and will be ignored. So, the only solution is to disable it and provide Xorg full xorg.conf ?
 
You can add the input section to an xorg.conf file if you need it. Everything else will still be auto-configured by X.
 
Code:
Section "InputClass"
  Identifier  "Mouse Defaults"
  Driver  "mouse"
  MatchIsPointer  "on"
  Option  "Device"  "/dev/sysmouse"
  Option  "ZAxisMapping"  "4 5 8 9"
EndSection
Code:
[ 18237.211] (**) sysmouse: Applying InputClass "Mouse Defaults"
[ 18237.211] (II) LoadModule: "mouse"
[ 18237.212] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[ 18237.212] (II) Module mouse: vendor="X.Org Foundation"
[ 18237.212]    compiled for 1.14.7, module version = 1.9.0
[ 18237.212]    Module class: X.Org XInput Driver
[ 18237.212]    ABI class: X.Org XInput driver, version 19.1
[ 18237.212] (II) Using input driver 'mouse' for 'sysmouse'
[ 18237.212] (**) sysmouse: always reports core events
[ 18237.212] (**) Option "Device" "/dev/sysmouse"
[ 18237.212] (==) sysmouse: Protocol: "Auto"
[ 18237.212] (**) sysmouse: always reports core events
[ 18237.212] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[ 18237.212] (**) Option "ZAxisMapping" "4 5 8 9"
[ 18237.213] (**) sysmouse: ZAxisMapping: buttons 4, 5, 8 and 9
[ 18237.213] (**) sysmouse: Buttons: 9
[ 18237.213] (**) Option "config_info" "devd:sysmouse"
[ 18237.213] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[ 18237.213] (**) sysmouse: (accel) keeping acceleration scheme 1
[ 18237.213] (**) sysmouse: (accel) acceleration profile 0
[ 18237.213] (**) sysmouse: (accel) acceleration factor: 2.000
[ 18237.213] (**) sysmouse: (accel) acceleration threshold: 4
[ 18237.213] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[ 18237.213] (II) sysmouse: SetupAuto: protocol is SysMouse
Horisontal scrolling still not works. The most interesting, xev stops detect tilts at all.
 
AFAIK, input sections are obsolete new as automatic device detection is on by default and will be ignored. So, the only solution is to disable it and provide Xorg full xorg.conf ?

A quote from the FreeBSD FAQ https://www.freebsd.org/doc/en/books/faq/x.html#idp59884624:
Code:
Starting with Xorg version 7.4, the InputDevice sections in xorg.conf are ignored in favor of autodetected devices.
To restore the old behavior, add the following line to the ServerLayout or ServerFlags section:

Option "AutoAddDevices" "false"
 
If you can't get horizontal scrolling to work using an xorg.conf file, an alternative method could maybe be used using x11/xmodmap which may already be installed on your system. run % xmodmap -pp in a terminal to get a printout of all available mouse buttons. Using that information you can alter the button layout which may allow you to have horizontal scrolling. For example, if you have 10 available buttons on your mouse and buttons 8 and 9 are your wheel tilt, you could change the original button layout [1 2 3 4 5 6 7 8 9 10] to the following layout [1 2 3 4 5 8 9 6 7 10] or similar using the following command:
Code:
xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7 10"
Once you find a working layout, just add the command to your xinitrc file if you start X from the command line, or put it in a autostart script to run with your window manager/DE of choice.
 
This magic worked, thank you. However, horizontal scroll event is being sent per click. It is possible to configure the continuous scrolling when wheel is tilted?
 
Back
Top