From 1d7172488dcd4148ea7c89e120cd24018522842d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Mon, 16 Jan 2023 19:18:40 +0100 Subject: [PATCH] quirks: touchpad: add ModelPressurePad MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Unlike in traditional touchpads, whose pressure value equals contact size, on pressure pads pressure is a real physical axis. We don't take advantage of the pressure information reported by pressure pads yet, so we disable it to avoid errors. Add a new model quirk for pressure pads instead of disabling ABS_MT_PRESSURE and ABS_PRESSURE. Signed-off-by: José Expósito --- doc/user/device-quirks.rst | 4 ++++ quirks/50-system-dell.quirks | 2 +- quirks/50-system-lenovo.quirks | 4 ++-- src/evdev-mt-touchpad.c | 3 ++- src/quirks.c | 1 + src/quirks.h | 1 + 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/user/device-quirks.rst b/doc/user/device-quirks.rst index d7461b08..deced521 100644 --- a/doc/user/device-quirks.rst +++ b/doc/user/device-quirks.rst @@ -147,6 +147,10 @@ ModelBouncingKeys timestamps can not be relied upon. ModelSynapticsSerialTouchpad Reserved for touchpads made by Synaptics on the serial bus +ModelPressurePad + Unlike in traditional touchpads, whose pressure value equals contact size, + on pressure pads pressure is a real physical axis. + Indicates that the device is a pressure pad. AttrSizeHint=NxM, AttrResolutionHint=N Hints at the width x height of the device in mm, or the resolution of the x/y axis in units/mm. These may only be used where they apply to diff --git a/quirks/50-system-dell.quirks b/quirks/50-system-dell.quirks index b4605c76..a09a3a3a 100644 --- a/quirks/50-system-dell.quirks +++ b/quirks/50-system-dell.quirks @@ -120,4 +120,4 @@ ModelTabletModeNoSuspend=1 MatchBus=i2c MatchVendor=0x27C6 MatchProduct=0x0F60 -AttrEventCode=-ABS_MT_PRESSURE;-ABS_PRESSURE; +ModelPressurePad=1 diff --git a/quirks/50-system-lenovo.quirks b/quirks/50-system-lenovo.quirks index ade45883..551d23c2 100644 --- a/quirks/50-system-lenovo.quirks +++ b/quirks/50-system-lenovo.quirks @@ -147,7 +147,7 @@ AttrTrackpointMultiplier=1.25 MatchBus=i2c MatchVendor=0x06CB MatchProduct=0xCE37 -AttrEventCode=-ABS_MT_PRESSURE;-ABS_PRESSURE; +ModelPressurePad=1 [Lenovo Yoga C930 Tablet] MatchBus=i2c @@ -272,7 +272,7 @@ AttrKeyboardIntegration=internal MatchBus=i2c MatchVendor=0x27C6 MatchProduct=0x01E8 -AttrEventCode=-ABS_MT_PRESSURE;-ABS_PRESSURE; +ModelPressurePad=1 # Duet 7i tablet switch activated by folding keyboard cover, or removing it. # We must not disable volume rocker 'keyboard'. diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index c79133b5..1ccf8037 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -3702,7 +3702,8 @@ tp_init_pressurepad(struct tp_dispatch *tp, * * See also #562 */ - if (libevdev_get_abs_resolution(device->evdev, ABS_MT_PRESSURE) != 0) { + if (libevdev_get_abs_resolution(device->evdev, ABS_MT_PRESSURE) != 0 || + evdev_device_has_model_quirk(device, QUIRK_MODEL_PRESSURE_PAD)) { libevdev_disable_event_code(device->evdev, EV_ABS, ABS_MT_PRESSURE); libevdev_disable_event_code(device->evdev, EV_ABS, ABS_PRESSURE); } diff --git a/src/quirks.c b/src/quirks.c index 0e3006b5..7e916009 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -269,6 +269,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_PRESSURE_PAD: return "ModelPressurePad"; case QUIRK_ATTR_SIZE_HINT: return "AttrSizeHint"; case QUIRK_ATTR_TOUCH_SIZE_RANGE: return "AttrTouchSizeRange"; diff --git a/src/quirks.h b/src/quirks.h index bd96c3af..30878546 100644 --- a/src/quirks.h +++ b/src/quirks.h @@ -86,6 +86,7 @@ enum quirk { QUIRK_MODEL_TOUCHPAD_VISIBLE_MARKER, QUIRK_MODEL_TRACKBALL, QUIRK_MODEL_WACOM_TOUCHPAD, + QUIRK_MODEL_PRESSURE_PAD, _QUIRK_LAST_MODEL_QUIRK_, /* Guard: do not modify */ -- 2.34.1