Skip to contentSkip to conversation

platform/x86: huawei-wmi: add modern Honor MagicBook hotkeys

PATCH Superseded Ruzal Daminov 2 participants 4 messages Aug 14 – Sep 18 x86 platform drivers

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 platform/x86: huawei-wmi: add modern Honor MagicBook hotkeys

Honor MagicBook laptops (e.g. FMI-76 / X14 / X16 Plus series) use the ACPI WMI interface (GUID 0xA0) with modern function key scancodes.

Add the missing keycodes to huawei_wmi_keymap[]:
- 0x0287: Mic mute key (Fn+F7) -> KEY_MICMUTE
- 0x0288: Camera toggle (Fn+F8) -> KEY_CAMERA
- 0x028a: Honor Connect / Share (Fn+F10) -> KEY_CONFIG
- 0x028b: YOYO AI Assistant (Fn+F11) -> KEY_VOICECOMMAND
- 0x028e: Screenshot key (Fn+F12) -> KEY_PRINT

Tested on Honor MagicBook X14 Plus (FMI-76, AMD Ryzen 8845HS).

---
 drivers/platform/x86/huawei-wmi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/platform/x86/huawei-wmi.c +6 -0
index 93cca17fd..d5f77fb68 100644
@@ -72,6 +72,12 @@ struct huawei_wmi {
 static struct huawei_wmi *huawei_wmi;
 
 static const struct key_entry huawei_wmi_keymap[] = {
+	{ KE_KEY, 0x0287, { KEY_MICMUTE } },
+	{ KE_KEY, 0x0288, { KEY_CAMERA } },              /* Fn+F8: Camera */
+	{ KE_KEY, 0x028a, { KEY_CONFIG } },              /* Fn+F10: Honor Connect */
+	{ KE_KEY, 0x028b, { KEY_VOICECOMMAND } },        /* Fn+F11: YOYO AI */
+	{ KE_KEY, 0x028e, { KEY_PRINT } },               /* Fn+F12: Screenshot */
+
 	{ KE_KEY,    0x281, { KEY_BRIGHTNESSDOWN } },
 	{ KE_KEY,    0x282, { KEY_BRIGHTNESSUP } },
 	{ KE_KEY,    0x284, { KEY_MUTE } },
Signature · 1 line
2.55.0
maintainer
#1 lore raw
Quoted 24 lines · Ruzal Daminov

Honor MagicBook laptops (e.g. FMI-76 / X14 / X16 Plus series) use the ACPI WMI interface (GUID 0xA0) with modern function key scancodes.

Add the missing keycodes to huawei_wmi_keymap[]:
- 0x0287: Mic mute key (Fn+F7) -> KEY_MICMUTE
- 0x0288: Camera toggle (Fn+F8) -> KEY_CAMERA
- 0x028a: Honor Connect / Share (Fn+F10) -> KEY_CONFIG
- 0x028b: YOYO AI Assistant (Fn+F11) -> KEY_VOICECOMMAND
- 0x028e: Screenshot key (Fn+F12) -> KEY_PRINT

Tested on Honor MagicBook X14 Plus (FMI-76, AMD Ryzen 8845HS).

---
 drivers/platform/x86/huawei-wmi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/platform/x86/huawei-wmi.c +0 -0
index 93cca17fd..d5f77fb68 100644
@@ -72,6 +72,12 @@ struct huawei_wmi {
 static struct huawei_wmi *huawei_wmi;
 

drivers/platform/x86/huawei-wmi.c struct huawei_wmi { · line 83

Quoted 10 lines
drivers/platform/x86/huawei-wmi.c +6 -0
 static const struct key_entry huawei_wmi_keymap[] = {
+	{ KE_KEY, 0x0287, { KEY_MICMUTE } },
+	{ KE_KEY, 0x0288, { KEY_CAMERA } },              /* Fn+F8: Camera */
+	{ KE_KEY, 0x028a, { KEY_CONFIG } },              /* Fn+F10: Honor Connect */
+	{ KE_KEY, 0x028b, { KEY_VOICECOMMAND } },        /* Fn+F11: YOYO AI */
+	{ KE_KEY, 0x028e, { KEY_PRINT } },               /* Fn+F12: Screenshot */
+
 	{ KE_KEY,    0x281, { KEY_BRIGHTNESSDOWN } },
 	{ KE_KEY,    0x282, { KEY_BRIGHTNESSUP } },
 	{ KE_KEY,    0x284, { KEY_MUTE } },

??? Multiple of those keys are already in the array ???

I suppose you'd have noticed it if you'd have not added the leading zeros and would have put those correctly in their place in the numerical order.

Please also keep the existing formatting.

Signature · 1 line
 i.
#2 lore raw

PATCH v2 1/1 platform/x86: huawei-wmi: add camera toggle keycode

In reply to Ruzal Daminov

Honor MagicBook laptops emit WMI event code 0x288 when pressing the camera e-shutter / privacy toggle key (Fn+F8 on Honor).

Add the missing 0x288 keycode to huawei_wmi_keymap[] in correct numerical order and map it to KEY_CAMERA_ACCESS_TOGGLE.

Tested on Honor MagicBook X14 Plus (FMI-76, AMD Ryzen 8845HS).

---
v2:
- Drop duplicate keys already present in the table.
- Remove leading zeros to match existing table style.
- Place 0x288 in correct numerical order.
- Map 0x288 to KEY_CAMERA_ACCESS_TOGGLE.

 drivers/platform/x86/huawei-wmi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/x86/huawei-wmi.c +1 -0
index 93cca17fdf5868..b5463edc4053d4 100644
@@ -78,6 +78,7 @@ static const struct key_entry huawei_wmi_keymap[] = {
 	{ KE_KEY,    0x285, { KEY_VOLUMEDOWN } },
 	{ KE_KEY,    0x286, { KEY_VOLUMEUP } },
 	{ KE_KEY,    0x287, { KEY_MICMUTE } },
+	{ KE_KEY,    0x288, { KEY_CAMERA_ACCESS_TOGGLE } },
 	{ KE_KEY,    0x289, { KEY_WLAN } },
 	// Huawei |M| key
 	{ KE_KEY,    0x28a, { KEY_CONFIG } },
Signature · 1 line
2.45.2
maintainer
#3 lore raw

Re: [PATCH v2] platform/x86: huawei-wmi: add camera toggle keycode

Quoted 9 lines · Ruzal Daminov

Honor MagicBook laptops emit WMI event code 0x288 when pressing the camera e-shutter / privacy toggle key (Fn+F8 on Honor).

Add the missing 0x288 keycode to huawei_wmi_keymap[] in correct numerical order and map it to KEY_CAMERA_ACCESS_TOGGLE.

Tested on Honor MagicBook X14 Plus (FMI-76, AMD Ryzen 8845HS).

[...]

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: huawei-wmi: add camera toggle keycode

      commit: 885b55bcd2336c578821b0788aac95c4679d68e3

--
i.