From 14c37444e67c880fd9cb6d98a34a60e1ef4d828e Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 4 Dec 2020 13:14:46 +0100 Subject: [PATCH] clevo_interfaces: Change event handling & use separate wmi module --- src/clevo_acpi.c | 9 +++++++-- src/clevo_keyboard.h | 7 ++----- src/tuxedo_keyboard.c | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/clevo_acpi.c b/src/clevo_acpi.c index 7f9b78e..fbc5b48 100644 --- a/src/clevo_acpi.c +++ b/src/clevo_acpi.c @@ -129,6 +129,8 @@ static int clevo_acpi_add(struct acpi_device *device) // Add this interface clevo_keyboard_add_interface(&clevo_acpi_interface); + pr_info("clevo_acpi: interface initialized\n"); + return 0; } @@ -142,8 +144,11 @@ static int clevo_acpi_remove(struct acpi_device *device) void clevo_acpi_notify(struct acpi_device *device, u32 event) { - struct clevo_acpi_driver_data_t *clevo_acpi_driver_data; - pr_debug("clevo_acpi event: %0#10x\n", event); + u32 event_value; + // struct clevo_acpi_driver_data_t *clevo_acpi_driver_data; + + clevo_acpi_evaluate(device, 0x01, 0, &event_value); + pr_debug("clevo_acpi event: %0#6x, clevo event value: %0#6x\n", event, event_value); // clevo_acpi_driver_data = container_of(&device, struct clevo_acpi_driver_data_t, adev); if (!IS_ERR_OR_NULL(clevo_acpi_interface.event_callb)) { diff --git a/src/clevo_keyboard.h b/src/clevo_keyboard.h index eabedbf..8c6c260 100644 --- a/src/clevo_keyboard.h +++ b/src/clevo_keyboard.h @@ -595,12 +595,9 @@ static int brightness_validator(const char *value, void clevo_keyboard_event_callb(u32 event) { - u32 key_event; + u32 key_event = event; - clevo_evaluate_method(WMI_SUBMETHOD_ID_GET_EVENT, 0, &key_event); - // event = received notification value - // key_event = returned from clevo get event method - TUXEDO_DEBUG("clevo event -> event: %0#6x key_event: %0#6x\n", event, key_event); + // TUXEDO_DEBUG("clevo event: %0#6x\n", event); switch (key_event) { case WMI_KEYEVENT_CODE_DECREASE_BACKLIGHT: diff --git a/src/tuxedo_keyboard.c b/src/tuxedo_keyboard.c index c4f3872..891dfba 100644 --- a/src/tuxedo_keyboard.c +++ b/src/tuxedo_keyboard.c @@ -39,7 +39,6 @@ MODULE_ALIAS("wmi:" UNIWILL_WMI_EVENT_GUID_2); MODULE_SOFTDEP("pre: tuxedo-cc-wmi"); static struct tuxedo_keyboard_driver *driver_list[] = { - &clevo_keyboard_driver, &uniwill_keyboard_driver };