Skip to content

Commit

Permalink
tablet: always enable the proximity out quirk
Browse files Browse the repository at this point in the history
Don't require a quirk update, just enable this by default for all tablets. If
we get a proximity out event at the right time, the quirk is disabled for that
tablet for the rest of its lifetime. And it's virtually impossible to have a
false positive here anyway - you cannot hold the pen still enough to not
trigger events for 50ms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Apr 8, 2019
1 parent b31d842 commit 9bba149
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 62 deletions.
3 changes: 0 additions & 3 deletions doc/user/device-quirks.rst
Expand Up @@ -135,9 +135,6 @@ ModelALPSTouchpad, ModelAppleTouchpad, ModelWacomTouchpad, ModelChromebook
ModelTabletNoTilt
Indicates that the tablet stylus does not provide tilt axis
information, even if the kernel exposes that axis.
ModelTabletNoProximityOut
Indicates that the tablet stylus does not send correct proximity out
events.
ModelTouchpadVisibleMarker
Indicates the touchpad has a drawn-on visible marker between the software
buttons.
Expand Down
1 change: 0 additions & 1 deletion meson.build
Expand Up @@ -252,7 +252,6 @@ quirks_data = [
'quirks/30-vendor-contour.quirks',
'quirks/30-vendor-cyapa.quirks',
'quirks/30-vendor-elantech.quirks',
'quirks/30-vendor-huion.quirks',
'quirks/30-vendor-ibm.quirks',
'quirks/30-vendor-kensington.quirks',
'quirks/30-vendor-logitech.quirks',
Expand Down
14 changes: 0 additions & 14 deletions quirks/30-vendor-huion.quirks

This file was deleted.

6 changes: 0 additions & 6 deletions quirks/50-system-hp.quirks
Expand Up @@ -41,9 +41,3 @@ MatchDMIModalias=dmi:*svnHP:pnHPSpectrex360Convertible15-bl1XX:*
AttrPressureRange=55:40
AttrThumbPressureThreshold=90
AttrPalmPressureThreshold=100

[HP Spectre x360 Convertible 13-ap0xxx]
MatchUdevType=tablet
MatchName=ELAN2514:00 04F3:2812
MatchDMIModalias=dmi:*svnHP:pnHPSpectrex360Convertible13-ap0xxx:*
ModelTabletNoProximityOut=1
11 changes: 3 additions & 8 deletions src/evdev-tablet.c
Expand Up @@ -2157,7 +2157,6 @@ tablet_init(struct tablet_dispatch *tablet,
{
struct libevdev *evdev = device->evdev;
enum libinput_tablet_tool_axis axis;
bool want_proximity_quirk = false;
int rc;

tablet->base.dispatch_type = DISPATCH_TABLET;
Expand All @@ -2173,7 +2172,6 @@ tablet_init(struct tablet_dispatch *tablet,

if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN)) {
libevdev_enable_event_code(evdev, EV_KEY, BTN_TOOL_PEN, NULL);
want_proximity_quirk = true;
tablet->quirks.proximity_out_forced = true;
}

Expand Down Expand Up @@ -2201,12 +2199,9 @@ tablet_init(struct tablet_dispatch *tablet,

tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY);

if (evdev_device_has_model_quirk(device,
QUIRK_MODEL_TABLET_NO_PROXIMITY_OUT))
want_proximity_quirk = true;

if (want_proximity_quirk)
tablet->quirks.need_to_force_prox_out = true;
/* 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),
Expand Down
1 change: 0 additions & 1 deletion src/quirks.c
Expand Up @@ -250,7 +250,6 @@ quirk_get_name(enum quirk q)
case QUIRK_MODEL_SYSTEM76_KUDU: return "ModelSystem76Kudu";
case QUIRK_MODEL_TABLET_MODE_NO_SUSPEND: return "ModelTabletModeNoSuspend";
case QUIRK_MODEL_TABLET_MODE_SWITCH_UNRELIABLE: return "ModelTabletModeSwitchUnreliable";
case QUIRK_MODEL_TABLET_NO_PROXIMITY_OUT: return "ModelTabletNoProximityOut";
case QUIRK_MODEL_TABLET_NO_TILT: return "ModelTabletNoTilt";
case QUIRK_MODEL_TOUCHPAD_VISIBLE_MARKER: return "ModelTouchpadVisibleMarker";
case QUIRK_MODEL_TRACKBALL: return "ModelTrackball";
Expand Down
1 change: 0 additions & 1 deletion src/quirks.h
Expand Up @@ -82,7 +82,6 @@ enum quirk {
QUIRK_MODEL_SYSTEM76_KUDU,
QUIRK_MODEL_TABLET_MODE_NO_SUSPEND,
QUIRK_MODEL_TABLET_MODE_SWITCH_UNRELIABLE,
QUIRK_MODEL_TABLET_NO_PROXIMITY_OUT,
QUIRK_MODEL_TABLET_NO_TILT,
QUIRK_MODEL_TOUCHPAD_VISIBLE_MARKER,
QUIRK_MODEL_TRACKBALL,
Expand Down
6 changes: 0 additions & 6 deletions test/litest-device-huion-pentablet.c
Expand Up @@ -88,11 +88,6 @@ static int events[] = {
-1, -1,
};

static const char quirk_file[] =
"[litest HUION tablet]\n"
"MatchName=litest HUION PenTablet Pen\n"
"ModelTabletNoProximityOut=1\n";

TEST_DEVICE("huion-tablet",
.type = LITEST_HUION_TABLET,
.features = LITEST_TABLET | LITEST_HOVER,
Expand All @@ -102,5 +97,4 @@ TEST_DEVICE("huion-tablet",
.id = &input_id,
.events = events,
.absinfo = absinfo,
.quirk_file = quirk_file,
)
44 changes: 22 additions & 22 deletions test/test-tablet.c
Expand Up @@ -291,18 +291,6 @@ START_TEST(tip_down_prox_in)
}
END_TEST

static inline bool
tablet_has_proxout_quirk(struct litest_device *dev)
{
bool is_set = false;
if (!quirks_get_bool(dev->quirks,
QUIRK_MODEL_TABLET_NO_PROXIMITY_OUT,
&is_set))
return false;

return is_set;
}

START_TEST(tip_up_prox_out)
{
struct litest_device *dev = litest_current_device();
Expand All @@ -315,9 +303,6 @@ START_TEST(tip_up_prox_out)
{ -1, -1 }
};

if (tablet_has_proxout_quirk(dev))
return;

litest_tablet_proximity_in(dev, 10, 10, axes);
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
Expand Down Expand Up @@ -4390,6 +4375,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);

Expand All @@ -4400,17 +4389,17 @@ START_TEST(touch_arbitration_outside_rect)
litest_drain_events(li);

/* left of rect */
litest_touch_sequence(finger, 0, x - 10, y + 2, x - 10, y + 20, 30);
litest_touch_sequence(finger, 0, x - 10, y + 2, x - 10, y + 20, 3);
libinput_dispatch(li);
litest_assert_touch_sequence(li);

/* above rect */
litest_touch_sequence(finger, 0, x + 2, y - 35, x + 20, y - 10, 30);
litest_touch_sequence(finger, 0, x + 2, y - 35, x + 20, y - 10, 3);
libinput_dispatch(li);
litest_assert_touch_sequence(li);

/* right of rect */
litest_touch_sequence(finger, 0, x + 80, y + 2, x + 20, y + 10, 30);
litest_touch_sequence(finger, 0, x + 80, y + 2, x + 20, y + 10, 3);
libinput_dispatch(li);
litest_assert_touch_sequence(li);

Expand Down Expand Up @@ -4495,6 +4484,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);

Expand All @@ -4504,6 +4498,12 @@ START_TEST(touch_arbitration_stop_touch)
litest_drain_events(li);

litest_touch_move_to(finger, 0, 80, 80, 30, 30, 10);
litest_assert_empty_queue(li);

/* tablet event so we don't time out for proximity */
litest_tablet_motion(dev, 30, 40, axes);
litest_drain_events(li);

/* start another finger to make sure that one doesn't send events
either */
litest_touch_down(finger, 1, 30, 30);
Expand All @@ -4517,6 +4517,9 @@ START_TEST(touch_arbitration_stop_touch)
litest_tablet_proximity_out(dev);
litest_drain_events(li);

litest_timeout_tablet_proxout();
litest_drain_events(li);

/* Finger needs to be lifted for events to happen*/
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
litest_assert_empty_queue(li);
Expand All @@ -4528,11 +4531,8 @@ START_TEST(touch_arbitration_stop_touch)
litest_touch_up(finger, 1);
libinput_dispatch(li);

litest_timeout_touch_arbitration();
libinput_dispatch(li);

litest_touch_down(finger, 0, 30, 30);
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 3);
litest_touch_up(finger, 0);
libinput_dispatch(li);

Expand Down

0 comments on commit 9bba149

Please sign in to comment.