Re: [PATCH v3 2/3] eeepc-wmi: Add support for T101MT Home/ExpressGate key

From: Corentin Chary
Date: Tue Mar 29 2011 - 08:29:17 EST


On Mon, Mar 28, 2011 at 6:33 PM, Seth Forshee
<seth.forshee@xxxxxxxxxxxxx> wrote:
> 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.
>
> 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@xxxxxxxxxxxxx>
> ---
> Âdrivers/platform/x86/eeepc-wmi.c | Â 26 ++++++++++++++++++++++++++
> Â1 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
> index 0ddc434..8f3112d5 100644
> --- a/drivers/platform/x86/eeepc-wmi.c
> +++ b/drivers/platform/x86/eeepc-wmi.c
> @@ -56,6 +56,11 @@ MODULE_PARM_DESC(hotplug_wireless,
> Â Â Â Â Â Â Â Â "If your laptop needs that, please report to "
> Â Â Â Â Â Â Â Â "acpi4asus-user@xxxxxxxxxxxxxxxxxxxxxx");
>
> +/* Values for T101MT "Home" key */
> +#define HOME_PRESS Â Â 0xe4
> +#define HOME_HOLD Â Â Â0xea
> +#define HOME_RELEASE Â 0xe5
> +
> Âstatic const struct key_entry eeepc_wmi_keymap[] = {
> Â Â Â Â/* Sleep already handled via generic ACPI code */
> Â Â Â Â{ KE_KEY, 0x30, { KEY_VOLUMEUP } },
> @@ -70,6 +75,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 } },

What X11 key is mapped to KEY_CONFIG ?

> Â Â Â Â{ KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
> Â Â Â Â{ KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
> Â Â Â Â{ KE_KEY, 0xec, { KEY_CAMERA_UP } },
> @@ -79,6 +85,25 @@ static const struct key_entry eeepc_wmi_keymap[] = {
> Â Â Â Â{ KE_END, 0},
> Â};
>
> +static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned int *value, bool *autorelease)
> +{
> + Â Â Â switch (*code) {
> + Â Â Â case HOME_PRESS:
> + Â Â Â Â Â Â Â *value = 1;
> + Â Â Â Â Â Â Â *autorelease = 0;
> + Â Â Â Â Â Â Â break;
> + Â Â Â case HOME_HOLD:
> + Â Â Â Â Â Â Â *code = ASUS_WMI_KEY_IGNORE;
> + Â Â Â Â Â Â Â break;
> + Â Â Â case HOME_RELEASE:
> + Â Â Â Â Â Â Â *code = HOME_PRESS;
> + Â Â Â Â Â Â Â *value = 0;
> + Â Â Â Â Â Â Â *autorelease = 0;
> + Â Â Â Â Â Â Â break;
> + Â Â Â }
> +}
> +
> Âstatic acpi_status eeepc_wmi_parse_device(acpi_handle handle, u32 level,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â void *context, void **retval)
> Â{
> @@ -149,6 +174,7 @@ static struct asus_wmi_driver asus_wmi_driver = {
> Â Â Â Â.keymap = eeepc_wmi_keymap,
> Â Â Â Â.input_name = "Eee PC WMI hotkeys",
> Â Â Â Â.input_phys = EEEPC_WMI_FILE "/input0",
> + Â Â Â .key_filter = eeepc_wmi_key_filter,
> Â Â Â Â.probe = eeepc_wmi_probe,
> Â Â Â Â.quirks = eeepc_wmi_quirks,
> Â};
> --
> 1.7.4.1
>
>

I think this version is ok,

Matthew, do you think this should be delayed for 2.6.40 (merge window
will close soon, so now it's probably time for fix only) ?

--
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/