tablet: set the tip-up pressure threshold to 1%

Some pens keep sending small amounts of pressure even when the tip is up. This
isn't always a sign of the pens worn out, it also happens on the new Pro Pen
3D models.

The X driver uses a default threshould of ~1.3% to paper over this, let's do
the same with a 1% threshold. This threshold only applies to pens that don't
already have a pressure offset anyway.

https://bugs.freedesktop.org/show_bug.cgi?id=103086

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-12-08 12:35:11 +10:00
parent 1c8636923b
commit 61bdc05fb0
2 changed files with 4 additions and 3 deletions

View file

@ -1057,11 +1057,11 @@ tablet_get_tool(struct tablet_dispatch *tablet,
if (pressure) {
tool->pressure_offset = pressure->minimum;
/* 5% of the pressure range */
/* 5 and 1% of the pressure range */
tool->pressure_threshold.upper =
axis_range_percentage(pressure, 5);
tool->pressure_threshold.lower =
pressure->minimum;
axis_range_percentage(pressure, 1);
}
tool_set_bits(tablet, tool);
@ -1246,6 +1246,7 @@ detect_pressure_offset(struct tablet_dispatch *tablet,
LIBINPUT_VERSION);
tool->pressure_offset = offset;
tool->has_pressure_offset = true;
tool->pressure_threshold.lower = pressure->minimum;
}
static void

View file

@ -3458,7 +3458,7 @@ START_TEST(tablet_pressure_range)
litest_drain_events(li);
libinput_dispatch(li);
for (pressure = 1; pressure <= 100; pressure += 10) {
for (pressure = 10; pressure <= 100; pressure += 10) {
litest_axis_set_value(axes, ABS_PRESSURE, pressure);
litest_tablet_motion(dev, 70, 70, axes);
libinput_dispatch(li);