diff options
author | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2017-11-09 23:44:33 +0100 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2017-12-08 13:54:43 -0800 |
commit | 95f38fd46cc5e45a0d5224f486e805d17ea3d93f (patch) | |
tree | 7fdb41335e305c8ae1cb39420c66a8df92d82275 /drivers/platform | |
parent | 1c828496228deb7a080362bbdf8e70c50bc924b4 (diff) |
platform/x86: intel-vbtn: Support separate press/release events
Currently all key events use autorelease, but this forbids use as a
modifier key.
As all event codes come in even/odd pairs, we can lookup the key type
(KE_KEY/KE_IGNORE) for the key up event corresponding to the currently
handled key down event. If the key up is ignored, we keep setting the
autorelease flag for the key down.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/intel-vbtn.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c index ae55be91a64b..e3f6375af85c 100644 --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -76,14 +76,27 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) { struct platform_device *device = context; struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev); + const struct key_entry *ke_rel; + bool autorelease; if (priv->wakeup_mode) { if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) { pm_wakeup_hard_event(&device->dev); return; } - } else if (sparse_keymap_report_event(priv->input_dev, event, 1, true)) { - return; + } else { + /* Use the fact press/release come in even/odd pairs */ + if ((event & 1) && sparse_keymap_report_event(priv->input_dev, + event, 0, false)) + return; + + ke_rel = sparse_keymap_entry_from_scancode(priv->input_dev, + event | 1); + autorelease = !ke_rel || ke_rel->type == KE_IGNORE; + + if (sparse_keymap_report_event(priv->input_dev, event, 1, + autorelease)) + return; } dev_dbg(&device->dev, "unknown event index 0x%x\n", event); } |