tablet: always enable the proximity out quirk
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 4 Apr 2019 04:49:47 +0000 (14:49 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 8 Apr 2019 01:19:19 +0000 (11:19 +1000)
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>
doc/user/device-quirks.rst
meson.build
quirks/30-vendor-huion.quirks [deleted file]
quirks/50-system-hp.quirks
src/evdev-tablet.c
src/quirks.c
src/quirks.h
test/litest-device-huion-pentablet.c
test/test-tablet.c

index 2a4494331fbbbeac040e72ede20dc7c8c8d2f890..6486b1f3e605d23efceb8841ed48af6569baaa85 100644 (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.
index ccdc56134c94bc6cda1e06fb4fc7db93d725aeb1..6a6dad2b243477106c1e1ecee45af51a8178aa7b 100644 (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',
diff --git a/quirks/30-vendor-huion.quirks b/quirks/30-vendor-huion.quirks
deleted file mode 100644 (file)
index 0e46d20..0000000
+++ /dev/null
@@ -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
index 4ce73067ecdf2d3cb8363ecda93c5f53875df6a5..3f38a5e1d86d89aa2eaed50d505e0ce7f88ba78e 100644 (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
index fded69e4b0568c9c78b5b61309d46903bb910062..e5db5c22481894f36a7ecabdeb0e30dc75363b25 100644 (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),
index 8336860b1eaded4d080c0943ff043b6a453cfa96..85db3b78162c3146b9be0264004eef92e5bb5a67 100644 (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";
index e269e999e297bf4936a43946feef89fcda994e82..b0e69d2158e33c26dcd1d031d2ad7d6ef1f46a0e 100644 (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,
index 4236ffd7e336877ece9ee322c46b819a51d6ae00..fbf1ae8e0b6c345035475b82b674daed5db939ca 100644 (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,
 )
index 7ed3b00da99f0ac8d728a6b41bc79f08dfaf5100..97a86e247bbfa05a30c8602ce308a77d57d42986 100644 (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);