From patchwork Fri Aug 7 14:56:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Evans X-Patchwork-Id: 6970261 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AEDF2C05AC for ; Fri, 7 Aug 2015 14:58:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCCED20532 for ; Fri, 7 Aug 2015 14:58:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDB312052F for ; Fri, 7 Aug 2015 14:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753567AbbHGO6g (ORCPT ); Fri, 7 Aug 2015 10:58:36 -0400 Received: from mail-io0-f180.google.com ([209.85.223.180]:35485 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753525AbbHGO6g (ORCPT ); Fri, 7 Aug 2015 10:58:36 -0400 Received: by iodd187 with SMTP id d187so114083879iod.2 for ; Fri, 07 Aug 2015 07:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=/e7Srf643di+brZaYbU/aIoO938eXWoHUCMUnUcSSe0=; b=flIRwFZ0Rb1LhtiAdV6hKAPSkKfuDQXyUvLW61U5DFFIipjVqt/5029Z1Vdwm6rwIX eeMuAtfujUaAaMCTnP9l9z5/CCIRfeLqB+Uo47OIlfCVOSshQGxtZMAwdlNPcpFVsfOJ H8jz5K9sG16tKXF+5uq1uPKeQRFySEwOHkmVgggb7xkBp4aVd2dlrfeUga5r+Jbr3xHE wYieuT9zqMAj2TDLez0CxVf5hVHF+HW5rQYhDO8RTpy10LmNYgdkNPjHvhzO4b2oKBoV 20AlVMrAAqrM7mINFzQqRRduVTY/RdmPac8LDdAnYMTZS2FuokYUm5MeLoU9GfSYJsE9 pbqg== X-Received: by 10.107.153.5 with SMTP id b5mr9425049ioe.143.1438959515436; Fri, 07 Aug 2015 07:58:35 -0700 (PDT) Received: from localhost.localdomain (cpe-74-140-52-202.columbus.res.rr.com. [74.140.52.202]) by smtp.gmail.com with ESMTPSA id ha3sm2746474igb.15.2015.08.07.07.58.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 07:58:34 -0700 (PDT) From: Kyle Evans To: platform-driver-x86@vger.kernel.org Cc: Kyle Evans Subject: [PATCH] hp-wmi: limit hotkey enable Date: Fri, 7 Aug 2015 09:56:00 -0500 Message-Id: <1438959360-20901-1-git-send-email-kvans32@gmail.com> X-Mailer: git-send-email 1.8.5.5 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Fixes Bug #82451. Signed-off-by: Kyle Evans --- drivers/platform/x86/hp-wmi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 0669731..557650f 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 = 0xff; + 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 (!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; @@ -663,7 +672,7 @@ static int __init hp_wmi_input_setup(void) hp_wmi_tablet_state()); input_sync(hp_wmi_input_dev); - if (hp_wmi_bios_2009_later() == 4) + if (hp_wmi_bios_2009_later() == HPWMI_RET_UNKNOWN_CMDTYPE) hp_wmi_enable_hotkeys(); status = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL);