Skip to content

Commit fb103b9

Browse files
jwrdegoedeij-intel
authored andcommitted
platform/x86: asus-wmi: Filter Volume key presses if also reported via atkbd
Use the i8042-filter to check if Volume key presses are also reported via atkbd and if yes then filter out the WMI events to avoid reporting each key-press twice. Note depending on in which order the PS/2 data vs the WMI event are handled the first volume key press may still be reported twice. This is a compromise versus DMI quirks (unmaintainable) or other more complex solutions. Closes: https://bbs.archlinux.org/viewtopic.php?pid=2128536#p2128536 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 6db829f commit fb103b9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ module_param(tablet_mode_sw, uint, 0444);
4848
MODULE_PARM_DESC(tablet_mode_sw, "Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip 3:lid-flip-rog");
4949

5050
static struct quirk_entry *quirks;
51+
static bool atkbd_reports_vol_keys;
5152

5253
static bool asus_i8042_filter(unsigned char data, unsigned char str, struct serio *port)
5354
{
55+
static bool extended_e0;
5456
static bool extended_e1;
5557

5658
if (str & I8042_STR_AUXDATA)
@@ -68,6 +70,20 @@ static bool asus_i8042_filter(unsigned char data, unsigned char str, struct seri
6870
}
6971
}
7072

73+
if (data == 0xe0) {
74+
extended_e0 = true;
75+
} else if (extended_e0) {
76+
extended_e0 = false;
77+
78+
switch (data & 0x7f) {
79+
case 0x20: /* e0 20 / e0 a0, Volume Mute press / release */
80+
case 0x2e: /* e0 2e / e0 ae, Volume Down press / release */
81+
case 0x30: /* e0 30 / e0 b0, Volume Up press / release */
82+
atkbd_reports_vol_keys = true;
83+
break;
84+
}
85+
}
86+
7187
return false;
7288
}
7389

@@ -608,6 +624,13 @@ static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
608624
if (acpi_video_handles_brightness_key_presses())
609625
*code = ASUS_WMI_KEY_IGNORE;
610626

627+
break;
628+
case 0x30: /* Volume Up */
629+
case 0x31: /* Volume Down */
630+
case 0x32: /* Volume Mute */
631+
if (atkbd_reports_vol_keys)
632+
*code = ASUS_WMI_KEY_IGNORE;
633+
611634
break;
612635
}
613636
}

0 commit comments

Comments
 (0)