lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  4 Jun 2018 20:32:38 +0800
From:   Chris Chiu <chiu@...lessm.com>
To:     corentin.chary@...il.com, dvhart@...radead.org,
        andy.shevchenko@...il.com
Cc:     linux-kernel@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        acpi4asus-user@...ts.sourceforge.net, hdegoede@...hat.com,
        linux@...lessm.com, Chris Chiu <chiu@...lessm.com>
Subject: [PATCH 2/2] platform/x86: asus-wmi: Add keyboard backlight toggle support

Some ASUS laptops like UX550GE has hotkey (Fn+F7) for keyboard
backlight toggle which would emit the scan code 0xc7 each keypress.
On the UX550GE, the max keyboard brightness level is 3 so the
toggle would not be simply on/off the led but need to be cyclic.
Per ASUS spec, it should increment the brightness for each keypress,
then toggle(off) the LED when it already reached the max level.

Signed-off-by: Chris Chiu <chiu@...lessm.com>
---
 drivers/platform/x86/asus-wmi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index b4915b7718c1..100e13e0817e 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -67,6 +67,7 @@ MODULE_LICENSE("GPL");
 #define NOTIFY_BRNDOWN_MAX		0x2e
 #define NOTIFY_KBD_BRTUP		0xc4
 #define NOTIFY_KBD_BRTDWN		0xc5
+#define NOTIFY_KBD_BRTTOGGLE		0xc7
 
 /* WMI Methods */
 #define ASUS_WMI_METHODID_SPEC	        0x43455053 /* BIOS SPECification */
@@ -1704,7 +1705,9 @@ static int is_display_toggle(int code)
 
 static int is_kbd_led_event(int code)
 {
-	if (code == NOTIFY_KBD_BRTUP || code == NOTIFY_KBD_BRTDWN)
+	if (code == NOTIFY_KBD_BRTUP ||
+	    code ==  NOTIFY_KBD_BRTDWN ||
+	    code ==  NOTIFY_KBD_BRTTOGGLE)
 		return 1;
 	return 0;
 }
@@ -1755,7 +1758,10 @@ static void asus_wmi_notify(u32 value, void *context)
 	}
 
 	if (is_kbd_led_event(code)) {
-		if (code == NOTIFY_KBD_BRTDWN)
+		if (code == NOTIFY_KBD_BRTTOGGLE &&
+		    asus->kbd_led_wk == asus->kbd_led.max_brightness)
+			kbd_led_set(&asus->kbd_led, 0);
+		else if (code == NOTIFY_KBD_BRTDWN)
 			kbd_led_set(&asus->kbd_led, asus->kbd_led_wk - 1);
 		else
 			kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1);
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ