Patch successfully tested on my HP6510b with 3.19.3 kernel.
Thanks

Bertrand Vieille

----- Mail original -----
De: "Kyle Evans" <[email protected]>
À: "Aaron Lu" <[email protected]>, [email protected], 
"Bertrand Vieille" <[email protected]>
Cc: "Kyle Evans" <[email protected]>
Envoyé: Vendredi 27 Mars 2015 19:33:11
Objet: [PATCH] hp-wmi: limit hotkey enable

Do not attempt to initialize hotkeys if the query returns a value.
Furthermore, do not write initialize magic on systems that do not have
feature query 0xb.

Signed-off-by: Kyle Evans <[email protected]>
---
 drivers/platform/x86/hp-wmi.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 0ab2b37..4a4d6e3 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -54,6 +54,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
 #define HPWMI_HARDWARE_QUERY 0x4
 #define HPWMI_WIRELESS_QUERY 0x5
 #define HPWMI_BIOS_QUERY 0x9
+#define HPWMI_FEATURE2_QUERY 0xb
 #define HPWMI_HOTKEY_QUERY 0xc
 #define HPWMI_FEATURE_QUERY 0xd
 #define HPWMI_WIRELESS2_QUERY 0x1b
@@ -309,10 +310,18 @@ static int __init hp_wmi_bios_2009_later(void)
 static int hp_wmi_enable_hotkeys(void)
 {
        int ret;
-       int query = 0x6e;
+       int query;
+       int value = 0x6e;
 
-       ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query, sizeof(query),
-                                  0);
+       ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 0, &query,
+                                  0, sizeof(query));
+
+       if (!ret && !query) {
+               if (!hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, 0, &query,
+                                         0, sizeof(query)))
+                   ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &value,
+                                              sizeof(value), 0);
+       }
 
        if (ret)
                return -EINVAL;
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to