You can configure it using xinput.

  • Welcome to askubuntu, please post your solution as a seperate answer (though I think the system makes you wait a day or so) Oct 14 '11 at 16:41
  • It only makes you wait a couple of days to accept your own answer. But you can post it anytime prior to that. Oct 14 '11 at 16:49
  • I am not quite sure, what this script does. My Trackball seems to work fine without any prior configuration. However, I would like to increase the pointer sensitivity. How does your script help?
    – n3rd
    Dec 27 '11 at 12:42

This is always what I've done. it works a peach for every trackman I've ever used. It's the last, simplest step from the official ubuntu page.



xinput set-button-map "Logitech USB Trackball" 1 2 3 4 5 6 7 8 9
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
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Axes" 8 6 7 4 5
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation X Axis" 8 6
xinput set-int-prop "Logitech USB Trackball" "Evdev Drag Lock Buttons" 8 9`

chmod +x ~/trackman.sh

then, whenever you login (or in a startup script), bash ~/trackman.sh

Done. This tiny little scripts works much, much better than the official ~60mb windows installer IMHO :)

  • set-int-prop is deprecated, cf askubuntu.com/a/201825/411415 Use set-prop (cf. man xinput).
    – Clément
    Dec 20 '17 at 22:53
  • evdev is also deprecated, use the libinput properties instead
    – jherek
    Oct 30 '20 at 12:52

i've got that configuration and it worked very well until i upgraded to Debian Stretch.... and what's happens ? 'evdev' is not used anymore; because 'libinput' replaced it.

Check the lib used :

xinput list-props "Logitech USB Trackball"

If you find many props starts with 'Evdev', forget my comment, ELSE if it starts with 'libinput', this line could do the thing :

xinput set-prop "Logitech USB Trackball" "libinput Button Scrolling Button" 8

Too, i recommend THIS for confort :

# Enable middle button (on 9) and disable all useless and conflicting buttons and others.
xmodmap -quiet -e "pointer = 1 0 3 4 5 6 7 0 2 0 0 0" 

( And NOT THIS : xmodmap -quiet -e "pointer = 1 0 3 4 5 6 7 8 2 10 11 12" which only says to use middle button (2) instead of Browser Next (9). You need to say to use only scrolling - then nothing - when you click on Browser Prev (8) )

RECAP So, with these modifications, you've got a ball and 4 usable buttons (1-BIG 2-small 3-small 4-BIG) on the trackball.

  • A ball -> mouse move + mouse scroll if you press button 2.
  • Button 1 -> classic left button
  • Button 2 -> Press it to scroll with the ball
  • Button 3 -> middle button (usefull to copy selection in linux)
  • Button 4 -> classic right button

The way you're doing this isn't quite correct. .bashrc is executed when you start bash shell. Unless you're only using it from within a terminal emulator running within an X session, it will give you errors each time you log in or open a new terminal.

You may want to look at the solution I provided here


I tested this in 11.10 and it works very nicely. This selection is from "Ubuntuwiki"

Avoid using Hal for this release because it has known issues. Put the following into terminal, using gedit:

Edit $HOME/bin/trackball.sh using this command:

gedit $HOME/bin/trackball.sh

Then paste this into the file:

dev="Logitech USB Trackball"
we="Evdev Wheel Emulation"
xinput set-int-prop "$dev" "$we Button" 8 8
xinput set-int-prop "$dev" "$we" 8 1

# xinput set-int-prop "$dev" "$we" 8 1
# xinput set-int-prop "$dev" "$we Button" 8 9
# xinput set-int-prop "$dev" "$we X Axis" 8 6 7
# xinput set-int-prop "$dev" "$we Y Axis" 8 4 5
# xinput set-int-prop "$dev" "Drag Lock Buttons" 8 8 

Make sure trackball.sh begins with #!/bin/bash. Make the script executable by running this:

chmod +x $HOME/bin/trackball.sh`

Add the following lines to $HOME/.bashrc, using gedit $HOME/.bashrc and put this in the file even if it is empty:

xmodmap $HOME/.Xmodmap > /dev/null 2>&1

Edit $HOME/.Xmodmap using: gedit $HOME/.Xmodmap

pointer = 1 8 3 4 5 6 7 9

Log out and back in and viola!


If your mouse is connected with a PS/2 -> USB adapter, you could try out the command


For me it showed, among other things, that there is a

Bus 001 Device 018: ID 04d9:1400 Holtek Semiconductor, Inc. PS/2 keyboard + mouse controller

The first part of the USB identity code (04d9) identifies the manufacturer, and the second the product.

Now you can use that information to discover the identities of devices connected to that adapter by typing

xinput list --long | grep 04d9

What I got was

↳ HID 04d9:1400 id=9 [slave pointer (2)]

↳ HID 04d9:1400 id=8 [slave keyboard (3)]

I have no keyboard attached to the adapter, but there is my old trackball mouse, Logitech TrackMan Marble FX.

So I wanted to know more about the device identified above as id=9, and I used xinput command to get what I wanted:

xinput list-props 9

The first line of the listing was

Device 'HID 04d9:1400':

The listing also shows the properties of the device, and I used those to build commands needed for modifying those properties. What I ended with was two commands:

xinput set-int-prop "pointer:HID 04d9:1400" "Evdev Wheel Emulation Button" 8 3

xinput set-int-prop "pointer:HID 04d9:1400" "Evdev Wheel Emulation" 8 1

The first line turns Button 3 of the TrackMan mouse into a Wheel emulation button. (Button 4 a.k.a. "8" does not seem to work at all). "Pointer" in the commands refers to the mouse and prevents confusing things with "keyboard" that could be attached to the same adapter (not in my system).


The above answers are outdated.

Two settings:

  • Acceleration to max. This can be set in gnome config, or via xinput set-prop "Logitech USB Trackball" 328 1.0 or via the equivalent in xorg conf, in general, I use the following /etc/X11/xorg.conf.d/10-libinput.conf
Section "InputClass"
     Identifier "Marble Mouse"
     MatchProduct "Logitech USB Trackball"
     Driver "libinput"
     Option "ScrollMethod" "button"
     Option "ScrollButton" "8"
     Option "AccelSpeed" "1"
     # Option "TransformationMatrix" "2.4 0 0 0 2.4 0 0 0 1"

as I also want scrolling with wheel by clicking on the left small button. The commented TransformationMatrix allows to skip pixels and move faster, but I prefer to change the DPI as below instead.

  • Set a custom DPI through /etc/udev/hwdb.d/71-mouse-local.hwdb
# Logitech Marble Mouse
#id obtained by: mouse-dpi-tool  /dev/input/event4
mouse:usb:v046dpc408:name:Logitech USB Trackball:
# keep space below

and then udevadm hwdb --update, udevadm control --reload-rules && udevadm trigger and unplug, plug mouse. The DPI of 100 may be too sensitive for some, you could replace by 200@125.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.