From d17c976c7c57eb2fd4f854606e07b1bd4eac079f Mon Sep 17 00:00:00 2001 From: JonnyTech <3584732+JonnyTech@users.noreply.github.com> Date: Sat, 28 Dec 2024 15:30:04 +0000 Subject: [PATCH 1/3] Fix for kernel 6.11 and newer As described in https://github.com/pelrun/hp-omen-linux-module/issues/28 --- src/hp-wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hp-wmi.c b/src/hp-wmi.c index b81651a..b34689d 100644 --- a/src/hp-wmi.c +++ b/src/hp-wmi.c @@ -1173,7 +1173,7 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) return err; } -static int __exit hp_wmi_bios_remove(struct platform_device *device) +static void __exit hp_wmi_bios_remove(struct platform_device *device) { int i; cleanup_sysfs(device); @@ -1196,7 +1196,7 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device) rfkill_destroy(wwan_rfkill); } - return 0; + // return 0; } static int hp_wmi_resume_handler(struct device *device) From bee0af748b162f0420f79cbfd5a82f8375c8cf09 Mon Sep 17 00:00:00 2001 From: JonnyTech <3584732+JonnyTech@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:06:30 +0000 Subject: [PATCH 2/3] Fix for kernel 6.12 and newer --- Makefile | 8 +++++++- src/hp-wmi.c | 14 +++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e6cb427..33776dc 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,14 @@ install: dkms install . + modprobe hp-wmi uninstall: - dkms remove hp-omen-wmi/0.9 --all + rmmod hp_wmi || true + dkms remove hp-omen-wmi/0.9 --all || true + rm /var/lib/dkms/hp-omen-wmi/0.9/source || true + rm -rf /usr/src/hp-omen-wmi-0.9 || true + rm -rf /var/lib/dkms/hp-omen-wmi || true + rm /usr/lib/modules/*-amd64/kernel/drivers/platform/x86/hp/hp-wmi.* || true all: install diff --git a/src/hp-wmi.c b/src/hp-wmi.c index b34689d..3a874ad 100644 --- a/src/hp-wmi.c +++ b/src/hp-wmi.c @@ -544,16 +544,19 @@ static DEVICE_ATTR_RO(dock); static DEVICE_ATTR_RO(tablet); static DEVICE_ATTR_RW(postcode); -static void hp_wmi_notify(u32 value, void *context) +static void hp_wmi_notify(union acpi_object *obj, void *context) { struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; u32 event_id, event_data; - union acpi_object *obj; acpi_status status; u32 *location; int key_code; - status = wmi_get_event_data(value, &response); + // Replace wmi_get_event_data with acpi_evaluate_object + char method[16]; + snprintf(method, sizeof(method), "_WED"); // Replace "_WED" with the actual ACPI method if different + status = acpi_evaluate_object(NULL, method, NULL, &response); + if (status == AE_NOT_FOUND) { // We've been woken up without any event data @@ -561,8 +564,9 @@ static void hp_wmi_notify(u32 value, void *context) event_id = HPWMI_OMEN_KEY; } else if (status != AE_OK) { - pr_info("bad event value 0x%x status 0x%x\n", value, status); - return; + // pr_info("bad event value 0x%x status 0x%x\n", 0, status); + // return; + event_id = HPWMI_OMEN_KEY; } else { From a3176ae65502a9c627e901c4fdbaf85da8ccf841 Mon Sep 17 00:00:00 2001 From: JonnyTech <3584732+JonnyTech@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:20:03 +0000 Subject: [PATCH 3/3] Correctly handle omen key signal #define AE_KEY_OMEN EXCEP_ENV (0x1001) --- src/hp-wmi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hp-wmi.c b/src/hp-wmi.c index 3a874ad..844ad40 100644 --- a/src/hp-wmi.c +++ b/src/hp-wmi.c @@ -544,6 +544,8 @@ static DEVICE_ATTR_RO(dock); static DEVICE_ATTR_RO(tablet); static DEVICE_ATTR_RW(postcode); +#define AE_KEY_OMEN EXCEP_ENV (0x1001) + static void hp_wmi_notify(union acpi_object *obj, void *context) { struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -563,11 +565,13 @@ static void hp_wmi_notify(union acpi_object *obj, void *context) // Some models do this when the Omen hotkey is pressed event_id = HPWMI_OMEN_KEY; } - else if (status != AE_OK) { - // pr_info("bad event value 0x%x status 0x%x\n", 0, status); - // return; + else if (status == AE_KEY_OMEN) { event_id = HPWMI_OMEN_KEY; } + else if (status != AE_OK) { + pr_info("bad event value 0x%x status 0x%x\n", 0, status); + return; + } else { obj = (union acpi_object *)response.pointer;