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 b81651a..844ad40 100644 --- a/src/hp-wmi.c +++ b/src/hp-wmi.c @@ -544,24 +544,32 @@ static DEVICE_ATTR_RO(dock); static DEVICE_ATTR_RO(tablet); static DEVICE_ATTR_RW(postcode); -static void hp_wmi_notify(u32 value, void *context) +#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 }; 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 // Some models do this when the Omen hotkey is pressed event_id = HPWMI_OMEN_KEY; } + 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", value, status); + pr_info("bad event value 0x%x status 0x%x\n", 0, status); return; } else @@ -1173,7 +1181,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 +1204,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)