Bug 107265 - Can't set base velocity and acceleration to match Logitech Trackball M570
Summary: Can't set base velocity and acceleration to match Logitech Trackball M570
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/libinput (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-17 16:55 UTC by alf.debianfan
Modified: 2018-07-21 10:44 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description alf.debianfan 2018-07-17 16:55:24 UTC
Using libinput (Debian-Buster wit libinput10 v1.11.2-1)
makes the Trackball hardly usable.
Base Speed ist too high, acceleration is too high. It does not consider
that with just a thumb you cannot position as exactly as with a mouse.
Movements over greater distance just needs a small kick to let the ball
spin, which does not apply to mice.

Tried to adjust the parameters with "xinput" and the XFCE-settings
without success (settings are not respected).

Tried to cheat the DPI-values as given in /lib/udev/hwdb.d/70-mouse.hwdb
for MOUSE_DPI= without success. Setting DPI value from original 540 -> 1080 is recognised. Speed should be half, but does not change in any way.

$ udevadm hwdb --test="mouse:usb:v046dp1028:name:Logitech M570:"
ID_INPUT_TRACKBALL=1
MOUSE_DPI=1080@125

Btw: the polling frequeny ist not 167Hz as hwdb suggests, but 125Hz as
reported by solaar:
Wireless Trackball M570
		   Codename     : M570
		   Kind         : mouse
		   Wireless PID : 1028
		   Protocol     : HID++ 1.0
		   Polling rate : 8 ms		(=125Hz)
		   Serial number: BD48472C
		        Firmware: 26.00.B0003
		      Bootloader: 02.06
		           Other: 00.01

Tried different acceleration profiles in "dconf-editor", none decreases base speed/velocity.

xinput does not report any velocity settings:

$ xinput --list-props 10
Device 'Logitech M570':
	Device Enabled (140):	1
	Coordinate Transformation Matrix (142):	1.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Natural Scrolling Enabled (278):	0
	libinput Natural Scrolling Enabled Default (279):	0
	libinput Scroll Methods Available (280):	0, 0, 1
	libinput Scroll Method Enabled (281):	0, 0, 0
	libinput Scroll Method Enabled Default (282):	0, 0, 0
	libinput Button Scrolling Button (283):	2
	libinput Button Scrolling Button Default (284):	2
	libinput Middle Emulation Enabled (285):	0
	libinput Middle Emulation Enabled Default (286):	0
	libinput Rotation Angle (296):	0.000000
	libinput Rotation Angle Default (297):	0.000000
	libinput Accel Speed (287):	0.000000
	libinput Accel Speed Default (288):	0.000000
	libinput Accel Profiles Available (289):	1, 1
	libinput Accel Profile Enabled (290):	1, 0
	libinput Accel Profile Enabled Default (291):	1, 0
	libinput Left Handed Enabled (292):	0
	libinput Left Handed Enabled Default (293):	0
	libinput Send Events Modes Available (263):	1, 0
	libinput Send Events Mode Enabled (264):	0, 0
	libinput Send Events Mode Enabled Default (265):	0, 0
	Device Node (266):	"/dev/input/event2"
	Device Product ID (267):	1133, 4136
	libinput Drag Lock Buttons (294):	<no items>
	libinput Horizontal Scroll Enabled (295):	1

Finally to make the trackball work at reduced speed/velocity I switched back to "evdev" and disabled "libinput" for mice and keyboards.
This makes xinput handling speed and allow setting it to a proper value:

# xinput --list-props 10
Device 'Logitech M570':
	Device Enabled (136):	1
	Coordinate Transformation Matrix (138):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (264):	0
	Device Accel Constant Deceleration (265):	1.000000
	Device Accel Adaptive Deceleration (266):	1.000000
	Device Accel Velocity Scaling (267):	10.000000
	Device Product ID (259):	1133, 4136
	Device Node (260):	"/dev/input/event2"
	Evdev Axis Inversion (268):	0, 0
	Evdev Axes Swap (270):	0
	Axis Labels (271):	"Rel X" (146), "Rel Y" (147), "Rel Horiz Wheel" (292), "Rel Vert Wheel" (263)
	Button Labels (272):	"Button Left" (139), "Button Middle" (140), "Button Right" (141), "Button Wheel Up" (142), "Button Wheel Down" (143), "Button Horiz Wheel Left" (144), "Button Horiz Wheel Right" (145), "Button Side" (287), "Button Extra" (288), "Button Forward" (289), "Button Back" (290), "Button Task" (291), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262), "Button Unknown" (262)
	Evdev Scrolling Distance (273):	1, 1, 1
	Evdev Middle Button Emulation (274):	0
	Evdev Middle Button Timeout (275):	50
	Evdev Middle Button Button (276):	2
	Evdev Third Button Emulation (277):	0
	Evdev Third Button Emulation Timeout (278):	1000
	Evdev Third Button Emulation Button (279):	3
	Evdev Third Button Emulation Threshold (280):	20
	Evdev Wheel Emulation (281):	0
	Evdev Wheel Emulation Axes (282):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (283):	10
	Evdev Wheel Emulation Timeout (284):	200
	Evdev Wheel Emulation Button (285):	4
	Evdev Drag Lock Buttons (286):	0

Conclusion:
The trackball definitely needs different and individual settings for velocity and acceleration compared to standard mice to work with comfortably. These settings are not provided by "libinput", especially
	Device Accel Velocity Scaling (267):	10.000000
(if I recall well, libinput sets a fixed scaling of 15)

In case you need further information, please let me know,
alf
Comment 1 Peter Hutterer 2018-07-18 06:20:48 UTC
Pls file this bug at https://gitlab.freedesktop.org/libinput/libinput/issues, libinput has moved to gitlab and this is the xorg driver component, it doesn't modify the events so it cannot fix this issue.

The one thing I noticed though

  libinput Accel Speed (287):	0.000000

you're still on the default acceleration value. This one has a value in the -1 ... +1 range, you should try whether any of them work better.
Comment 2 alf.debianfan 2018-07-18 20:24:53 UTC
Thanks for your hint to modify Acceleration Speed, I could set it with xinput:

xinput --set-prop 10 287 -0.7

results in a similar speed as with evdev without any tuning. So at least I found a way to make my trackball usable with libinput. You see how significant the change in behavior compared to evdev is! A good indicator is to check how the pointer performs in a x-term:
if you are able to cover the whole window with one stroke (which rotates the ball roughly by 1 inch), and at the same time are able to select/mark text with the precision of 1 letter at the same settings, you have a good compromise.

What I am now missing for fine tuning is some kind of acceleration/deceleration to allow even better precision (I now use a mouse for such cases).

Unfortunately the naming of the parameters is a bit misleading, so understanding functionality is not self-explaining. Example:

acceleration = speed(change)/time [m/sĀ²]
speed = distance/time [m/s]

what does "acceleration speed" mean?

In fact to have a clear understanding and to avoid confusion I would suggest to have 3 values for tuning/adjusting:

1. minimum speed (for highest precision)
2. maximum speed (for accelerated moves)
3. transition profile for a smooth changeover (within a given number of pixels)

With the current settings as described above I did not find any way to influence the speed I have set, not with deconf-editor, not with xinput.

I do not know if this can be realized with the currently offered tuning knobs of libinput, but in general the same applies to mice. As those settings should be possible on a per user basis - isn't it a task for xorg as well?

One thing however seems clear: a trackball needs different settings/profile compared to mice.

Best regards
Comment 3 Peter Hutterer 2018-07-18 22:40:18 UTC
(In reply to alf.debianfan from comment #2)
> Thanks for your hint to modify Acceleration Speed, I could set it with
> xinput:
> 
> xinput --set-prop 10 287 -0.7

fwiw, http://who-t.blogspot.com/2016/07/xinput-resolves-device-names-and.html

but a -0.7 setting is "unusual" and usually requires a libinput fix.

[..]

> what does "acceleration speed" mean?

It's a magic variable between "slowest" and "fastest" that we can then treat in code depending on the device. see the documentation for libinput itself and its pointer accel documentation
https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html

> 
> In fact to have a clear understanding and to avoid confusion I would suggest
> to have 3 values for tuning/adjusting:
> 
> 1. minimum speed (for highest precision)
> 2. maximum speed (for accelerated moves)
> 3. transition profile for a smooth changeover (within a given number of
> pixels)

Start here:
https://who-t.blogspot.com/2018/05/x-server-pointer-acceleration-analysis-part1.html

It's a 5 part series.
 
> With the current settings as described above I did not find any way to
> influence the speed I have set, not with deconf-editor, not with xinput.

libinput only has the single knob, no other configurations. everything else is internal implementation only.

> I do not know if this can be realized with the currently offered tuning
> knobs of libinput, but in general the same applies to mice. As those
> settings should be possible on a per user basis - isn't it a task for xorg
> as well?

not really. with the libinput driver, everything is now done in libinput so we can have the same behaviour across xorg and the wayland compositors. X doesn't touch the pointer data with libinput.

the xorg libinput driver exposes those settings on a *per device* basis. That's the only granularity you'll get and it's the same that all other xorg drivers do. per-user is on a higher level and would have to be managed by the desktop environment (all the big ones do this)
 
> One thing however seems clear: a trackball needs different settings/profile
> compared to mice.

maybe. that would have to be tracked in libinput's issue tracking but given that I never receive useful feedback on any pointer acceleration patches but plenty of abuse later, you'll have to come up with an implementation yourself.\

I also cannot test every single piece of hardware out there, so things that work just fine for one device can be broken for another. libinput has all the hooks in place to get this fixed, it just needs people to care enough to actually fix it. So far, this has rarely happened.
Comment 4 alf.debianfan 2018-07-19 19:47:07 UTC
Many thanks for your explanations and background information, Peter.

With my limited knowledsge I am afraid I cannot supply any valuable input/contribution to libinput - so I have to manage with dirty hacks.

I did play a bit further with the single knob "Accel Speed (287):" and found that -0.8 or even -0.9 is even better. At least it's a possibility to get it work with libinput.

From my understanding a similar effect could be achieved by cheating the dpi or polling frequency of the device. I did try to set different values in
/lib/udev/hwdb.d/70-mouse.hwdb for
MOUSE_DPI=540@125

Changing those by factors of 2 and above does not result in any different beheavior - don't understand that, hardware data base seems to be ignorend?

Is there any such variable elsewhere to which I can apply such a correction?

Best regards
Comment 5 Peter Hutterer 2018-07-20 03:48:26 UTC
MOUSE_DPI should be read for trackballs. Otherwise, there are no other settings you can toggle to get the behaviour, libinput intentionally keeps the ability to apply random settings to a minimum to have defined behaviour across the board.

Either way, gitlab please to continue.
Comment 6 alf.debianfan 2018-07-20 18:41:35 UTC
Peter, I finally found a very simple solution for my trackball!

> MOUSE_DPI should be read for trackballs. Otherwise, there are no other settings you can toggle to get the behaviour

Studying the documentation yo linket some posts above I learned that libinput does not recognize the udev-parameter "ID_INPUT_TRACKBALL=1" in hwdb and therefor does not respect any tuning via DPI-spoofing. Setting it to "ID_INPUT_MOUSE=1" instead lets me tune unaccelerated speed to my preferences.

Created a "corrected" hwdb enty for the M570 like:

created /etc/udev/hwdb.d/71-mouse-local.hwdb

# Logitech Wireless Trackball M570
mouse:usb:v046dp1028:name:Logitech M570:
mouse:usb:v046dpc52b:name:Logitech Unifying Device. Wireless PID:1028:
# Cheating hwdb to make the trackball compatible with libinput
#
# Declaring it as a MOUSE instead of TRACKBALL causes libinput to
# respect the DPI-settings in the hardware database,
# Faking DPI to a 1000 causes pointer to slow down to a comfortable speed
# with reasonable precision for placement.
# Setting "Accel Speed (287)" to -0.4 to -0.6  with xinput still
# provides a moderate and comfortable acceleration for longer moves.
# This can be done on a per user basis in ~/.xsessionrc
# MOUSE_DPI=540@125
# ID_INPUT_TRACKBALL=1
 MOUSE_DPI=1000@125
 ID_INPUT_MOUSE=1

There is no further fine tuning necessary, it's at least as good as with evdev.

The only thing which would make sense is to convince libinput team to allow for and recognize "ID_INPUT_TRACKBALL=1" and treat it the same way as mice. Without that the trackball is handled like some "default input device?" and makes it unusable.

Spoofing DPI is a personal fine tuning, and if you only apply none or light acceleration, the trackball will at least be usable.

So, in fact we have 2 tuning parameters:
a) base speed (unaccelerated) via DPI
b) acceleration via "Accel Speed (287)"

Best regards and thanks for your support,
Ingo
Comment 7 alf.debianfan 2018-07-21 10:44:54 UTC
Filed the issue at gitlab:

https://gitlab.freedesktop.org/libinput/libinput/issues/91

Please comment if something is missing,
Ingo


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.