tablet: always enable the proximity out quirk

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>
This commit is contained in:
Peter Hutterer 2019-04-04 14:49:47 +10:00
parent b31d842ac3
commit 9bba14990a
9 changed files with 25 additions and 62 deletions

View file

@ -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.

View file

@ -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',

View file

@ -1,14 +0,0 @@
# Do not edit this file, it will be overwritten on update
# HUION PenTablet device. Some of these devices send a BTN_TOOL_PEN event
# with value 1 on the first event received by the device but never send the
# matching BTN_TOOL_PEN value 0 event. The device appears as if it was
# permanently in proximity.
#
# HUION re-uses USB IDs for its devices, not every HUION tablet is
# affected by this bug, libinput will auto-disable this feature
[HUION PenTablet]
MatchUdevType=tablet
MatchBus=usb
MatchVendor=0x256C
ModelTabletNoProximityOut=1

View file

@ -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

View file

@ -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;
@ -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;
}
@ -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),

View file

@ -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";

View file

@ -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,

View file

@ -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,
@ -102,5 +97,4 @@ TEST_DEVICE("huion-tablet",
.id = &input_id,
.events = events,
.absinfo = absinfo,
.quirk_file = quirk_file,
)

View file

@ -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();
@ -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);
@ -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);
@ -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);
@ -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);
@ -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);
@ -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);
@ -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);