X86 platform drivers
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Mark Gross <markgross@kernel.org>,
	Andy Shevchenko <andy@kernel.org>, Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org,
	Stefan Seyfried <stefan.seyfried@googlemail.com>,
	Kenneth Chan <kenneth.t.chan@gmail.com>,
	platform-driver-x86@vger.kernel.org,
	Stefan Seyfried <seife+kernel@b1-systems.com>
Subject: Re: [PATCH 6/7] platform/x86: panasonic-laptop: filter out duplicate volume up/down/mute keypresses
Date: Tue, 28 Jun 2022 13:34:06 +0300	[thread overview]
Message-ID: <YrrZHtO032v2BwJs@smile.fi.intel.com> (raw)
In-Reply-To: <20220624112340.10130-7-hdegoede@redhat.com>

On Fri, Jun 24, 2022 at 01:23:39PM +0200, Hans de Goede wrote:
> On some Panasonic models the volume up/down/mute keypresses get
> reported both through the Panasonic ACPI HKEY interface as well as
> through the atkbd device.
> 
> Filter out the atkbd scan-codes for these to avoid reporting presses
> twice.
> 
> Note normally we would leave the filtering of these to userspace by mapping
> the scan-codes to KEY_UNKNOWN through /lib/udev/hwdb.d/60-keyboard.hwdb.
> However in this case that would cause regressions since we were filtering
> the Panasonic ACPI HKEY events before, so filter these in the kernel.

...

> +	if (data == 0xe0) {
> +		extended = true;
> +		return true;
> +	} else if (extended) {

'else' is not needed.

> +		extended = false;
> +
> +		switch (data & 0x7f) {
> +		case 0x20: /* e0 20 / e0 a0, Volume Mute press / release */
> +		case 0x2e: /* e0 2e / e0 ae, Volume Down press / release */
> +		case 0x30: /* e0 30 / e0 b0, Volume Up press / release */
> +			return true;
> +		default:
> +			/*
> +			 * Report the previously filtered e0 before continuing
> +			 * with the next non-filtered byte.
> +			 */
> +			serio_interrupt(port, 0xe0, 0);

> +			return false;

Could be 'break;' but...

> +		}
> +	}

> +	return false;

You can go with 'if (!extended)' above.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-06-28 10:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 11:23 [PATCH 0/7] ACPI: video / platform/x86: Fix Panasonic laptop missing keypresses Hans de Goede
2022-06-24 11:23 ` [PATCH 1/7] ACPI: video: Change how we determine if brightness key-presses are handled Hans de Goede
2022-06-25 13:43   ` Rafael J. Wysocki
2022-06-28 10:24   ` Andy Shevchenko
2022-06-24 11:23 ` [PATCH 2/7] platform/x86: panasonic-laptop: de-obfuscate button codes Hans de Goede
2022-06-28 10:29   ` Andy Shevchenko
2022-06-24 11:23 ` [PATCH 3/7] platform/x86: panasonic-laptop: sort includes alphabetically Hans de Goede
2022-06-24 11:23 ` [PATCH 4/7] platform/x86: panasonic-laptop: revert "Resolve hotkey double trigger bug" Hans de Goede
2022-06-24 11:23 ` [PATCH 5/7] platform/x86: panasonic-laptop: don't report duplicate brightness key-presses Hans de Goede
2022-06-24 11:23 ` [PATCH 6/7] platform/x86: panasonic-laptop: filter out duplicate volume up/down/mute keypresses Hans de Goede
2022-06-28 10:34   ` Andy Shevchenko [this message]
2022-06-24 11:23 ` [PATCH 7/7] platform/x86: panasonic-laptop: Use acpi_video_get_backlight_type() Hans de Goede
2022-06-24 19:49 ` [PATCH 0/7] ACPI: video / platform/x86: Fix Panasonic laptop missing keypresses Stefan Seyfried
2022-06-26  6:58   ` Kenneth Chan
2022-06-28 20:09     ` Hans de Goede
2022-06-28 10:35 ` Andy Shevchenko
2022-06-28 20:02 ` Hans de Goede

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=YrrZHtO032v2BwJs@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=kenneth.t.chan@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=seife+kernel@b1-systems.com \
    --cc=stefan.seyfried@googlemail.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