Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

20 changes: 14 additions & 6 deletions src/hp-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down