diff options
author | Stefan Seyfried <stefan.seyfried@googlemail.com> | 2014-03-02 18:01:19 +0100 |
---|---|---|
committer | Matthew Garrett <matthew.garrett@nebula.com> | 2014-04-06 12:58:11 -0400 |
commit | 58c688657c73a6a87aa9ea414d510b5827cec298 (patch) | |
tree | bf9f4d95bc4a054c5cf1c542595c4bbcda00cceb /drivers/platform/x86/panasonic-laptop.c | |
parent | 18a1a7a1d862ae0794a0179473d08a414dd49234 (diff) | |
download | lwn-58c688657c73a6a87aa9ea414d510b5827cec298.tar.gz lwn-58c688657c73a6a87aa9ea414d510b5827cec298.zip |
Fix sleep / suspend keys for Toughbook CF-51
Hi all,
my panasonic cf-51 does no longer react to the suspend and hibernate
keys. I cannot tell when this started since I no longer use the machine
on a daily basis, but I suspect it started when userspace switched from
using /proc/acpi/event to the input layer, wich was quite some time ago ;-)
Today I investigated the issue and found that the firmware simply does
not generate any event on "key down" for those keys, but only on "key up".
The attached patch works around the problem.
Best regards,
Stefan
--
Stefan Seyfried
Linux Consultant & Developer -- GPG Key: 0x731B665B
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>From 7c96fee748cfd3e64732a7ac142f5dea07d7379f Mon Sep 17 00:00:00 2001
From: Stefan Seyfried <seife+kernel@b1-systems.com>
Date: Sun, 2 Mar 2014 17:50:01 +0100
Subject: [PATCH] panasonic-laptop: fix sleep keys on CF-51
At least on my CF-51, both sleep and hibernate keys do not
generate "key down" events, only "key up". Because of this,
the input layer does ignore both keys. The work around is
to generate a key down event before the key up. To avoid
double events on non-broken firmware, this is only done if
no key down is ever seen for those keys.
Signed-off-by: Stefan Seyfried <seife+kernel@b1-systems.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86/panasonic-laptop.c')
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index 609d38779b26..3f870972247c 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -449,6 +449,7 @@ static struct attribute_group pcc_attr_group = { /* hotkey input device driver */ +static int sleep_keydown_seen; static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) { struct input_dev *hotk_input_dev = pcc->input_dev; @@ -462,6 +463,16 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) "error getting hotkey status\n")); return; } + + /* hack: some firmware sends no key down for sleep / hibernate */ + if ((result & 0xf) == 0x7 || (result & 0xf) == 0xa) { + if (result & 0x80) + sleep_keydown_seen = 1; + if (!sleep_keydown_seen) + sparse_keymap_report_event(hotk_input_dev, + result & 0xf, 0x80, false); + } + if (!sparse_keymap_report_event(hotk_input_dev, result & 0xf, result & 0x80, false)) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |