Skip to contentSkip to conversation

platform/x86: panasonic-laptop: register FN key up/down events

PATCH In review Alex Yeo 2 participants 2 messages Aug 28 – Sep 16

Subsystems (2)
lore
Share & tools
lore

Alex Yeo

author
#0 lore raw

PATCH 1/1 platform/x86: panasonic-laptop: register FN key up/down events

For Let's Note laptops, pressing the FN key sends a signal for both keyup and keydown.

FN key down: 0x0030
FN key up: 0x0031

Currently, pressing the FN key causes the following output in dmesg:

[ +0.322901] Unknown hotkey event: 0x0030
[ +1.101006] Unknown hotkey event: 0x0031

This has a tendency to spam dmesg as this is printed every time the FN key is pressed regardless of whether or not it was used as a modifier to activate functions like brightness, etc.

Map both the keyup/down events so it is no longer reported as unknown hotkeys.

Once the patch has been applied, evtest shows the following when the FN key is pressed (and released):

Event: time 1787875023.918171, type 4 (EV_MSC), code 4 (MSC_SCAN), value 30
Event: time 1787875023.918171, type 1 (EV_KEY), code 464 (KEY_FN), value 1
Event: time 1787875023.918171, -------------- SYN_REPORT ------------
Event: time 1787875024.038462, type 4 (EV_MSC), code 4 (MSC_SCAN), value 30
Event: time 1787875024.038462, type 1 (EV_KEY), code 464 (KEY_FN), value 0
Event: time 1787875024.038462, -------------- SYN_REPORT ------------

Tested on the following Let's Note models:
- CF-SX1
- CF-RZ6
- CF-SV8
- CF-QV9
- CF-SR4

---
 drivers/platform/x86/panasonic-laptop.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/platform/x86/panasonic-laptop.c +12 -0
index 19d194ff37ca..cfc2c79da554 100644
@@ -232,6 +232,7 @@ static const struct key_entry panasonic_keymap[] = {
 	{ KE_KEY, 41, { KEY_MACRO9 } },
 	{ KE_KEY, 42, { KEY_MACRO10 } },
 	{ KE_KEY, 43, { KEY_MACRO11 } },
+	{ KE_KEY, 48, { KEY_FN } },
 	{ KE_END, 0 }
 };
 
@@ -863,6 +864,17 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 					key, 0x80, false);
 	}
 
+	/*
+	 * Let's Note models report both FN key down and key up
+	 * without the expected 0x80 key up/down bit
+	 */
+	if (key == 48) {
+		updown = 1;
+	} else if (key == 49) {
+		key = 48;
+		updown = 0;
+	}
+
 	/*
 	 * Don't report brightness key-presses if they are also reported
 	 * by the ACPI video bus.
Signature · 1 line
2.55.0
maintainer
#1 lore raw
Quoted 9 lines · Alex Yeo

For Let's Note laptops, pressing the FN key sends a signal for both keyup and keydown.

FN key down: 0x0030
FN key up: 0x0031

Currently, pressing the FN key causes the following output in dmesg:

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.

The list of commits applied:
[1/1] platform/x86: panasonic-laptop: register FN key up/down events

      commit: a3aafecfa1220c5884dcaf01f125212ebd8841c0

--
i.