From: Bjørn Forsman Date: Sat, 17 Dec 2022 16:52:39 +0000 (+0100) Subject: tablet: increase pressure offset limit from 20% to 50% X-Git-Tag: 1.24.0~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3dba00845cf0be3425ab4863aac91ba95e391ee0;p=platform%2Fupstream%2Flibinput.git tablet: increase pressure offset limit from 20% to 50% 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 --- 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);