From e74a3404a74982e3409ece908eb9e5f016566726 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 29 May 2020 13:19:28 +0200 Subject: [PATCH] Add additional id check to existing driver --- src/clevo_keyboard.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/clevo_keyboard.h b/src/clevo_keyboard.h index 63ebd72..7793ba2 100644 --- a/src/clevo_keyboard.h +++ b/src/clevo_keyboard.h @@ -635,15 +635,27 @@ static DEVICE_ATTR(extra, 0444, show_hasextra_fs, NULL); static int clevo_keyboard_probe(struct platform_device *dev) { - int status; + int status, ret; if (!wmi_has_guid(CLEVO_EVENT_GUID)) { - TUXEDO_ERROR("No known WMI event notification GUID found\n"); + TUXEDO_DEBUG("probe: Clevo event guid missing\n"); return -ENODEV; } if (!wmi_has_guid(CLEVO_GET_GUID)) { - TUXEDO_ERROR("No known WMI control method GUID found\n"); + TUXEDO_DEBUG("probe: Clevo method guid missing\n"); + return -ENODEV; + } + + // Since the WMI GUIDs aren't unique let's (at least) + // check the return of some "known existing general" method + status = evaluate_wmi_method_clevo(0x52, 0, &ret); + if (status < 0) { + TUXEDO_DEBUG("probe: Clevo GUIDs present but method call failed\n"); + return -ENODEV; + } + if (ret == 0xffffffff) { + TUXEDO_DEBUG("probe: Clevo GUIDs present but method returned unexpected value\n"); return -ENODEV; }