mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 04:30:06 +01:00
tablet: disable the forced proximity out for the Dell Canvas pen
This pen has random timeouts, often when a button is pressed. This causes a forced proximity out (and the button release) and makes the whole device a tad unusable. Nothing we can detect by heuristics since it looks like other devices that don't send proximity out events. And the timeout can be quite high, the recording in #304 has over 800ms for one sequence. Fixes #304 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
d13e11c24f
commit
9cb089f2b6
9 changed files with 161 additions and 2 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
110
test/litest-device-wacom-isdv4-4200-pen.c
Normal file
110
test/litest-device-wacom-isdv4-4200-pen.c
Normal file
|
|
@ -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,
|
||||
)
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue