X86 platform drivers
 help / color / mirror / Atom feed
From: Corentin Chary <corentin.chary@gmail.com>
To: platform-driver-x86@vger.kernel.org
Cc: Seth Forshee <seth.forshee@canonical.com>,
	Corentin Chary <corentin.chary@gmail.com>,
	Corentin Chary <corentincj@iksaif.net>,
	Matthew Garrett <mjg@redhat.com>,
	"open list:ASUS NOTEBOOKS AN..."
	<acpi4asus-user@lists.sourceforge.net>,
	open list <linux-kernel@vger.kernel.org>
Subject: [PATCH 02/16] asus-wmi: Add callback for hotkey filtering
Date: Fri,  1 Jul 2011 11:34:27 +0200	[thread overview]
Message-ID: <1309512881-2901-3-git-send-email-corentin.chary@gmail.com> (raw)
In-Reply-To: <1309512881-2901-1-git-send-email-corentin.chary@gmail.com>

From: Seth Forshee <seth.forshee@canonical.com>

This is required for the T101MT home key, which behaves differently
than other hotkeys.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c |   12 +++++++++++-
 drivers/platform/x86/asus-wmi.h |    6 ++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index d1ddb4a..a09271d 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1060,6 +1060,8 @@ static void asus_wmi_notify(u32 value, void *context)
 	acpi_status status;
 	int code;
 	int orig_code;
+	unsigned int key_value = 1;
+	bool autorelease = 1;
 
 	status = wmi_get_event_data(value, &response);
 	if (status != AE_OK) {
@@ -1075,6 +1077,13 @@ static void asus_wmi_notify(u32 value, void *context)
 	code = obj->integer.value;
 	orig_code = code;
 
+	if (asus->driver->key_filter) {
+		asus->driver->key_filter(asus->driver, &code, &key_value,
+					 &autorelease);
+		if (code == ASUS_WMI_KEY_IGNORE)
+			goto exit;
+	}
+
 	if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
 		code = NOTIFY_BRNUP_MIN;
 	else if (code >= NOTIFY_BRNDOWN_MIN &&
@@ -1084,7 +1093,8 @@ static void asus_wmi_notify(u32 value, void *context)
 	if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) {
 		if (!acpi_video_backlight_support())
 			asus_wmi_backlight_notify(asus, orig_code);
-	} else if (!sparse_keymap_report_event(asus->inputdev, code, 1, true))
+	} else if (!sparse_keymap_report_event(asus->inputdev, code,
+					       key_value, autorelease))
 		pr_info("Unknown key %x pressed\n", code);
 
 exit:
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index c044522..4da6103 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -29,6 +29,8 @@
 
 #include <linux/platform_device.h>
 
+#define ASUS_WMI_KEY_IGNORE (-1)
+
 struct module;
 struct key_entry;
 struct asus_wmi;
@@ -44,6 +46,10 @@ struct asus_wmi_driver {
 	const struct key_entry	*keymap;
 	const char		*input_name;
 	const char		*input_phys;
+	/* Returns new code, value, and autorelease values in arguments.
+	 * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */
+	void (*key_filter) (struct asus_wmi_driver *driver, int *code,
+			    unsigned int *value, bool *autorelease);
 
 	int (*probe) (struct platform_device *device);
 	void (*quirks) (struct asus_wmi_driver *driver);
-- 
1.7.3.4

  parent reply	other threads:[~2011-07-01  9:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01  9:34 [PATCH 00/16] acpi4asus updates for 3.1 Corentin Chary
2011-07-01  9:34 ` [PATCH 01/16] asus-wmi: fix hwmon/pwm1 Corentin Chary
2011-07-01  9:34 ` Corentin Chary [this message]
2011-07-01  9:34 ` [PATCH 03/16] eeepc-wmi: Add support for T101MT Home/Express Gate key Corentin Chary
2011-07-01  9:34 ` [PATCH 04/16] asus-wmi: Enable autorepeat for hotkey input device Corentin Chary
2011-07-01 14:15   ` Matthew Garrett
2011-07-04  7:49     ` Corentin Chary
2011-07-01  9:34 ` [PATCH 05/16] asus-wmi: second part of the version starts at 16 not 8 Corentin Chary
2011-07-01  9:34 ` [PATCH 06/16] asus-wmi: add keyboard backlight support Corentin Chary
2011-07-01  9:34 ` [PATCH 07/16] asus-wmi: fix section mismatch Corentin Chary
2011-07-01  9:34 ` [PATCH 08/16] asus-wmi: set backlight type Corentin Chary
2011-07-01  9:34 ` [PATCH 09/16] asus-wmi: fix keyboard backlight detection Corentin Chary
2011-07-01  9:34 ` [PATCH 10/16] asus-wmi: add some device ids Corentin Chary
2011-07-01  9:34 ` [PATCH 11/16] asus-wmi: add thermal sensor Corentin Chary
2011-07-01  9:34 ` [PATCH 12/16] asus-wmi: check for temp1 presence Corentin Chary
2011-07-01  9:34 ` [PATCH 13/16] asus-wmi: return proper value in store_cpufv() Corentin Chary
2011-07-01  9:34 ` [PATCH 14/16] asus-wmi: add CWAP support and clarify the meaning of WAPF bits Corentin Chary
2011-07-01  9:34 ` [PATCH 15/16] asus-wmi: add gps rfkill support Corentin Chary
2011-07-01  9:34 ` [PATCH 16/16] asus-wmi: add uwb " Corentin Chary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309512881-2901-3-git-send-email-corentin.chary@gmail.com \
    --to=corentin.chary@gmail.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentincj@iksaif.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=seth.forshee@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox