Skip to contentSkip to conversation

Input: Add key event code for Fn + P

PATCH In review [email protected] 2 participants 5 messages Aug 2, 2025 – Aug 15, 2025

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

PATCH 1/2 Input: Add key event code for Fn + P

From: Edip Hazuri <[email protected]>

Newer Victus (and probably newer omen) laptops contains a "Fn + P" Shortcut. This is intended to use with Omen Gaming Hub, Which is changing the performance profile when this shortcut triggered. This shortcut is shown on performance control page, see [1]

Currently there is no key definition to handle this. So add a KEY_FN_P keycode define to be able to use this shortcut.

[1]: https://jpcdn.it/img/adadf6c927ffeb75afd8038f95db400a.png

---
 drivers/hid/hid-debug.c                | 2 +-
 include/uapi/linux/input-event-codes.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-debug.c +1 -1
index 4424c0512ba..2bcf7b24801 100644
@@ -3342,7 +3342,7 @@ static const char *keys[KEY_MAX + 1] = {
 	[KEY_FN_1] = "Fn+1",			[KEY_FN_2] = "Fn+2",
 	[KEY_FN_B] = "Fn+B",			[KEY_FN_D] = "Fn+D",
 	[KEY_FN_E] = "Fn+E",			[KEY_FN_F] = "Fn+F",
-	[KEY_FN_S] = "Fn+S",
+	[KEY_FN_S] = "Fn+S",			[KEY_FN_P] = "Fn+P",
 	[KEY_FN_F1] = "Fn+F1",			[KEY_FN_F2] = "Fn+F2",
 	[KEY_FN_F3] = "Fn+F3",			[KEY_FN_F4] = "Fn+F4",
 	[KEY_FN_F5] = "Fn+F5",			[KEY_FN_F6] = "Fn+F6",
include/uapi/linux/input-event-codes.h +1 -0
index 3b2524e4b66..2fc79b32425 100644
@@ -548,6 +548,7 @@
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
 #define KEY_FN_RIGHT_SHIFT	0x1e5
+#define KEY_FN_P		0x1e6
 
 #define KEY_BRL_DOT1		0x1f1
 #define KEY_BRL_DOT2		0x1f2
Signature · 1 line
2.50.1
#1 lore raw

PATCH 2/2 platform/x86: hp-wmi: Add support for Fn+P hotkey

From: Edip Hazuri <[email protected]>

Newer Hp Victus (And probably newer omen) e.g. Victus 16-s1011nt that i own have a Fn+P shortcut intended to use with omen gaming hub for changing the performance profile. see [1]

Quoted 1 line

hp_wmi: Unknown event_id - 27 - 0x7

Based on the dmesg warning. I found that the key have 27 as event_id and 0x7 as event_data (keycode). I implemented it in the driver and now libinput can capture the event.

Tested On Victus 16-s1011nt (9Z791EA) with MB 8C9C

[1]: https://jpcdn.it/img/adadf6c927ffeb75afd8038f95db400a.png

---
 drivers/platform/x86/hp/hp-wmi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/platform/x86/hp/hp-wmi.c +11 -0
index db5fdee2109..6467ca27db7 100644
@@ -122,6 +122,7 @@ enum hp_wmi_event_ids {
 	HPWMI_BATTERY_CHARGE_PERIOD	= 0x10,
 	HPWMI_SANITIZATION_MODE		= 0x17,
 	HPWMI_CAMERA_TOGGLE		= 0x1A,
+	HPWMI_FN_P_HOTKEY		= 0x1B,
 	HPWMI_OMEN_KEY			= 0x1D,
 	HPWMI_SMART_EXPERIENCE_APP	= 0x21,
 };
@@ -280,6 +281,7 @@ struct bios_rfkill2_state {
 static const struct key_entry hp_wmi_keymap[] = {
 	{ KE_KEY, 0x02,    { KEY_BRIGHTNESSUP } },
 	{ KE_KEY, 0x03,    { KEY_BRIGHTNESSDOWN } },
+	{ KE_KEY, 0x07,    { KEY_FN_P } },
 	{ KE_KEY, 0x270,   { KEY_MICMUTE } },
 	{ KE_KEY, 0x20e6,  { KEY_PROG1 } },
 	{ KE_KEY, 0x20e8,  { KEY_MEDIA } },
@@ -981,6 +983,15 @@ static void hp_wmi_notify(union acpi_object *obj, void *context)
 						key_code, 1, true))
 			pr_info("Unknown key code - 0x%x\n", key_code);
 		break;
+	case HPWMI_FN_P_HOTKEY:
+		key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
+		if (key_code < 0)
+			break;
+
+		if (!sparse_keymap_report_event(hp_wmi_input_dev,
+			key_code, 1, true))
+			pr_info("Unknown key code - 0x%x\n", key_code);
+		break;
 	case HPWMI_OMEN_KEY:
 		if (event_data) /* Only should be true for HP Omen */
 			key_code = event_data;
Signature · 1 line
2.50.1
maintainer
#2 lore raw

Re: [PATCH 2/2] platform/x86: hp-wmi: Add support for Fn+P hotkey

Quoted 4 lines · On Sun, 3 Aug 2025, [email protected] wrote:

From: Edip Hazuri <[email protected]>

Newer Hp Victus (And probably newer omen) e.g. Victus 16-s1011nt that i own have a Fn+P shortcut intended to use with omen gaming hub for

Thanks for the patch.

It's irrelevant to record in the changelog that you own one. Just state what it has. :-)

Quoted 1 line

changing the performance profile. see [1]

Why isn't the key made to cycle platform profiles then?

Quoted 1 line
Quoted 1 line

hp_wmi: Unknown event_id - 27 - 0x7

Add empty line here.

Quoted 3 lines

Based on the dmesg warning. I found that the key have 27 as event_id and 0x7 as event_data (keycode). I implemented it in the driver and now libinput can capture the event.

Please write changelogs in imperative tone. Don't write 'I did x' style sentences.

Quoted 1 line

Tested On Victus 16-s1011nt (9Z791EA) with MB 8C9C

Tested on

Missing .

Quoted 28 lines

[1]: https://jpcdn.it/img/adadf6c927ffeb75afd8038f95db400a.png

---
 drivers/platform/x86/hp/hp-wmi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/platform/x86/hp/hp-wmi.c +2 -0
index db5fdee2109..6467ca27db7 100644
@@ -122,6 +122,7 @@ enum hp_wmi_event_ids {
 	HPWMI_BATTERY_CHARGE_PERIOD	= 0x10,
 	HPWMI_SANITIZATION_MODE		= 0x17,
 	HPWMI_CAMERA_TOGGLE		= 0x1A,
+	HPWMI_FN_P_HOTKEY		= 0x1B,
 	HPWMI_OMEN_KEY			= 0x1D,
 	HPWMI_SMART_EXPERIENCE_APP	= 0x21,
 };
@@ -280,6 +281,7 @@ struct bios_rfkill2_state {
 static const struct key_entry hp_wmi_keymap[] = {
 	{ KE_KEY, 0x02,    { KEY_BRIGHTNESSUP } },
 	{ KE_KEY, 0x03,    { KEY_BRIGHTNESSDOWN } },
+	{ KE_KEY, 0x07,    { KEY_FN_P } },
 	{ KE_KEY, 0x270,   { KEY_MICMUTE } },
 	{ KE_KEY, 0x20e6,  { KEY_PROG1 } },
 	{ KE_KEY, 0x20e8,  { KEY_MEDIA } },

drivers/platform/x86/hp/hp-wmi.c static void hp_wmi_notify(union acpi_object *obj, void *context) · line 992

Quoted 10 lines
drivers/platform/x86/hp/hp-wmi.c +7 -0
@@ -981,6 +983,15 @@ static void hp_wmi_notify(union acpi_object *obj, void *context)
 						key_code, 1, true))
 			pr_info("Unknown key code - 0x%x\n", key_code);
 		break;
+	case HPWMI_FN_P_HOTKEY:
+		key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
+		if (key_code < 0)
+			break;
+
+		if (!sparse_keymap_report_event(hp_wmi_input_dev,
+			key_code, 1, true))

This is misaligned.

drivers/platform/x86/hp/hp-wmi.c static void hp_wmi_notify(union acpi_object *obj, void *context) · line 994

Quoted 2 lines
drivers/platform/x86/hp/hp-wmi.c +2 -0
+			pr_info("Unknown key code - 0x%x\n", key_code);
+		break;

The code looks 100% identical to that of in HPWMI_BEZEL_BUTTON. But please consider what I noted above about cycling platform profiles.

Quoted 4 lines
drivers/platform/x86/hp/hp-wmi.c +0 -0
 	case HPWMI_OMEN_KEY:
 		if (event_data) /* Only should be true for HP Omen */
 			key_code = event_data;
Signature · 1 line
 i.
#3 lore raw

Re: [PATCH 2/2] platform/x86: hp-wmi: Add support for Fn+P hotkey

Quoted 66 lines · On Tuesday, August 12, 2025 3:20:48 PM GMT+03:00 Ilpo Järvinen wrote:
Quoted 4 lines · On Sun, 3 Aug 2025, [email protected] wrote:

From: Edip Hazuri <[email protected]>

Newer Hp Victus (And probably newer omen) e.g. Victus 16-s1011nt that i own have a Fn+P shortcut intended to use with omen gaming hub for

Thanks for the patch.

It's irrelevant to record in the changelog that you own one. Just state what it has. :-)

Quoted 1 line

changing the performance profile. see [1]

Why isn't the key made to cycle platform profiles then?

Quoted 1 line
Quoted 1 line

hp_wmi: Unknown event_id - 27 - 0x7

Add empty line here.

Quoted 3 lines

Based on the dmesg warning. I found that the key have 27 as event_id and 0x7 as event_data (keycode). I implemented it in the driver and now libinput can capture the event.

Please write changelogs in imperative tone. Don't write 'I did x' style sentences.

Quoted 1 line

Tested On Victus 16-s1011nt (9Z791EA) with MB 8C9C

Tested on

Missing .

Quoted 34 lines

[1]: https://jpcdn.it/img/adadf6c927ffeb75afd8038f95db400a.png

---

 drivers/platform/x86/hp/hp-wmi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
(quoted diff) +0 -0

b/drivers/platform/x86/hp/hp-wmi.c index db5fdee2109..6467ca27db7 100644

drivers/platform/x86/hp/hp-wmi.c +1 -0
@@ -122,6 +122,7 @@ enum hp_wmi_event_ids {
 
 	HPWMI_BATTERY_CHARGE_PERIOD	= 0x10,
 	HPWMI_SANITIZATION_MODE		= 0x17,
 	HPWMI_CAMERA_TOGGLE		= 0x1A,
 
+	HPWMI_FN_P_HOTKEY		= 0x1B,
 
drivers/platform/x86/hp/hp-wmi.c +1 -0
 	HPWMI_OMEN_KEY			= 0x1D,
 	HPWMI_SMART_EXPERIENCE_APP	= 0x21,
 
 };
@@ -280,6 +281,7 @@ struct bios_rfkill2_state {
 
 static const struct key_entry hp_wmi_keymap[] = {
 
 	{ KE_KEY, 0x02,    { KEY_BRIGHTNESSUP } },
 	{ KE_KEY, 0x03,    { KEY_BRIGHTNESSDOWN } },
 
+	{ KE_KEY, 0x07,    { KEY_FN_P } },
Quoted 7 lines
Quoted 7 lines
drivers/platform/x86/hp/hp-wmi.c +0 -0
 	{ KE_KEY, 0x270,   { KEY_MICMUTE } },
 	{ KE_KEY, 0x20e6,  { KEY_PROG1 } },
 	{ KE_KEY, 0x20e8,  { KEY_MEDIA } },
@@ -981,6 +983,15 @@ static void hp_wmi_notify(union acpi_object *obj,

void *context)>
key_code,

1, true))

Quoted 2 lines
Quoted 2 lines

pr_info("Unknown key code - 0x%x\n",

key_code);

Quoted 13 lines

drivers/platform/x86/hp/hp-wmi.c static void hp_wmi_notify(union acpi_object *obj, void *context) · line 992

Quoted 10 lines
drivers/platform/x86/hp/hp-wmi.c +7 -0
 		break;
 
+	case HPWMI_FN_P_HOTKEY:
+		key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
+		if (key_code < 0)
+			break;
+
+		if (!sparse_keymap_report_event(hp_wmi_input_dev,
+			key_code, 1, true))

This is misaligned.

Quoted 1 line

drivers/platform/x86/hp/hp-wmi.c

Quoted 1 line
drivers/platform/x86/hp/hp-wmi.c +1 -0
+			pr_info("Unknown key code - 0x%x\n", 

key_code);

Quoted 9 lines

drivers/platform/x86/hp/hp-wmi.c

Quoted 1 line
drivers/platform/x86/hp/hp-wmi.c +1 -0
+		break;

The code looks 100% identical to that of in HPWMI_BEZEL_BUTTON. But please consider what I noted above about cycling platform profiles.

Quoted 4 lines
drivers/platform/x86/hp/hp-wmi.c +0 -0
 	case HPWMI_OMEN_KEY:
 		if (event_data) /* Only should be true for HP Omen */
 
 			key_code = event_data;

Hi,

Sorry for my mistakes, and thank you for your feedback. I'll consider your feedback and submit another patch.

Edip

#4 lore raw
In reply to [email protected]
Quoted 23 lines · On Sunday, August 3, 2025 12:21:50 AM GMT+03:00 [email protected] wrote:

From: Edip Hazuri <[email protected]>

Newer Victus (and probably newer omen) laptops contains a "Fn + P" Shortcut. This is intended to use with Omen Gaming Hub, Which is changing the performance profile when this shortcut triggered. This shortcut is shown on performance control page, see [1]

Currently there is no key definition to handle this. So add a KEY_FN_P keycode define to be able to use this shortcut.

[1]: https://jpcdn.it/img/adadf6c927ffeb75afd8038f95db400a.png

---
 drivers/hid/hid-debug.c                | 2 +-
 include/uapi/linux/input-event-codes.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-debug.c +0 -0
index 4424c0512ba..2bcf7b24801 100644

drivers/hid/hid-debug.c static const char *keys[KEY_MAX + 1] = { · line 3342

Quoted 1 line
drivers/hid/hid-debug.c +0 -0
@@ -3342,7 +3342,7 @@ static const char *keys[KEY_MAX + 1] = {
 	[KEY_FN_1] = "Fn+1",			[KEY_FN_2] = 

"Fn+2",

drivers/hid/hid-debug.c static const char *keys[KEY_MAX + 1] = { · line 3344

Quoted 2 lines
drivers/hid/hid-debug.c +0 -0
 	[KEY_FN_B] = "Fn+B",			[KEY_FN_D] = "Fn+D",
 	[KEY_FN_E] = "Fn+E",			[KEY_FN_F] = 

"Fn+F",

drivers/hid/hid-debug.c static const char *keys[KEY_MAX + 1] = {

Quoted 3 lines
drivers/hid/hid-debug.c +1 -1
-	[KEY_FN_S] = "Fn+S",
+	[KEY_FN_S] = "Fn+S",			[KEY_FN_P] = "Fn+P",
 	[KEY_FN_F1] = "Fn+F1",			[KEY_FN_F2] = 

"Fn+F2",

drivers/hid/hid-debug.c static const char *keys[KEY_MAX + 1] = { · line 3347

Quoted 1 line
drivers/hid/hid-debug.c +0 -0
 	[KEY_FN_F3] = "Fn+F3",			[KEY_FN_F4] = 

"Fn+F4",

drivers/hid/hid-debug.c static const char *keys[KEY_MAX + 1] = { · line 3348

Quoted 1 line
drivers/hid/hid-debug.c +0 -0
 	[KEY_FN_F5] = "Fn+F5",			[KEY_FN_F6] = 

"Fn+F6",

include/uapi/linux/input-event-codes.h line 554

Quoted 13 lines
(quoted diff) +0 -0

b/include/uapi/linux/input-event-codes.h index 3b2524e4b66..2fc79b32425 100644

include/uapi/linux/input-event-codes.h +1 -0
@@ -548,6 +548,7 @@
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
 #define KEY_FN_RIGHT_SHIFT	0x1e5
+#define KEY_FN_P		0x1e6
 
 #define KEY_BRL_DOT1		0x1f1
 #define KEY_BRL_DOT2		0x1f2

Hello,

Please don't merge this. I made a v2 of this patch and this is no longer needed.

Thanks!