From 3dba00845cf0be3425ab4863aac91ba95e391ee0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Forsman?= Date: Sat, 17 Dec 2022 17:52:39 +0100 Subject: [PATCH] tablet: increase pressure offset limit from 20% to 50% MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit detect_pressure_offset() currently rejects offsets that are greater than 20%. My graphics tablet (Wacom Bamboo Fun) is about 30%. The pen tip is 2 mm. Wacom recommends replacing at 1 mm, which means this isn't worn out yet and we should instead increase the limit to make these devices usable. Without this change a "pen down" event happens simultaneously with the pen being detected -- about 1 cm above the surface -- and producing libinput pressure of about 0.30. This means you start drawing "in the air", without knowing up front where the cursor is going to be. Signed-off-by: Bjørn Forsman --- doc/user/tablet-support.rst | 4 ++-- src/evdev-tablet.c | 4 ++-- test/test-tablet.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/user/tablet-support.rst b/doc/user/tablet-support.rst index c9adb814..2c09684b 100644 --- a/doc/user/tablet-support.rst +++ b/doc/user/tablet-support.rst @@ -180,8 +180,8 @@ specifically: capable of detection distances, - pressure offset is only detected if the distance between the tool and the tablet is high enough, -- pressure offset is only used if it is 20% or less of the pressure range - available to the tool. A pressure offset higher than 20% indicates either +- pressure offset is only used if it is 50% or less of the pressure range + available to the tool. A pressure offset higher than 50% indicates either a misdetection or a tool that should be replaced, and - if a pressure value less than the current pressure offset is seen, the offset resets to that value. diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 42be7407..c290845c 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -1418,9 +1418,9 @@ detect_pressure_offset(struct tablet_dispatch *tablet, if (offset <= pressure->minimum) return; - if (offset > axis_range_percentage(pressure, 20)) { + if (offset > axis_range_percentage(pressure, 50)) { evdev_log_error(device, - "Ignoring pressure offset greater than 20%% detected on tool %s (serial %#x). " + "Ignoring pressure offset greater than 50%% detected on tool %s (serial %#x). " "See %s/tablet-support.html\n", tablet_tool_type_to_string(tool->type), tool->serial, diff --git a/test/test-tablet.c b/test/test-tablet.c index edf47224..81eae936 100644 --- a/test/test-tablet.c +++ b/test/test-tablet.c @@ -4115,7 +4115,7 @@ START_TEST(tablet_pressure_offset_exceed_threshold) struct libinput *li = dev->libinput; struct axis_replacement axes[] = { { ABS_DISTANCE, 70 }, - { ABS_PRESSURE, 30 }, + { ABS_PRESSURE, 60 }, { -1, -1 }, }; int warning_triggered = 0; @@ -4137,7 +4137,7 @@ START_TEST(tablet_pressure_offset_exceed_threshold) libinput_log_set_handler(li, pressure_threshold_warning); litest_tablet_proximity_in(dev, 5, 100, axes); libinput_dispatch(li); - assert_pressure(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, 0.30); + assert_pressure(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, 0.60); ck_assert_int_eq(warning_triggered, 1); litest_restore_log_handler(li); -- 2.34.1