From fdf896a7640e6b05dbe5cf73752dc7ce671d9386 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 16 Jan 2019 10:05:59 +1000 Subject: [PATCH] quirks: add a quirk to ignore unreliable tablet mode switch devices On the Asus Vivobook Flip 14, the tablet mode switch is unreliable and always on. Instead of marking every device as 'do not suspend', just mark the tablet switch itself. Signed-off-by: Peter Hutterer --- doc/user/device-quirks.rst | 2 ++ quirks/50-system-asus.quirks | 11 +++-------- src/evdev.c | 12 +++++++++--- src/quirks.c | 1 + src/quirks.h | 1 + 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/user/device-quirks.rst b/doc/user/device-quirks.rst index f28600c4..2a449433 100644 --- a/doc/user/device-quirks.rst +++ b/doc/user/device-quirks.rst @@ -144,6 +144,8 @@ ModelTouchpadVisibleMarker ModelTabletModeNoSuspend Indicates that the device does not need to be suspended in :ref:`switches_tablet_mode`. +ModelTabletModeSwitchUnreliable + Indicates that this tablet mode switch's state cannot be relied upon. ModelTrackball Reserved for trackballs ModelBouncingKeys diff --git a/quirks/50-system-asus.quirks b/quirks/50-system-asus.quirks index 86d3dbd3..aa8f89ac 100644 --- a/quirks/50-system-asus.quirks +++ b/quirks/50-system-asus.quirks @@ -20,12 +20,7 @@ AttrEventCodeDisable=ABS_MT_PRESSURE;ABS_PRESSURE; # Asus VivoBook Flip 14 TP412UA tablet switch seems misbehaving, always # indicating tablet position -[Asus TP412UA Keyboard] -MatchName=AT Translated Set 2 keyboard +[Asus TP412UA Tablet Mode Switch] +MatchName=*Intel Virtual Button* MatchDMIModalias=dmi:*svnASUSTeKCOMPUTERINC.:pnVivoBookFlip14_ASUSFlipTP412UA:* -ModelTabletModeNoSuspend=1 - -[Asus TP412UA Touchpad] -MatchName=*ELAN*Touchpad* -MatchDMIModalias=dmi:*svnASUSTeKCOMPUTERINC.:pnVivoBookFlip14_ASUSFlipTP412UA:* -ModelTabletModeNoSuspend=1 +ModelTabletModeSwitchUnreliable=1 diff --git a/src/evdev.c b/src/evdev.c index 928937bc..38c14bf1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1785,9 +1785,15 @@ evdev_configure_device(struct evdev_device *device) } if (libevdev_has_event_code(evdev, EV_SW, SW_TABLET_MODE)) { - device->seat_caps |= EVDEV_DEVICE_SWITCH; - device->tags |= EVDEV_TAG_TABLET_MODE_SWITCH; - evdev_log_info(device, "device is a switch device\n"); + if (evdev_device_has_model_quirk(device, + QUIRK_MODEL_TABLET_MODE_SWITCH_UNRELIABLE)) + evdev_log_info(device, + "device is an unreliable tablet mode switch.\n"); + else + device->tags |= EVDEV_TAG_TABLET_MODE_SWITCH; + + device->seat_caps |= EVDEV_DEVICE_SWITCH; + evdev_log_info(device, "device is a switch device\n"); } } diff --git a/src/quirks.c b/src/quirks.c index fd7fbfd8..687c6941 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -248,6 +248,7 @@ quirk_get_name(enum quirk q) case QUIRK_MODEL_SYSTEM76_GALAGO: return "ModelSystem76Galago"; 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"; diff --git a/src/quirks.h b/src/quirks.h index 1d731a48..577c2fab 100644 --- a/src/quirks.h +++ b/src/quirks.h @@ -80,6 +80,7 @@ enum quirk { QUIRK_MODEL_SYSTEM76_GALAGO, 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, -- 2.34.1