Skip to content

Commit a9b0b1e

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: thinkpad_acpi: Support for trackpoint doubletap
Lenovo trackpoints are adding the ability to generate a doubletap event. This handles the doubletap event and sends the KEY_PROG4 event to userspace. Despite the driver itself not using KEY_PROG1 - KEY_PROG3 this still uses KEY_PROG4 because of some keys being remapped to KEY_PROG1 - KEY_PROG3 by default by the upstream udev hwdb containing: evdev:name:ThinkPad Extra Buttons:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:* ... KEYBOARD_KEY_17=prog1 KEYBOARD_KEY_1a=f20 # Microphone mute button KEYBOARD_KEY_45=bookmarks KEYBOARD_KEY_46=prog2 # Fn + PrtSc, on Windows: Snipping tool KEYBOARD_KEY_4a=prog3 # Fn + Right shift, on Windows: No idea Signed-off-by: Mark Pearson <[email protected]> Signed-off-by: Vishnu Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Adjust for switch to sparse-keymap keymaps] Tested-by: Mark Pearson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5a3fc7a commit a9b0b1e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ enum tpacpi_hkey_event_t {
248248

249249
/* Misc */
250250
TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */
251+
252+
/* Misc2 */
253+
TP_HKEY_EV_TRACK_DOUBLETAP = 0x8036, /* trackpoint doubletap */
251254
};
252255

253256
/****************************************************************************
@@ -3268,6 +3271,7 @@ static const struct key_entry keymap_lenovo[] __initconst = {
32683271
* after switching to sparse keymap support. The mappings above use translated
32693272
* scancodes to preserve uAPI compatibility, see tpacpi_input_send_key().
32703273
*/
3274+
{ KE_KEY, TP_HKEY_EV_TRACK_DOUBLETAP /* 0x8036 */, { KEY_PROG4 } },
32713275
{ KE_END }
32723276
};
32733277

@@ -3817,6 +3821,17 @@ static bool hotkey_notify_6xxx(const u32 hkey, bool *send_acpi_ev)
38173821
return true;
38183822
}
38193823

3824+
static bool hotkey_notify_8xxx(const u32 hkey, bool *send_acpi_ev)
3825+
{
3826+
switch (hkey) {
3827+
case TP_HKEY_EV_TRACK_DOUBLETAP:
3828+
tpacpi_input_send_key(hkey, send_acpi_ev);
3829+
return true;
3830+
default:
3831+
return false;
3832+
}
3833+
}
3834+
38203835
static void hotkey_notify(struct ibm_struct *ibm, u32 event)
38213836
{
38223837
u32 hkey;
@@ -3893,6 +3908,10 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
38933908
known_ev = true;
38943909
}
38953910
break;
3911+
case 8:
3912+
/* 0x8000-0x8FFF: misc2 */
3913+
known_ev = hotkey_notify_8xxx(hkey, &send_acpi_ev);
3914+
break;
38963915
}
38973916
if (!known_ev) {
38983917
pr_notice("unhandled HKEY event 0x%04x\n", hkey);

0 commit comments

Comments
 (0)