summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build1
-rw-r--r--quirks/30-vendor-wacom.quirks8
-rw-r--r--src/evdev-tablet.c11
-rw-r--r--src/evdev-tablet.h1
-rw-r--r--src/quirks.c1
-rw-r--r--src/quirks.h1
-rw-r--r--test/litest-device-wacom-isdv4-4200-pen.c110
-rw-r--r--test/litest.h1
-rw-r--r--test/test-tablet.c29
9 files changed, 161 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 8dbfd7f9..b908a14b 100644
--- a/meson.build
+++ b/meson.build
@@ -770,6 +770,7 @@ if get_option('tests')
'test/litest-device-wacom-intuos5-finger.c',
'test/litest-device-wacom-intuos5-pad.c',
'test/litest-device-wacom-intuos5-pen.c',
+ 'test/litest-device-wacom-isdv4-4200-pen.c',
'test/litest-device-wacom-isdv4-e6-pen.c',
'test/litest-device-wacom-isdv4-e6-finger.c',
'test/litest-device-wacom-mobilestudio-pro-pad.c',
diff --git a/quirks/30-vendor-wacom.quirks b/quirks/30-vendor-wacom.quirks
index 02dec5f3..73ccf2f1 100644
--- a/quirks/30-vendor-wacom.quirks
+++ b/quirks/30-vendor-wacom.quirks
@@ -12,3 +12,11 @@ MatchBus=usb
MatchVendor=0x056A
MatchProduct=0x0357
AttrPalmSizeThreshold=5
+
+[Wacom ISDV4 Pen]
+MatchUdevType=tablet
+MatchBus=usb
+MatchVendor=0x56A
+MatchProduct=0x4200
+ModelWacomISDV4Pen=1
+AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;
diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 279e93b8..f717d30e 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -1702,8 +1702,9 @@ static inline void
tablet_proximity_out_quirk_set_timer(struct tablet_dispatch *tablet,
uint64_t time)
{
- libinput_timer_set(&tablet->quirks.prox_out_timer,
- time + FORCED_PROXOUT_TIMEOUT);
+ if (tablet->quirks.need_to_force_prox_out)
+ libinput_timer_set(&tablet->quirks.prox_out_timer,
+ time + FORCED_PROXOUT_TIMEOUT);
}
static void
@@ -2313,6 +2314,12 @@ 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;
+ 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),
"proxout",
diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h
index e288fc79..ab95b614 100644
--- a/src/evdev-tablet.h
+++ b/src/evdev-tablet.h
@@ -102,6 +102,7 @@ struct tablet_dispatch {
} rotation;
struct {
+ bool need_to_force_prox_out;
struct libinput_timer prox_out_timer;
bool proximity_out_forced;
uint64_t last_event_time;
diff --git a/src/quirks.c b/src/quirks.c
index df82a569..a4e7c76c 100644
--- a/src/quirks.c
+++ b/src/quirks.c
@@ -253,6 +253,7 @@ 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";
diff --git a/src/quirks.h b/src/quirks.h
index 77044433..1e6232d8 100644
--- a/src/quirks.h
+++ b/src/quirks.h
@@ -85,6 +85,7 @@ 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 */
diff --git a/test/litest-device-wacom-isdv4-4200-pen.c b/test/litest-device-wacom-isdv4-4200-pen.c
new file mode 100644
index 00000000..2627138f
--- /dev/null
+++ b/test/litest-device-wacom-isdv4-4200-pen.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "litest.h"
+#include "litest-int.h"
+
+static struct input_event proximity_in[] = {
+ { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 },
+ { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+ { .type = -1, .code = -1 },
+};
+
+static struct input_event proximity_out[] = {
+ { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 },
+ { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+ { .type = -1, .code = -1 },
+};
+
+static struct input_event motion[] = {
+ { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+ { .type = -1, .code = -1 },
+};
+
+static int
+get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
+{
+ switch (evcode) {
+ case ABS_PRESSURE:
+ *value = 4000;
+ return 0;
+ case ABS_TILT_X:
+ case ABS_TILT_Y:
+ abort();
+ }
+ return 1;
+}
+
+static struct litest_device_interface interface = {
+ .tablet_proximity_in_events = proximity_in,
+ .tablet_proximity_out_events = proximity_out,
+ .tablet_motion_events = motion,
+
+ .get_axis_default = get_axis_default,
+};
+
+static struct input_absinfo absinfo[] = {
+ { ABS_X, 0, 59674, 0, 0, 100 },
+ { ABS_Y, 0, 33566, 0, 0, 100 },
+ /* This pen has tilt, but doesn't send events */
+ { ABS_TILT_X, -9000, 9000, 0, 0, 5730 },
+ { ABS_TILT_Y, -9000, 9000, 0, 0, 5730 },
+ { ABS_PRESSURE, 0, 4096, 0, 0, 0 },
+ { .value = -1 },
+};
+
+static struct input_id input_id = {
+ .bustype = 0x3,
+ .vendor = 0x56a,
+ .product = 0x4200,
+};
+
+static int events[] = {
+ EV_KEY, BTN_TOOL_PEN,
+ EV_KEY, BTN_TOOL_RUBBER,
+ EV_KEY, BTN_TOUCH,
+ EV_KEY, BTN_STYLUS,
+ EV_KEY, BTN_STYLUS2,
+ EV_KEY, BTN_STYLUS3,
+ INPUT_PROP_MAX, INPUT_PROP_DIRECT,
+ -1, -1,
+};
+
+TEST_DEVICE("wacom-isdv4-4200-tablet",
+ .type = LITEST_WACOM_ISDV4_4200_PEN,
+ .features = LITEST_TABLET|LITEST_HOVER,
+ .interface = &interface,
+
+ .name = "Wacom ISD-V4 Pen",
+ .id = &input_id,
+ .events = events,
+ .absinfo = absinfo,
+)
diff --git a/test/litest.h b/test/litest.h
index c02943bf..af63877c 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -299,6 +299,7 @@ enum litest_device_type {
LITEST_TOUCHSCREEN_MT_TOOL_TYPE,
LITEST_DELL_CANVAS_TOTEM,
LITEST_DELL_CANVAS_TOTEM_TOUCH,
+ LITEST_WACOM_ISDV4_4200_PEN,
};
enum litest_device_feature {
diff --git a/test/test-tablet.c b/test/test-tablet.c
index 12beba9f..5f652613 100644
--- a/test/test-tablet.c
+++ b/test/test-tablet.c
@@ -1532,6 +1532,34 @@ START_TEST(proximity_out_slow_event)
}
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();
@@ -5678,6 +5706,7 @@ TEST_COLLECTION(tablet)
litest_add("tablet:proximity", proximity_range_button_press, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
litest_add("tablet:proximity", proximity_range_button_release, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
litest_add("tablet:proximity", proximity_out_slow_event, 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);