A simple post on how to configure a Logitech Trackman Marble on GNU/Linux. This post is tested on Ubuntu but since this is Xorg configuration it should be usable almost everywhere.
Out of the box
In Ubuntu, the trackball works out of the box. But I want to configure it to my tastes.
What it is actually missing is the scrolling function. Which is fairly useful while browsing websites and reading pdfs.
What am I looking for
- Faster mouse speed
- Hold Back button + wheel => Scroll
- Simple Back button => Back
- Middle button with 2 button click
xinput and evdev
Evdev is a generic input driver. Most mouses/keyboards can be accesses through it.
xinput is a command line utility to configure X devices. To test options and changes is quite useful and easy to use. With it we can mingle in the settings and test it “live” until getting the desired behaviour.
To map the buttons, first we have to know the values of those buttons. For that I used the
xev utility. Start
xev, mouse-over the small window that appears and press all the buttons like a monkey until you are satisfied.
xev will log the values of those presses. When finished, you’ll know which button is which code.
Set Up from command line
List available options
Xinput has a simple option
list-props to list all the properties that can be set for a specific device. I won’t drop them all here, but know that you can have a look with:
xinput list-props "Logitech USB Trackball"
This is something directly supported by evdev. Enable the “Evdev Wheel Emulation” option:
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 8
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1
The first command will set the wheel emulation to Button 8. (the first 8 is just the integer type), the second command enables the option (set to 1). By default there’s a timeout on emulation activations, so simply clicking the back button will perform the default function (go back).
To scroll you hold the small button down and move the ball up and down, left and right.
As stated, this just works, so no need to change anything.
There’s no middle button in this trackball, and there’s two ways around it. The first one: a classic middle button emulation pressing two buttons, that would be the two big ones (1,3); the second option is to change the behaviour of button 9. Back and forward buttons may seem like a good idea, but they have mostly no use for me.
Enabling the button emulation is straightforward:
xinput set-int-prop "Logitech USB Trackball" "Evdev Middle Button Emulation" 8 1
Remapping is very easy to, but we have to know about the button maps. For that, check the Button Labels line from
xinput list-props "Logitech USB Trackball"
Once we know that, use
xinput set-button-map with a list of numbers to set a button to each label. The default button configuration is: 1 2 3 4 …, that matches with the functionalities that we have for those buttons out of the box:
- 1) “Button Left”
- 2) There’s no 2 button “Button Middle”
- 3) “Button Right”
- 4) There’s no 4 button “Button Wheel up”
- 5) There’s no 5 button “Button Wheel down”
- 6) There’s no 6 button “Button Horiz Wheel left”
- 7) There’s no 7 button “Button Horiz Wheel right”
- 8) “Button Side”
- 9) “Button Extra”
For our new map, 9 should be “Button Middle”
xinput set-button-map "Logitech USB Trackball" 1 9 3 4 5 6 7 8 2
By now you have the gist for it. Adjust the Deceleration to your needs.
xinput set-prop "Logitech USB Trackball" "Device Accel Constant Deceleration" 0.7
Auto configuring on X11 start
Now we have a set of commands to set our Trackman as we like. But there’s a problem, I don’t want to type all of this every time my system starts. Realistically it’s not that bad since my laptop usually goes from ON to SLEEP :-D. Anyway, an easy way out is to write all those commands into a shell script, make it executable and run in whenever you plug the Trackman.
But you don’t want that do you? What we’ll do is create an InputDevice. In my case device configurations can be found under
/usr/share/X11/xorg.conf.d/. It has some funny files like 51-synaptics-quirks.conf.
Create your own file there: 70-logitech-trackman.conf and fill it with the appropriate options. Mind you that the naming of the options is not exactly the same that we used on the command line with
xinput. To know the exact names check the man page of evdev.
# # InputClass configuration for Logitech USB trackball # Section "InputClass" Identifier "TrackmanConfiguration" MatchProduct "Logitech USB Trackball" Driver "evdev" Option "ButtonMapping" "1 9 3 4 5 6 7 8 2" Option "ConstantDeceleration" "0.7" Option "EmulateWheel" "1" Option "EmulateWheelButton" "8" EndSection
Word of advice (for those not so used to tampering with X11), changing this values to something not valid will prevent X11 from starting. So if after changing it your system does not boot check whatever you wrote for your InputClass.
Extras for lefties
Section “InputClass” Identifier “TrackmanConfiguration” MatchProduct “Logitech USB Trackball” Driver “evdev” Option “ButtonMapping” “3 8 1 4 5 6 7 2 9” Option “ConstantDeceleration” “0.7” Option “EmulateWheel” “1” Option “EmulateWheelButton” “9” EndSection
And that’s it. Now I can plug/unplug my trackball as I see fit. And when I forget how I configured it this blog page will exist 😛
EVDEV man page ⇒GO
XEV man page ⇒GO
xinput man page⇒GO
Xorg page on InputDevice ⇒GO
6 responses to “Logitech Trackman in Linux”
Excellent! This was EXACTLY what I needed as well for my Trackman!
A million thanks man!
Wow! this comment went under my radar!. I’m glad that it was useful 😀
I created the following for Left-handed use.
MatchProduct “Logitech USB Trackball”
Option “ButtonMapping” “3 8 1 4 5 6 7 2 9”
Option “ConstantDeceleration” “0.7”
Option “EmulateWheel” “1”
Option “EmulateWheelButton” “9”
Pingback: The Microsoft Sculpt | Castells
Hi Jordi Castells, Sorry to bring back to live this old post about Trackman. Is 2021 and I just bought a Trackman mouse, Amazing old device. Unfortunately out of the box it lack the Wheel functionality.
I followed along the tutorial but I couldn’t make it work.
Does this functionality still work?
I’m using Linux Min 20 (Mate)
I used the following comands:
> xinput set-int-prop “Logitech USB Trackball” “Evdev Wheel Emulation Button” 8 8
> xinput set-int-prop “Logitech USB Trackball” “Evdev Wheel Emulation Button” 8 1
To be frank, I have no idea 🙂