On Linux, we can create a configuration files for devices and add them to XOrg configuration folder. After that we will be able to use mouse trackball ball + additional button to scroll page vertically or horizontally.
First we need to select which button we would like to use with our ball. For me best button is scroll wheel because I can easy access this button. I tested my mouse using command xev which allow to check which button was pressed and which ID is assigned to this button. I used sleep command because all my windows are opened in full screen mode. xev was executen in terminal on other desktop (which is on other monitor) and GUI application was visible on second monitor. This way I was able to see live output in terminal:
MX Ergo Scroll wheel button ID is 2 which is in last line as “button 2”. I’ll use it as a <BUTTON ID> in next steps. I don’t know which ID is for M570 but you can check yourself and change it in configuration.
MX Ergo Button ID:
1 – left mouse button (pressed)
2 – mouse wheel down (pressed) (my preferred)
3 – right mouse button (pressed)
4 – wheel up (move up)
5 – wheel down (move down)
8 – button no. 2 (pressed) (check bottom picture)
9 – button no. 1 (pressed) (check bottom picture)
Other buttons don’t have ID’s or xev was unable to recognize them.
File content for Logitech M570:
Section "InputClass" Identifier "M570" MatchProduct "Logitech M570" Driver "libinput" Option "ScrollMethod" "button" Option "ScrollButton" "<BUTTON ID>" EndSection
File content for Logitech MX Ergo:
Section "InputClass" Identifier "MX Ergo" MatchProduct "Logitech MX Ergo" Driver "libinput" Option "ScrollMethod" "button" Option "ScrollButton" "<BUTTON ID>" EndSection
In my case, I saved those contents to files:
52-logitech-m570.conf
53-logitech-mx_ergo.conf
And copied them to folder: /usr/share/X11/xorg.conf.d/
sudo cp 52-logitech-m570.conf /usr/share/X11/xorg.conf.d/
sudo cp 53-logitech-mx_ergo.conf /usr/share/X11/xorg.conf.d/
After that, I installed Debian package ‘xinput’ using command:sudo apt install xinput
And executed command to list my devices to get their IDs
xinput list
I’ll use my devices ID’s (21 for m570 and 9 for MX Ergo) as <DEVICE ID> in next steps.
I executed commands:
xinput set-prop <DEVICE ID> "libinput Scroll Method Enabled" 0, 0, 1
xinput set-prop
<DEVICE ID>
"libinput Button Scrolling Button" <BUTTON ID>
Source: https://help.ubuntu.com/community/Logitech_Marblemouse_USB