Bug 89725

Summary: Default settings are unusable with thinkpad x230 touchpad
Product: Wayland Reporter: Vasily Khoruzhick <anarsoul>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: anarsoul, jwrdegoede, peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: x230-slow.rec
x230-fast.rec
dmesg.txt

Description Vasily Khoruzhick 2015-03-23 05:52:38 UTC
Created attachment 114541 [details]
x230-slow.rec

Cursor is too "jumpy" on thinkpad x230 with default settings both for xf86-input-libinput and xf86-input-synaptics, but its possible to tune synaptics driver to make it usable [1]. I was unable to find the same settings for xf86-input-libinput. 

Recordings made with evemu-record both for slow and fast movement are attached.

[1] https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X230#Touchpad
Comment 1 Vasily Khoruzhick 2015-03-23 05:53:10 UTC
Created attachment 114542 [details]
x230-fast.rec
Comment 2 Peter Hutterer 2015-03-23 07:07:54 UTC
ok, so replaying this with evemu shows the jumpy movement. it almost behaves like it's only running at a couple of frames per second.

First a question though: what are the phys. dimensions of the touchpad. Is the vertical resolution really wrong?

From a quick manual skim of the event recording it looks like events still come at the normal sampling rate (80Hz) but the average movement is somewhere around 50 device-units (i.e. almost a mm). So the sensor resolution must be pretty awful.

Hans, do you know of any kernel tweaks that may be missing here or do we need to work around this in libinput somehow?
Comment 3 Vasily Khoruzhick 2015-03-23 08:28:46 UTC
(In reply to Peter Hutterer from comment #2)

> First a question though: what are the phys. dimensions of the touchpad. Is
> the vertical resolution really wrong?

Physical dimensions are 77mm x 45.1mm

> From a quick manual skim of the event recording it looks like events still
> come at the normal sampling rate (80Hz) but the average movement is
> somewhere around 50 device-units (i.e. almost a mm). So the sensor
> resolution must be pretty awful.

Could be. Mentioned configuration changes horizontal resolution.
Comment 4 Hans de Goede 2015-03-23 11:19:00 UTC
(In reply to Peter Hutterer from comment #2)
> Hans, do you know of any kernel tweaks that may be missing here or do we
> need to work around this in libinput somehow?

No immediate fix comes to my mind, but I've a hard time believing that the touchpad is really that bad, so I think we should investigate things a bit more at the kernel level before looking into a libinput fix. I'll send Benjamin a mail about this.
Comment 5 Vasily Khoruzhick 2015-03-23 12:37:40 UTC
(In reply to Hans de Goede from comment #4)

> No immediate fix comes to my mind, but I've a hard time believing that the
> touchpad is really that bad, so I think we should investigate things a bit
> more at the kernel level before looking into a libinput fix. I'll send
> Benjamin a mail about this.

Well, it was workarounded ealier with xf86-input-synaptics configuration, is it possible to provide the same knobs for libinput?
Comment 6 Hans de Goede 2015-03-23 15:47:48 UTC
Hi,

(In reply to Vasily Khoruzhick from comment #5)
> (In reply to Hans de Goede from comment #4)
> 
> > No immediate fix comes to my mind, but I've a hard time believing that the
> > touchpad is really that bad, so I think we should investigate things a bit
> > more at the kernel level before looking into a libinput fix. I'll send
> > Benjamin a mail about this.
> 
> Well, it was workarounded ealier with xf86-input-synaptics configuration, is
> it possible to provide the same knobs for libinput?

That means adding a whole bunch of code to fix a bug which seems to live elsewhere, so we would rather not do that. I've just got a mail from Benjamin Tissoires that he can reproduce the problem on a x230t and that he is looking into it.

Regards,

Hans
Comment 7 Vasily Khoruzhick 2015-03-23 16:15:49 UTC
(In reply to Hans de Goede from comment #6)
 
> That means adding a whole bunch of code to fix a bug which seems to live
> elsewhere, so we would rather not do that. I've just got a mail from
> Benjamin Tissoires that he can reproduce the problem on a x230t and that he
> is looking into it.

Ok, thanks!

Please note that according to [1] x220 may also be affected

[1] https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/1042069
Comment 8 Benjamin Tissoires 2015-03-23 19:35:41 UTC
So I got my hand on a x230t, and confirmed the behaviour as Hans said. Unfortunately, the raw incoming data seems to be correctly transferred to the user space, and indeed, the X and Y do not change at each report.

I tried looking into the various configuration options that can control the touchpad without much success. One last thing which worries me a little bit is the statement in page 22 of the Synaptics PS/2 interfacing guide 11-000275-01 Rev B:
"The Synaptics Windows drivers operate the pad in Absolute mode. They use advanced algorithms to transform the absolute (X, Y, Z) data into smooth relative cursor motion"

From what I can tell, this is worked around in software by Windows.
Comment 9 Hans de Goede 2015-03-24 07:32:54 UTC
Hi,

(In reply to Benjamin Tissoires from comment #8)
> So I got my hand on a x230t, and confirmed the behaviour as Hans said.
> Unfortunately, the raw incoming data seems to be correctly transferred to
> the user space, and indeed, the X and Y do not change at each report.
> 
> I tried looking into the various configuration options that can control the
> touchpad without much success. One last thing which worries me a little bit
> is the statement in page 22 of the Synaptics PS/2 interfacing guide
> 11-000275-01 Rev B:
> "The Synaptics Windows drivers operate the pad in Absolute mode. They use
> advanced algorithms to transform the absolute (X, Y, Z) data into smooth
> relative cursor motion"
> 
> From what I can tell, this is worked around in software by Windows.

Thanks for looking into this, what I find strange and which is why I still think this is a bug in the lower layers is that:

1) The vertical resolution is fine, I know the touchpad has somewhat non 4:3 dimensions, but even accounting for that the horizontal resolution should not be that much worse

2) The horizontal resolution seems to be aprox 1 coordinate jump per mm, that is a resolution of "1" which is really really bad, unheard of bad really.

I think we should contact synaptics about this and see what they have to say before we start adding some sort of kludge for this to libinput.

Regards,

Hans
Comment 10 Vasily Khoruzhick 2015-03-24 08:34:09 UTC
(In reply to Hans de Goede from comment #9)

> I think we should contact synaptics about this and see what they have to say
> before we start adding some sort of kludge for this to libinput.

Uh-oh, I hope it won't take another year to fix this issue.
Comment 11 Hans de Goede 2015-03-24 08:37:00 UTC
(In reply to Vasily Khoruzhick from comment #10)
> (In reply to Hans de Goede from comment #9)
> 
> > I think we should contact synaptics about this and see what they have to say
> > before we start adding some sort of kludge for this to libinput.
> 
> Uh-oh, I hope it won't take another year to fix this issue.

No worries we've a couple of contacts at synaptics so we usually get an answer pretty quickly.
Comment 12 Peter Hutterer 2015-03-25 04:55:05 UTC
The min/max provided by the touchpad are usually less than what is actually provided. Run libevdev's touchpad-edge-detector to figure out the real min/max for the touchpad and then divide the range by the resolution. With the one announced by the driver the touchpad should only be ~27mm high, even if we account for a 10-20% under-reporting on the range we still don't get near the 45 you measured.

The x220t touchpad is equally bad. Real measured width is [1316, 5627]@75 units/mm. Which would be 57.5mm, real size is 75mm. Height is [1355, 4826]@129 -> 27mm when it's really 42mm.
That aside, I don't notice the jumping problem on the x220t much, and the coordinates seem to be close enough together.
Comment 13 Vasily Khoruzhick 2015-03-25 05:47:43 UTC
(In reply to Peter Hutterer from comment #12)
> The min/max provided by the touchpad are usually less than what is actually
> provided. Run libevdev's touchpad-edge-detector to figure out the real
> min/max for the touchpad and then divide the range by the resolution. With
> the one announced by the driver the touchpad should only be ~27mm high, even
> if we account for a 10-20% under-reporting on the range we still don't get
> near the 45 you measured.
> 
> The x220t touchpad is equally bad. Real measured width is [1316, 5627]@75
> units/mm. Which would be 57.5mm, real size is 75mm. Height is [1355,
> 4826]@129 -> 27mm when it's really 42mm.
> That aside, I don't notice the jumping problem on the x220t much, and the
> coordinates seem to be close enough together.

Kernel says:	x [1472..5768], y [1408..5062]
Touchpad sends:	x [1174..5769], y [793..5202]
Comment 14 Hans de Goede 2015-03-25 08:32:09 UTC
Vasily,

In order to investigate this further synaptics needs the firmware and board ids for your laptop, which the kernel logs on startup, can you do: "dmesg > dmesg.txt" directly after booting the laptop and attach dmesg.txt here please?

Thanks,

Hans
Comment 15 Vasily Khoruzhick 2015-03-25 09:22:46 UTC
Created attachment 114613 [details]
dmesg.txt

Please find dmesg attached. It was made quite a while after booting, but it contains messages from the very beginning.
Comment 16 Benjamin Tissoires 2015-03-26 00:21:57 UTC
Just as a heads up. We talked to synaptics and they asked a little bit of testings. We have one device in the office so I'll be able to progress a little bit tomorrow (hopefully).

We will keep you posted if anything comes out. Thanks for your help so far.
Comment 17 Peter Hutterer 2015-04-27 00:11:10 UTC
commit 26ceea3e3b6dbd83d175ae3b4f862d0792af812c
Author: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Date:   Thu Apr 23 14:32:40 2015 -0400

    evdev: use a different filter for low resolution touchpad on the Lenovo X230

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.