tablet: increase pressure offset limit from 20% to 50%
authorBjørn Forsman <bjorn.forsman@gmail.com>
Sat, 17 Dec 2022 16:52:39 +0000 (17:52 +0100)
committerBjørn Forsman <bjorn.forsman@gmail.com>
Thu, 24 Aug 2023 06:04:03 +0000 (08:04 +0200)
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 <bjorn.forsman@gmail.com>
doc/user/tablet-support.rst
src/evdev-tablet.c
test/test-tablet.c

index c9adb81408a41bb0f7661a6037ef68d7d7072d9c..2c09684b492876b0205fb997578bd4128a91586f 100644 (file)
@@ -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.
index 42be740726bfc5cce4c625ce7304300b80ac54c9..c290845c26abeb4f09aeea2d6f90fd3e3f4de1c7 100644 (file)
@@ -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,
index edf47224d17a92d48a33a33bff5df58fa2f63566..81eae936cdde11ac7fbc6d3bdbb746eab4ca12a7 100644 (file)
@@ -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);