diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2011-07-01 05:34:27 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-08-05 14:45:48 -0400 |
commit | c4453f6a7ceff330ff37a9712ee8305fc3f8e9b6 (patch) | |
tree | 6a1564cbff80f8a7df4fa7160cc442ed6d49103a | |
parent | 49979d091d1847823c064301da1ec173619ddd92 (diff) |
asus-wmi: Add callback for hotkey filtering
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>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 12 | ||||
-rw-r--r-- | 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 bcb9fb41ddc4..cea9fdcad64c 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -1061,6 +1061,8 @@ static void asus_wmi_notify(u32 value, void *context) | |||
1061 | acpi_status status; | 1061 | acpi_status status; |
1062 | int code; | 1062 | int code; |
1063 | int orig_code; | 1063 | int orig_code; |
1064 | unsigned int key_value = 1; | ||
1065 | bool autorelease = 1; | ||
1064 | 1066 | ||
1065 | status = wmi_get_event_data(value, &response); | 1067 | status = wmi_get_event_data(value, &response); |
1066 | if (status != AE_OK) { | 1068 | if (status != AE_OK) { |
@@ -1076,6 +1078,13 @@ static void asus_wmi_notify(u32 value, void *context) | |||
1076 | code = obj->integer.value; | 1078 | code = obj->integer.value; |
1077 | orig_code = code; | 1079 | orig_code = code; |
1078 | 1080 | ||
1081 | if (asus->driver->key_filter) { | ||
1082 | asus->driver->key_filter(asus->driver, &code, &key_value, | ||
1083 | &autorelease); | ||
1084 | if (code == ASUS_WMI_KEY_IGNORE) | ||
1085 | goto exit; | ||
1086 | } | ||
1087 | |||
1079 | if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX) | 1088 | if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX) |
1080 | code = NOTIFY_BRNUP_MIN; | 1089 | code = NOTIFY_BRNUP_MIN; |
1081 | else if (code >= NOTIFY_BRNDOWN_MIN && | 1090 | else if (code >= NOTIFY_BRNDOWN_MIN && |
@@ -1085,7 +1094,8 @@ static void asus_wmi_notify(u32 value, void *context) | |||
1085 | if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) { | 1094 | if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) { |
1086 | if (!acpi_video_backlight_support()) | 1095 | if (!acpi_video_backlight_support()) |
1087 | asus_wmi_backlight_notify(asus, orig_code); | 1096 | asus_wmi_backlight_notify(asus, orig_code); |
1088 | } else if (!sparse_keymap_report_event(asus->inputdev, code, 1, true)) | 1097 | } else if (!sparse_keymap_report_event(asus->inputdev, code, |
1098 | key_value, autorelease)) | ||
1089 | pr_info("Unknown key %x pressed\n", code); | 1099 | pr_info("Unknown key %x pressed\n", code); |
1090 | 1100 | ||
1091 | exit: | 1101 | exit: |
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h index c044522c8766..4da61033bcb9 100644 --- a/drivers/platform/x86/asus-wmi.h +++ b/drivers/platform/x86/asus-wmi.h | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | 31 | ||
32 | #define ASUS_WMI_KEY_IGNORE (-1) | ||
33 | |||
32 | struct module; | 34 | struct module; |
33 | struct key_entry; | 35 | struct key_entry; |
34 | struct asus_wmi; | 36 | struct asus_wmi; |
@@ -44,6 +46,10 @@ struct asus_wmi_driver { | |||
44 | const struct key_entry *keymap; | 46 | const struct key_entry *keymap; |
45 | const char *input_name; | 47 | const char *input_name; |
46 | const char *input_phys; | 48 | const char *input_phys; |
49 | /* Returns new code, value, and autorelease values in arguments. | ||
50 | * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */ | ||
51 | void (*key_filter) (struct asus_wmi_driver *driver, int *code, | ||
52 | unsigned int *value, bool *autorelease); | ||
47 | 53 | ||
48 | int (*probe) (struct platform_device *device); | 54 | int (*probe) (struct platform_device *device); |
49 | void (*quirks) (struct asus_wmi_driver *driver); | 55 | void (*quirks) (struct asus_wmi_driver *driver); |