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)– Jorge CastroOct 14, 2011 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.– Brandon BertelsenOct 14, 2011 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?– n3rdDec 27, 2011 at 12:42
7 Answers
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.
~/trackman.sh
:
#!/bin/bash
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 Useset-prop
(cf.man xinput
).– ClémentDec 20, 2017 at 22:53 -
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:
#!/bin/bash
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
$HOME/bin/trackball.sh
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
lsusb
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" EndSection
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 MOUSE_DPI=100@125
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.
The Logitech_Marblemouse_USB page is quite exhaustive. When my trackball stopped scrolling due to connecting through a USB hub, I fixed the issue as follows on X11 (might not work for Wayland):
Open a terminal.
Verify X11 is the windowing system by typing:
echo $XDG_SESSION_TYPE
The output should show
x11
(notwayland
).List all the devices in the system by typing:
xinput list
The output will show something similar to:
⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ ATEN KVM V1.2.116 id=10 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Unicomp Inc Ruffian6_x Kbrd v3_xx id=8 [slave keyboard (3)] ↳ ATEN KVM V1.2.116 id=9 [slave keyboard (3)]
This indicates that the mouse pointer is device id 10.
Next, let's configure the device properties.
List all available properties by typing:
xinput list-props 10
Note the line:
libinput Button Scrolling Button (288): 2
This indicates that button 2 operates the scroll feature; however, the following diagram shows that there is no button 2:
My preference is to hold the small right-hand button when scrolling.
Configure the small button as follows, where 10 is the device and 9 is the button number:
xinput set-prop 10 "libinput Button Scrolling Button" 9
Add that line to
$HOME/.xsessionrc
so that it activates upon login.
Here is my .xsessionrc
:
# Enable click+hold small right mouse button for scrolling trackball.
xinput set-prop 10 "libinput Button Scrolling Button" 9
# Disable horizontal trackball scrolling.
xinput set-prop 10 "libinput Horizontal Scroll Enabled" 0
# Forward small left click; backward small right click.
xinput set-button-map 10 1 2 3 4 5 6 7 9 8
This is for a left-handed setup. Change the button numbers to suit your own preferences.