Revert "tablet: don't disable the proximity quirk on good sequences"
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 22 Mar 2020 11:21:52 +0000 (21:21 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 22 May 2020 03:10:06 +0000 (03:10 +0000)
This quirk was introduced for #248 was caused by buggy input-wacom drivers,
not by actual firmware, see
https://gitlab.freedesktop.org/libinput/libinput/issues/381#note_279371

This appears to be the only tablet where this fix was needed, but we've been
playing whack-a-mole ever since to work around the various other tablets that
break with this behavior in place.

So let's revert that fix and hope there aren't any other tablets out there
(and if they are, we can probably quirk those). The revert makes the ISDV4 pen
quirk obsolete (see 9cb089f2b68ba21877ea0973c08837cf073679c8), so this was
folded into this commit.

This reverts commit 4f63345b60762e9a1c1e229a85058232e6f93ae6.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
quirks/30-vendor-wacom.quirks
src/evdev-tablet.c
src/evdev-tablet.h
src/quirks.c
src/quirks.h
test/test-tablet.c

index 73ccf2f..4274811 100644 (file)
@@ -18,5 +18,4 @@ MatchUdevType=tablet
 MatchBus=usb
 MatchVendor=0x56A
 MatchProduct=0x4200
-ModelWacomISDV4Pen=1
 AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;
index dc7eebf..a05aab0 100644 (file)
@@ -1827,11 +1827,10 @@ tablet_update_tool_state(struct tablet_dispatch *tablet,
                         * events it means the tablet will give us the right
                         * events after all and we can disable our
                         * timer-based proximity out.
-                        *
-                        * We can't do so permanently though, some tablets
-                        * send the correct event sequence occasionally but
-                        * are broken otherwise.
                         */
+                       if (!tablet->quirks.proximity_out_in_progress)
+                               tablet->quirks.need_to_force_prox_out = false;
+
                        libinput_timer_cancel(&tablet->quirks.prox_out_timer);
                }
        }
@@ -2012,12 +2011,14 @@ tablet_proximity_out_quirk_timer_func(uint64_t now, void *data)
 
        evdev_log_debug(tablet->device, "tablet: forcing proximity after timeout\n");
 
+       tablet->quirks.proximity_out_in_progress = true;
        ARRAY_FOR_EACH(events, e) {
                tablet->base.interface->process(&tablet->base,
                                                 tablet->device,
                                                 e,
                                                 now);
        }
+       tablet->quirks.proximity_out_in_progress = false;
 
        tablet->quirks.proximity_out_forced = true;
 }
@@ -2181,7 +2182,8 @@ tablet_check_initial_proximity(struct evdev_device *device,
                return;
 
        tablet_update_tool(tablet, device, tool, state);
-       tablet_proximity_out_quirk_set_timer(tablet, libinput_now(li));
+       if (tablet->quirks.need_to_force_prox_out)
+               tablet_proximity_out_quirk_set_timer(tablet, libinput_now(li));
 
        tablet->current_tool.id =
                libevdev_get_event_value(device->evdev,
@@ -2402,8 +2404,6 @@ tablet_init(struct tablet_dispatch *tablet,
        /* We always enable the proximity out quirk, but disable it once a
           device gives us the right event sequence */
        tablet->quirks.need_to_force_prox_out = true;
-       if (evdev_device_has_model_quirk(device, QUIRK_MODEL_WACOM_ISDV4_PEN))
-               tablet->quirks.need_to_force_prox_out = false;
 
        libinput_timer_init(&tablet->quirks.prox_out_timer,
                            tablet_libinput_context(tablet),
index 52806d4..34d5b99 100644 (file)
@@ -107,6 +107,9 @@ struct tablet_dispatch {
                struct libinput_timer prox_out_timer;
                bool proximity_out_forced;
                uint64_t last_event_time;
+
+               /* true while injecting BTN_TOOL_PEN events */
+               bool proximity_out_in_progress;
        } quirks;
 };
 
index 3f91303..68e0a21 100644 (file)
@@ -254,7 +254,6 @@ quirk_get_name(enum quirk q)
        case QUIRK_MODEL_TOUCHPAD_VISIBLE_MARKER:       return "ModelTouchpadVisibleMarker";
        case QUIRK_MODEL_TRACKBALL:                     return "ModelTrackball";
        case QUIRK_MODEL_WACOM_TOUCHPAD:                return "ModelWacomTouchpad";
-       case QUIRK_MODEL_WACOM_ISDV4_PEN:               return "ModelWacomISDV4Pen";
        case QUIRK_MODEL_DELL_CANVAS_TOTEM:             return "ModelDellCanvasTotem";
 
        case QUIRK_ATTR_SIZE_HINT:                      return "AttrSizeHint";
index 16f6cd9..408236e 100644 (file)
@@ -87,7 +87,6 @@ enum quirk {
        QUIRK_MODEL_TOUCHPAD_VISIBLE_MARKER,
        QUIRK_MODEL_TRACKBALL,
        QUIRK_MODEL_WACOM_TOUCHPAD,
-       QUIRK_MODEL_WACOM_ISDV4_PEN,
        QUIRK_MODEL_DELL_CANVAS_TOTEM,
 
        _QUIRK_LAST_MODEL_QUIRK_, /* Guard: do not modify */
index 2e60418..f516b40 100644 (file)
@@ -1611,34 +1611,6 @@ START_TEST(proximity_out_not_during_buttonpress)
 }
 END_TEST
 
-START_TEST(proximity_out_no_timeout)
-{
-       struct litest_device *dev = litest_current_device();
-       struct libinput *li = dev->libinput;
-       struct axis_replacement axes[] = {
-               { ABS_PRESSURE, 0 },
-               { -1, -1 }
-       };
-
-       litest_drain_events(li);
-
-       litest_tablet_proximity_in(dev, 10, 10, axes);
-       litest_assert_tablet_proximity_event(li,
-                                            LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
-       litest_tablet_motion(dev, 12, 12, axes);
-       litest_drain_events(li);
-
-       litest_timeout_tablet_proxout();
-       litest_assert_empty_queue(li);
-
-       litest_tablet_proximity_out(dev);
-       /* The forced prox out */
-       litest_assert_tablet_proximity_event(li,
-                                            LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
-       litest_assert_empty_queue(li);
-}
-END_TEST
-
 START_TEST(proximity_out_on_delete)
 {
        struct libinput *li = litest_create_context();
@@ -4776,6 +4748,10 @@ START_TEST(touch_arbitration_outside_rect)
        x = 20;
        y = 45;
 
+       /* disable prox-out timer quirk */
+       litest_tablet_proximity_in(dev, x, y - 1, axes);
+       litest_tablet_proximity_out(dev);
+
        litest_tablet_proximity_in(dev, x, y - 1, axes);
        litest_drain_events(li);
 
@@ -4789,25 +4765,16 @@ START_TEST(touch_arbitration_outside_rect)
        litest_touch_sequence(finger, 0, x - 10, y + 2, x - 10, y + 20, 3);
        libinput_dispatch(li);
        litest_assert_touch_sequence(li);
-       /* tablet event so we don't time out for proximity */
-       litest_tablet_motion(dev, x, y - 0.1, axes);
-       litest_drain_events(li);
 
        /* above rect */
        litest_touch_sequence(finger, 0, x + 2, y - 35, x + 20, y - 10, 3);
        libinput_dispatch(li);
        litest_assert_touch_sequence(li);
-       /* tablet event so we don't time out for proximity */
-       litest_tablet_motion(dev, x, y + 0.1, axes);
-       litest_drain_events(li);
 
        /* right of rect */
        litest_touch_sequence(finger, 0, x + 80, y + 2, x + 20, y + 10, 3);
        libinput_dispatch(li);
        litest_assert_touch_sequence(li);
-       /* tablet event so we don't time out for proximity */
-       litest_tablet_motion(dev, x, y - 0.1, axes);
-       litest_drain_events(li);
 
 #if 0
        /* This *should* work but the Cintiq test devices is <200mm
@@ -4890,6 +4857,11 @@ START_TEST(touch_arbitration_stop_touch)
 
        is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
 
+       /* disable prox-out timer quirk */
+       litest_tablet_proximity_in(dev, 30, 30, axes);
+       litest_tablet_proximity_out(dev);
+       litest_drain_events(li);
+
        litest_touch_down(finger, 0, 30, 30);
        litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
 
@@ -5914,8 +5886,6 @@ TEST_COLLECTION(tablet)
        litest_add("tablet:proximity", proximity_out_slow_event, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
        litest_add("tablet:proximity", proximity_out_not_during_contact, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
        litest_add("tablet:proximity", proximity_out_not_during_buttonpress, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
-       litest_add_for_device("tablet:proximity", proximity_out_no_timeout, LITEST_WACOM_ISDV4_4200_PEN);
-
        litest_add_no_device("tablet:proximity", proximity_out_on_delete);
        litest_add("tablet:button", button_down_up, LITEST_TABLET, LITEST_ANY);
        litest_add("tablet:button", button_seat_count, LITEST_TABLET, LITEST_ANY);