Skip to content

Commit 858bd78

Browse files
jwrdegoedeij-intel
authored andcommitted
platform/x86: asus-wmi: Do not report brightness up/down keys when also reported by acpi_video
For a long time now the acpi_video driver reports evdev brightness up/down key events for the brightness hotkeys on most (non ancient) laptops. asus-wmi also reports evdev brightness up/down key events for these keys leading to each press being reported twice and e.g. GNOME increasing the brightness by 2 steps instead of 1 step. Use the acpi_video_handles_brightness_key_presses() helper to detect if acpi_video is reporting brightness key-presses and if it is then don't report the same events also from the asus-wmi driver. Note there is a chance that this may lead to regressions where the brightness hotkeys stop working because they are not actually reported by the acpi_video driver. Unfortunately the only way to find out if this is a problem is to try. To at least avoid regressions on old hw using the eeepc-wmi driver, implement this as a key filter in asus-nb-wmi so that the eeepc-wmi driver is not affected. Reported-by: James John <[email protected]> Closes: https://lore.kernel.org/platform-driver-x86/[email protected]/ Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 942a4a6 commit 858bd78

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/platform/x86/asus-nb-wmi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <linux/dmi.h>
1717
#include <linux/i8042.h>
1818

19+
#include <acpi/video.h>
20+
1921
#include "asus-wmi.h"
2022

2123
#define ASUS_NB_WMI_FILE "asus-nb-wmi"
@@ -603,6 +605,19 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
603605
{ KE_END, 0},
604606
};
605607

608+
static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
609+
unsigned int *value, bool *autorelease)
610+
{
611+
switch (*code) {
612+
case ASUS_WMI_BRN_DOWN:
613+
case ASUS_WMI_BRN_UP:
614+
if (acpi_video_handles_brightness_key_presses())
615+
*code = ASUS_WMI_KEY_IGNORE;
616+
617+
break;
618+
}
619+
}
620+
606621
static struct asus_wmi_driver asus_nb_wmi_driver = {
607622
.name = ASUS_NB_WMI_FILE,
608623
.owner = THIS_MODULE,
@@ -611,6 +626,7 @@ static struct asus_wmi_driver asus_nb_wmi_driver = {
611626
.input_name = "Asus WMI hotkeys",
612627
.input_phys = ASUS_NB_WMI_FILE "/input0",
613628
.detect_quirks = asus_nb_wmi_quirks,
629+
.key_filter = asus_nb_wmi_key_filter,
614630
};
615631

616632

0 commit comments

Comments
 (0)