Skip to contentSkip to conversation

Add 4 new keycodes and use them for 4 new hotkeys on new Lenovo Thinkpads

PATCH Applied Hans de Goede 2 participants 6 messages Sep 8, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Add 4 new keycodes and use them for 4 new hotkeys on new Lenovo Thinkpads

Hi All,

Here is a v2 of my series to get a couple of new hotkeys, and matching thinkpad_acpi hkey event codes seen on the last 2 generations of Thinkpads supported.

New in this version that Lenovo got back to me and explained that the 0x1316 hkey event belongs to Fn + right Shift, so that is mapped now too.

Since these make both include/uapi/linux/input-event-codes.h and drivers/platform/x86 changes one open question with this series is how to merge it.

Dmitry, for v1 of this series you suggested you could merge them all through the input tree ? Andy, one of the drivers/platform/x86 maintainers gave his Acked-by for this:

Alternatively the entire series could be merged through the linux-platform-drivers-x86 repo:

https://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git/shortlog/refs/heads/review-andy

Regards,

Hans

#1 lore raw

PATCH v2 1/4 Input: allocate keycodes for notification-center, pickup-phone and hangup-phone

New Lenovo Thinkpad models, e.g. the X1 Carbon 8th gen and the new T14 gen1 models have 3 new symbols / shortcuts on their F9-F11 keys (and the thinkpad_acpi driver receives 3 new "scancodes" for these):

F9: Has a symbol resembling a rectangular speech balloon, the manual says
the hotkey functions shows or hides the notification center
F10: Has a symbol of a telephone horn which has been picked up from the
receiver, the manual says: "Answer incoming calls"
F11: Has a symbol of a telephone horn which is resting on the receiver,
the manual says: "Decline incoming calls"

We have no existing keycodes which are a good match for these, so add 3 new keycodes for these.

I noticed that we have a hole in our keycodes between 0x1ba and 0x1c0 which does not seem to be reserved for any specific purpose, so these new 3 codes use 0x1bc - 0x1be, instead of starting at 0x27b.

---
 include/uapi/linux/input-event-codes.h | 3 +++
 1 file changed, 3 insertions(+)
include/uapi/linux/input-event-codes.h +3 -0
index 0c2e27d28e0a..b74821d09145 100644
@@ -515,6 +515,9 @@
 #define KEY_10CHANNELSUP	0x1b8	/* 10 channels up (10+) */
 #define KEY_10CHANNELSDOWN	0x1b9	/* 10 channels down (10-) */
 #define KEY_IMAGES		0x1ba	/* AL Image Browser */
+#define KEY_NOTIFICATION_CENTER	0x1bc	/* Show/hide the notification center */
+#define KEY_PICKUP_PHONE	0x1bd	/* Answer incoming call */
+#define KEY_HANGUP_PHONE	0x1be	/* Decline incoming call */
 
 #define KEY_DEL_EOL		0x1c0
 #define KEY_DEL_EOS		0x1c1
Signature · 1 line
2.28.0
#2 lore raw

PATCH v2 2/4 Input: allocate keycode for Fn + right shift

In reply to Hans de Goede

The last 2 generations of Lenovo Thinkpads send an acpi_thinkpad event when Fn + right shift is pressed. This is intended for use with "Lenovo Quick Clean" software, which disables the touchpad + kbd for 2 minutes on this key-combo so that healthcare workes can disinfect it.

But there is no silkscreen print on the right-keyboard to indicate this, so add a KEY_FN_RIGHT_SHIFT keycode define to use for this key-combo.

---
Changes in v2:
- New patch in v2 of this patch-set

---
 include/uapi/linux/input-event-codes.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input-event-codes.h +1 -0
index b74821d09145..ee93428ced9a 100644
@@ -545,6 +545,7 @@
 #define KEY_FN_F		0x1e2
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
+#define KEY_FN_RIGHT_SHIFT	0x1e5
 
 #define KEY_BRL_DOT1		0x1f1
 #define KEY_BRL_DOT2		0x1f2
Signature · 1 line
2.28.0
#3 lore raw

PATCH v2 3/4 platform/x86: thinkpad_acpi: Add support for new hotkeys found on X1C8 / T14

In reply to Hans de Goede

New Lenovo Thinkpad models, e.g. the X1 Carbon 8th gen and the new T14 gen1 models have 3 new symbols / shortcuts on their F9-F11 keys (and the thinkpad_acpi driver receives 3 new hkey events for these):

F9: Has a symbol resembling a rectangular speech balloon, the manual says
the hotkey functions shows or hides the notification center
F10: Has a symbol of a telephone horn which has been picked up from the
receiver, the manual says: "Answer incoming calls"
F11: Has a symbol of a telephone horn which is resting on the receiver,
the manual says: "Decline incoming calls"

And these Thinkpad models also send a new 0x1316 hkey events when the Fn + right Shift key-combo is pressed.

This commit adds support for these 4 new hkey events.

---
Changes in v2:
- Map 0x1316 to KEY_FN_RIGHT_SHIFT instead of to KEY_UNKNOWN (now that we know what it does)

---
 drivers/platform/x86/thinkpad_acpi.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +13 -5
index 9c4df41687a3..4b701e9a0392 100644
@@ -1913,6 +1913,10 @@ enum {	/* hot key scan codes (derived from ACPI DSDT) */
 	TP_ACPI_HOTKEYSCAN_CALCULATOR,
 	TP_ACPI_HOTKEYSCAN_BLUETOOTH,
 	TP_ACPI_HOTKEYSCAN_KEYBOARD,
+	TP_ACPI_HOTKEYSCAN_FN_RIGHT_SHIFT, /* Used by "Lenovo Quick Clean" */
+	TP_ACPI_HOTKEYSCAN_NOTIFICATION_CENTER,
+	TP_ACPI_HOTKEYSCAN_PICKUP_PHONE,
+	TP_ACPI_HOTKEYSCAN_HANGUP_PHONE,
 
 	/* Hotkey keymap size */
 	TPACPI_HOTKEY_MAP_LEN
@@ -3429,11 +3433,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 		KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
 		KEY_UNKNOWN,
 
-		KEY_BOOKMARKS,       /* Favorite app, 0x311 */
-		KEY_RESERVED,        /* Clipping tool */
-		KEY_CALC,            /* Calculator (above numpad, P52) */
-		KEY_BLUETOOTH,       /* Bluetooth */
-		KEY_KEYBOARD         /* Keyboard, 0x315 */
+		KEY_BOOKMARKS,			/* Favorite app, 0x311 */
+		KEY_RESERVED,			/* Clipping tool */
+		KEY_CALC,			/* Calculator (above numpad, P52) */
+		KEY_BLUETOOTH,			/* Bluetooth */
+		KEY_KEYBOARD,			/* Keyboard, 0x315 */
+		KEY_FN_RIGHT_SHIFT,		/* Fn + right Shift */
+		KEY_NOTIFICATION_CENTER,	/* Notification Center */
+		KEY_PICKUP_PHONE,		/* Answer incoming call */
+		KEY_HANGUP_PHONE,		/* Decline incoming call */
 		},
 	};
 
Signature · 1 line
2.28.0
#4 lore raw

PATCH v2 4/4 platform/x86: thinkpad_acpi: Map Clipping tool hotkey to KEY_SELECTIVE_SCREENSHOT

In reply to Hans de Goede

Commit 696c6523ec8f ("platform/x86: thinkpad_acpi: add mapping for new hotkeys") added support for a bunch of new hotkeys, but the clipping/snipping tool hotkey got ignored because there was no good key-code to map it to.

Recently a new KEY_SELECTIVE_SCREENSHOT keycode was added by commit 3b059da9835c ("Input: allocate keycode for "Selective Screenshot" key") quoting from the commit message:

"New Chrome OS keyboards have a "snip" key that is basically a selective screenshot (allows a user to select an area of screen to be copied). Allocate a keycode for it."

Support for this "snip" key seems like it is also a good match for the clipping/snipping tool hotkey, so map this hotkey to the new KEY_SELECTIVE_SCREENSHOT key-code.

---
 drivers/platform/x86/thinkpad_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +1 -1
index 4b701e9a0392..47925c319d7b 100644
@@ -3434,7 +3434,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 		KEY_UNKNOWN,
 
 		KEY_BOOKMARKS,			/* Favorite app, 0x311 */
-		KEY_RESERVED,			/* Clipping tool */
+		KEY_SELECTIVE_SCREENSHOT,	/* Clipping tool */
 		KEY_CALC,			/* Calculator (above numpad, P52) */
 		KEY_BLUETOOTH,			/* Bluetooth */
 		KEY_KEYBOARD,			/* Keyboard, 0x315 */
Signature · 1 line
2.28.0
maintainer Applied
#5 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 13 lines · Hans de Goede

Hi All,

Here is a v2 of my series to get a couple of new hotkeys, and matching thinkpad_acpi hkey event codes seen on the last 2 generations of Thinkpads supported.

New in this version that Lenovo got back to me and explained that the 0x1316 hkey event belongs to Fn + right Shift, so that is mapped now too.

Since these make both include/uapi/linux/input-event-codes.h and drivers/platform/x86 changes one open question with this series is how to merge it.

Quoted 5 lines

Dmitry, for v1 of this series you suggested you could merge them all through the input tree ? Andy, one of the drivers/platform/x86 maintainers gave his Acked-by for this:

I queued up the series, thank you.

Signature · 1 line
Dmitry