Skip to contentSkip to conversation

platform/x86: hp-wmi: Handle Omen Key event

PATCH In review Rishit Bansal 2 participants 3 messages Jan 20, 2023 – Jan 23, 2023 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 platform/x86: hp-wmi: Handle Omen Key event

Add support to map the "HP Omen Key" to KEY_PROG2. Laptops in the HP Omen Series open the HP Omen Command Center application on windows. But, on linux it fails with the following message from the hp-wmi driver:

[ 5143.415714] hp_wmi: Unknown event_id - 29 - 0x21a5

Also adds support to map Fn+Esc to KEY_FN_ESC. This currently throws the following message on the hp-wmi driver:

[ 6082.143785] hp_wmi: Unknown key code - 0x21a7

There is also a "Win-Lock" key on HP Omen Laptops which supports Enabling and Disabling the Windows key, which trigger commands 0x21a4 and 0x121a4 respectively, but I wasn't able to find any KEY in input.h to map this to.

---
Changes since v1:
- Add support for FN+Esc Key

---
 drivers/platform/x86/hp/hp-wmi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/hp/hp-wmi.c +4 -0
index 0a99058be813..ab858db551fb 100644
@@ -91,6 +91,7 @@ enum hp_wmi_event_ids {
 	HPWMI_BATTERY_CHARGE_PERIOD	= 0x10,
 	HPWMI_SANITIZATION_MODE		= 0x17,
 	HPWMI_SMART_EXPERIENCE_APP	= 0x21,
+	HPWMI_OMEN_KEY				= 0x1D,
 };
 
 /*
@@ -219,6 +220,8 @@ static const struct key_entry hp_wmi_keymap[] = {
 	{ KE_KEY, 0x21a9,  { KEY_TOUCHPAD_OFF } },
 	{ KE_KEY, 0x121a9, { KEY_TOUCHPAD_ON } },
 	{ KE_KEY, 0x231b,  { KEY_HELP } },
+	{ KE_KEY, 0x21a5,  { KEY_PROG2 }}, /* HP Omen Key */
+	{ KE_KEY, 0x21a7, { KEY_FN_ESC }},
 	{ KE_END, 0 }
 };
 
@@ -810,6 +813,7 @@ static void hp_wmi_notify(u32 value, void *context)
 	case HPWMI_SMART_ADAPTER:
 		break;
 	case HPWMI_BEZEL_BUTTON:
+	case HPWMI_OMEN_KEY:
 		key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
 		if (key_code < 0)
 			break;
Signature · 1 line
2.37.2
#1 lore raw

Hi,

Quoted 9 lines · Rishit Bansal

Add support to map the "HP Omen Key" to KEY_PROG2. Laptops in the HP Omen Series open the HP Omen Command Center application on windows. But, on linux it fails with the following message from the hp-wmi driver:

[ 5143.415714] hp_wmi: Unknown event_id - 29 - 0x21a5

Also adds support to map Fn+Esc to KEY_FN_ESC. This currently throws the following message on the hp-wmi driver:

Quoted 6 lines
[ 6082.143785] hp_wmi: Unknown key code - 0x21a7

There is also a "Win-Lock" key on HP Omen Laptops which supports Enabling and Disabling the Windows key, which trigger commands 0x21a4 and 0x121a4 respectively, but I wasn't able to find any KEY in input.h to map this to.

We could add KE_IGNORE mappings to hp_wmi_keymap for those, doing so should silence the warnings about unknown codes.

If you think this is useful please provide a separate follow-up patch for this.

Quoted 1 line

I have merged this v2 now, but with some coding style changes, for your next patches please try to keep the indentation and sorting of things correct.

Quoted 12 lines

---
Changes since v1:
- Add support for FN+Esc Key

---
 drivers/platform/x86/hp/hp-wmi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/hp/hp-wmi.c +0 -0
index 0a99058be813..ab858db551fb 100644

drivers/platform/x86/hp/hp-wmi.c enum hp_wmi_event_ids { · line 94

Quoted 4 lines
drivers/platform/x86/hp/hp-wmi.c +1 -0
@@ -91,6 +91,7 @@ enum hp_wmi_event_ids {
 	HPWMI_BATTERY_CHARGE_PERIOD	= 0x10,
 	HPWMI_SANITIZATION_MODE		= 0x17,
 	HPWMI_SMART_EXPERIENCE_APP	= 0x21,
+	HPWMI_OMEN_KEY				= 0x1D,

There is one <tab> too much before the '= 0x1D' and 0x1D should be between the 0x17 and 0x21 lines.

drivers/platform/x86/hp/hp-wmi.c static const struct key_entry hp_wmi_keymap[] = { · line 224

Quoted 9 lines
drivers/platform/x86/hp/hp-wmi.c +2 -0
 };
 
 /*
@@ -219,6 +220,8 @@ static const struct key_entry hp_wmi_keymap[] = {
 	{ KE_KEY, 0x21a9,  { KEY_TOUCHPAD_OFF } },
 	{ KE_KEY, 0x121a9, { KEY_TOUCHPAD_ON } },
 	{ KE_KEY, 0x231b,  { KEY_HELP } },
+	{ KE_KEY, 0x21a5,  { KEY_PROG2 }}, /* HP Omen Key */
+	{ KE_KEY, 0x21a7, { KEY_FN_ESC }},

These need to be above the 0x21a9 line, so sorted by base event code (lower 16 bits) Also you are missing a space in the indentation of the { KEY_FN_ESC } and there should be a space between the 2 }} at the end like on the other lines.

Regards,

Hans

Quoted 11 lines
drivers/platform/x86/hp/hp-wmi.c +1 -0
 	{ KE_END, 0 }
 };
 
@@ -810,6 +813,7 @@ static void hp_wmi_notify(u32 value, void *context)
 	case HPWMI_SMART_ADAPTER:
 		break;
 	case HPWMI_BEZEL_BUTTON:
+	case HPWMI_OMEN_KEY:
 		key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
 		if (key_code < 0)
 			break;
#2 lore raw
Quoted 18 lines · Hans de Goede

Hi,

Quoted 9 lines · Rishit Bansal

Add support to map the "HP Omen Key" to KEY_PROG2. Laptops in the HP Omen Series open the HP Omen Command Center application on windows. But, on linux it fails with the following message from the hp-wmi driver:

[ 5143.415714] hp_wmi: Unknown event_id - 29 - 0x21a5

Also adds support to map Fn+Esc to KEY_FN_ESC. This currently throws the following message on the hp-wmi driver:

Quoted 6 lines
[ 6082.143785] hp_wmi: Unknown key code - 0x21a7

There is also a "Win-Lock" key on HP Omen Laptops which supports Enabling and Disabling the Windows key, which trigger commands 0x21a4 and 0x121a4 respectively, but I wasn't able to find any KEY in input.h to map this to.

Quoted 5 lines

We could add KE_IGNORE mappings to hp_wmi_keymap for those, doing so should silence the warnings about unknown codes.

If you think this is useful please provide a separate follow-up patch for this.

Alright, I will make a follow up patch for this change.

Quoted 4 lines
Quoted 1 line

I have merged this v2 now, but with some coding style changes, for your next patches please try to keep the indentation and sorting of things correct.

Thank you for pointing out and fixing up the styling issues! I'll surely keep this in mind for future patches.

Quoted 50 lines
Quoted 13 lines

---
Changes since v1:
- Add support for FN+Esc Key

---
  drivers/platform/x86/hp/hp-wmi.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/platform/x86/hp/hp-wmi.c +0 -0
index 0a99058be813..ab858db551fb 100644

drivers/platform/x86/hp/hp-wmi.c enum hp_wmi_event_ids { · line 94

Quoted 4 lines
drivers/platform/x86/hp/hp-wmi.c +1 -0
@@ -91,6 +91,7 @@ enum hp_wmi_event_ids {
  	HPWMI_BATTERY_CHARGE_PERIOD	= 0x10,
  	HPWMI_SANITIZATION_MODE		= 0x17,
  	HPWMI_SMART_EXPERIENCE_APP	= 0x21,
+	HPWMI_OMEN_KEY				= 0x1D,

There is one <tab> too much before the '= 0x1D' and 0x1D should be between the 0x17 and 0x21 lines.

drivers/platform/x86/hp/hp-wmi.c static const struct key_entry hp_wmi_keymap[] = { · line 224

Quoted 9 lines
drivers/platform/x86/hp/hp-wmi.c +2 -0
  };
 
  /*
@@ -219,6 +220,8 @@ static const struct key_entry hp_wmi_keymap[] = {
  	{ KE_KEY, 0x21a9,  { KEY_TOUCHPAD_OFF } },
  	{ KE_KEY, 0x121a9, { KEY_TOUCHPAD_ON } },
  	{ KE_KEY, 0x231b,  { KEY_HELP } },
+	{ KE_KEY, 0x21a5,  { KEY_PROG2 }}, /* HP Omen Key */
+	{ KE_KEY, 0x21a7, { KEY_FN_ESC }},

These need to be above the 0x21a9 line, so sorted by base event code (lower 16 bits) Also you are missing a space in the indentation of the { KEY_FN_ESC } and there should be a space between the 2 }} at the end like on the other lines.

Regards,

Hans

Quoted 11 lines
drivers/platform/x86/hp/hp-wmi.c +1 -0
  	{ KE_END, 0 }
  };
 
@@ -810,6 +813,7 @@ static void hp_wmi_notify(u32 value, void *context)
  	case HPWMI_SMART_ADAPTER:
  		break;
  	case HPWMI_BEZEL_BUTTON:
+	case HPWMI_OMEN_KEY:
  		key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
  		if (key_code < 0)
  			break;