Skip to contentSkip to conversation

HID: hid-asus: Maps 0x35 to KEY_SCREENLOCK

PATCH New Vinicius A. Reis 1 participant 1 message Oct 18, 2021 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: hid-asus: Maps 0x35 to KEY_SCREENLOCK

Asus laptops are able to turn both the display and keyboard backlit off by pressing a dedicated "turn display off" key (usually fn+f6). However, on Linux systems, this key has no effect at all since most desktop environments don't deal with KEY_DISPLAY_OFF. By mapping that key to KEY_SCREENLOCK instead, would enable it to work as close as intended by the manufacturer, since desktop envirorments would handle this as a screen lock request by the user, locking the screen (and turning both the display and keyboard backlit off on environments that support it).

---
 drivers/hid/hid-asus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-asus.c +3 -1
index f3ecddc519ee..e5c7bfa68cd6 100644
@@ -854,7 +854,9 @@ static int asus_input_mapping(struct hid_device *hdev,
 		switch (usage->hid & HID_USAGE) {
 		case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN);	break;
 		case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP);		break;
-		case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF);		break;
+		case 0x35:
+			asus_map_key_clear(KEY_SCREENLOCK);
+			break;
 		case 0x6c: asus_map_key_clear(KEY_SLEEP);		break;
 		case 0x7c: asus_map_key_clear(KEY_MICMUTE);		break;
 		case 0x82: asus_map_key_clear(KEY_CAMERA);		break;
Signature · 1 line
2.32.0