Re: [PATCH 6/7] platform/x86: panasonic-laptop: filter out duplicate volume up/down/mute keypresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux