Commit 4f63345b authored by Peter Hutterer's avatar Peter Hutterer

tablet: don't disable the proximity quirk on good sequences

There are tablets out there that *sometimes* send the right event sequence,
but are generally broken. So let's not disable that quirk even if we do get a
right sequence.

Affected devices: Lenovo Flex 5
Fixes #248
Fixes #290Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 8b3aca4c
Pipeline #39005 failed with stages
in 4 minutes and 21 seconds
......@@ -1718,10 +1718,11 @@ 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);
}
}
......@@ -1873,14 +1874,12 @@ 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;
}
......@@ -2018,8 +2017,7 @@ tablet_check_initial_proximity(struct evdev_device *device,
return;
tablet_update_tool(tablet, device, tool, state);
if (tablet->quirks.need_to_force_prox_out)
tablet_proximity_out_quirk_set_timer(tablet, libinput_now(li));
tablet_proximity_out_quirk_set_timer(tablet, libinput_now(li));
tablet->current_tool.id =
libevdev_get_event_value(device->evdev,
......@@ -2212,10 +2210,6 @@ tablet_init(struct tablet_dispatch *tablet,
tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY);
/* 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;
libinput_timer_init(&tablet->quirks.prox_out_timer,
tablet_libinput_context(tablet),
"proxout",
......
......@@ -92,13 +92,9 @@ struct tablet_dispatch {
enum evdev_arbitration_state arbitration;
struct {
bool need_to_force_prox_out;
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;
};
......
......@@ -4514,10 +4514,6 @@ 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);
......@@ -4531,16 +4527,25 @@ 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
......@@ -4623,11 +4628,6 @@ 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment