linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Mario Limonciello <mario.limonciello@dell.com>,
	dvhart@infradead.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: AceLan Kao <acelan.kao@canonical.com>,
	linux-pm@vger.kernel.org,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org, Len Brown <lenb@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: intel-vbtn: match power button on press rather than release
Date: Sat, 16 Sep 2017 15:45:38 +0200	[thread overview]
Message-ID: <201709161545.39058@pali> (raw)
In-Reply-To: <1501866006-24811-1-git-send-email-mario.limonciello@dell.com>

[-- Attachment #1: Type: Text/Plain, Size: 2188 bytes --]

On Friday 04 August 2017 19:00:06 Mario Limonciello wrote:
> This fixes a problem where the system gets stuck in a loop
> unable to wakeup via power button in s2idle.
> 
> The problem happens because:
>  - press power button:
>    - system emits 0xc0 (power press), event ignored
>    - system emits 0xc1 (power release), event processed,
>      emited as KEY_POWER
>    - set wakeup_mode to true
>    - system goes to s2idle
>  - press power button
>    - system emits 0xc0 (power press), wakeup_mode is true,
>      system wakes
>    - system emits 0xc1 (power release), event processed,
>      emited as KEY_POWER
>    - system goes to s2idle again
> 
> To avoid this situation, process the presses (which matches what
> intel-hid does too).
> 
> Verified on an Dell XPS 9365
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> ---
>  drivers/platform/x86/intel-vbtn.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel-vbtn.c
> b/drivers/platform/x86/intel-vbtn.c index 61f1063..4809267 100644
> --- a/drivers/platform/x86/intel-vbtn.c
> +++ b/drivers/platform/x86/intel-vbtn.c
> @@ -36,8 +36,8 @@ static const struct acpi_device_id intel_vbtn_ids[]
> = {
> 
>  /* In theory, these are HID usages. */
>  static const struct key_entry intel_vbtn_keymap[] = {
> -	{ KE_IGNORE, 0xC0, { KEY_POWER } },	/* power key press */
> -	{ KE_KEY, 0xC1, { KEY_POWER } },	/* power key release */
> +	{ KE_KEY, 0xC0, { KEY_POWER } },	/* power key press */
> +	{ KE_IGNORE, 0xC1, { KEY_POWER } },	/* power key release */
>  	{ KE_KEY, 0xC4, { KEY_VOLUMEUP } },		/* volume-up key press */
>  	{ KE_IGNORE, 0xC5, { KEY_VOLUMEUP } },		/* volume-up key release 
*/
>  	{ KE_KEY, 0xC6, { KEY_VOLUMEDOWN } },		/* volume-down key press */

Hello, maybe a stupid question, but why to not report both events "key 
pressed" and "key released" to userspace? IIRC kernel input layer can 
distinguish between these two type of events. But in intel-vbtn.c source 
code I see that all "release" ACPI events are ignored and just "press" 
are processed.

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2017-09-16 13:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 17:00 [PATCH] intel-vbtn: match power button on press rather than release Mario Limonciello
2017-08-04 17:29 ` Darren Hart
2017-08-04 23:30   ` Rafael J. Wysocki
2017-08-05 20:57     ` Darren Hart
2017-08-05 22:20       ` Rafael J. Wysocki
2017-08-06 23:24         ` Darren Hart
2017-08-07  0:38           ` Rafael J. Wysocki
2017-08-07  0:59             ` AceLan Kao
2017-08-07  3:54               ` Darren Hart
2017-09-16 13:45 ` Pali Rohár [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201709161545.39058@pali \
    --to=pali.rohar@gmail.com \
    --cc=acelan.kao@canonical.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@dell.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).