FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 03-31-2011, 03:00 PM
Seth Forshee
 
Default UBUNTU: SAUCE: (drop after 2.6.38) eeepc-wmi: Add support for T101MT Home/Express Gate key

This key is different than other hotkeys, having seperate scan
codes for press, release, and hold, so it requires some special
filtering. Press and release events are passed on, and hold events
are ignored since sparse-keymap does not support hardware
autorepeat. Instead, the input core's software autorepeat is
enabled for the input device.

Note that "Home" in the context of this button doesn't mean the
same thing as the usual Home key, and it really isn't clear at
all what is meant by "Home". The manufacurer's description of the
button indicates that it should launch some sort of touch screen
settings interface on short press and apply a desktop rotation on
long press.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---

Note that this patch is based off master-next since it has a number of
patches to eeepc-wmi.c not present in master.

drivers/platform/x86/eeepc-wmi.c | 40 ++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index eea8c94..a44a510 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -104,6 +104,13 @@ MODULE_PARM_DESC(hotplug_wireless,
"If your laptop needs that, please report to "
"acpi4asus-user@lists.sourceforge.net.");

+/* Values for T101MT "Home" key */
+#define HOME_PRESS 0xe4
+#define HOME_HOLD 0xea
+#define HOME_RELEASE 0xe5
+
+#define EEEPC_WMI_KEY_IGNORE (-1)
+
static const struct key_entry eeepc_wmi_keymap[] = {
/* Sleep already handled via generic ACPI code */
{ KE_IGNORE, NOTIFY_BRNDOWN_MIN, { KEY_BRIGHTNESSDOWN } },
@@ -118,6 +125,7 @@ static const struct key_entry eeepc_wmi_keymap[] = {
{ KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } },
{ KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */
{ KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
+ { KE_KEY, HOME_PRESS, { KEY_CONFIG } },
{ KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
{ KE_END, 0},
};
@@ -178,6 +186,7 @@ static int eeepc_wmi_input_init(struct eeepc_wmi *eeepc)
eeepc->inputdev->phys = EEEPC_WMI_FILE "/input0";
eeepc->inputdev->id.bustype = BUS_HOST;
eeepc->inputdev->dev.parent = &eeepc->platform_device->dev;
+ __set_bit(EV_REP, eeepc->inputdev->evbit);

err = sparse_keymap_setup(eeepc->inputdev, eeepc_wmi_keymap, NULL);
if (err)
@@ -917,6 +926,25 @@ static void eeepc_wmi_backlight_exit(struct eeepc_wmi *eeepc)
eeepc->backlight_device = NULL;
}

+static void eeepc_wmi_homekey_filter(struct eeepc_wmi *eeepc, int *code,
+ unsigned int *value, bool *autorelease)
+{
+ switch (*code) {
+ case HOME_PRESS:
+ *value = 1;
+ *autorelease = 0;
+ break;
+ case HOME_HOLD:
+ *code = EEEPC_WMI_KEY_IGNORE;
+ break;
+ case HOME_RELEASE:
+ *code = HOME_PRESS;
+ *value = 0;
+ *autorelease = 0;
+ break;
+ }
+}
+
static void eeepc_wmi_notify(u32 value, void *context)
{
struct eeepc_wmi *eeepc = context;
@@ -925,6 +953,8 @@ static void eeepc_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) {
@@ -938,6 +968,11 @@ static void eeepc_wmi_notify(u32 value, void *context)
code = obj->integer.value;
orig_code = code;

+ eeepc_wmi_homekey_filter(eeepc, &code, &key_value,
+ &autorelease);
+ if (code == EEEPC_WMI_KEY_IGNORE)
+ goto exit;
+
if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
code = NOTIFY_BRNUP_MIN;
else if (code >= NOTIFY_BRNDOWN_MIN &&
@@ -949,11 +984,12 @@ static void eeepc_wmi_notify(u32 value, void *context)
eeepc_wmi_backlight_notify(eeepc, orig_code);
}

- if (!sparse_keymap_report_event(eeepc->inputdev,
- code, 1, true))
+ if (!sparse_keymap_report_event(eeepc->inputdev, code,
+ key_value, autorelease))
pr_info("Unknown key %x pressed
", code);
}

+exit:
kfree(obj);
}

--
1.7.4.1


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 07:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org