X86 platform drivers
 help / color / mirror / Atom feed
From: joeyli <jlee@suse.com>
To: "Bernhard Rosenkränzer" <bero@lindev.ch>
Cc: platform-driver-x86@vger.kernel.org, carlos@strangeworlds.co.uk
Subject: Re: [PATCH] Add support for Acer Predator macro keys
Date: Mon, 7 Mar 2016 13:03:06 +0800	[thread overview]
Message-ID: <20160307050306.GC6160@linux-rxt1.site> (raw)
In-Reply-To: <1457244539-23763-1-git-send-email-bero@lindev.ch>

On Sun, Mar 06, 2016 at 07:08:59AM +0100, Bernhard Rosenkränzer wrote:
> This patch adds support for the macro keys found on
> Acer Predator laptops.
> 
> Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>

Acked-by: Lee, Chun-Yi <jlee@suse.com>


Thanks a lot!

Joey Lee

> ---
>  drivers/platform/x86/acer-wmi.c | 44 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 1062fa4..e2d333c 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -7,6 +7,9 @@
>   *    Copyright (C) 2005-2007	E.M. Smith
>   *    Copyright (C) 2007-2008	Carlos Corbacho <cathectic@gmail.com>
>   *
> + *  Added support for Acer Predator hotkeys:
> + *    Copyright (C) 2016	Bernhard Rosenkraenzer <bero@lindev.ch>
> + *
>   *  This program is free software; you can redistribute it and/or modify
>   *  it under the terms of the GNU General Public License as published by
>   *  the Free Software Foundation; either version 2 of the License, or
> @@ -94,6 +97,7 @@ MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
>  enum acer_wmi_event_ids {
>  	WMID_HOTKEY_EVENT = 0x1,
>  	WMID_ACCEL_EVENT = 0x5,
> +	WMID_MACROKEY_EVENT = 0x7,
>  };
>  
>  static const struct key_entry acer_wmi_keymap[] __initconst = {
> @@ -128,6 +132,26 @@ static const struct key_entry acer_wmi_keymap[] __initconst = {
>  	{KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
>  	{KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
>  	{KE_KEY, 0x85, {KEY_TOUCHPAD_TOGGLE} },
> +	/* Acer Predator macro keys:
> +	 * 0xdaXY:
> +	 *   da   - magic value (preDAtor)
> +	 *     X  - macro key selector state (0: red, 1: blue, 2: green)
> +	 *      Y - key pressed (0: 1, 1: 2, ...) */
> +	{KE_KEY, 0xda00, {KEY_PROG1} },
> +	{KE_KEY, 0xda01, {KEY_PROG2} },
> +	{KE_KEY, 0xda02, {KEY_PROG3} },
> +	{KE_KEY, 0xda03, {KEY_PROG4} },
> +	{KE_KEY, 0xda04, {KEY_F13} },
> +	{KE_KEY, 0xda10, {KEY_F14} },
> +	{KE_KEY, 0xda11, {KEY_F15} },
> +	{KE_KEY, 0xda12, {KEY_F16} },
> +	{KE_KEY, 0xda13, {KEY_F17} },
> +	{KE_KEY, 0xda14, {KEY_F18} },
> +	{KE_KEY, 0xda20, {KEY_F19} },
> +	{KE_KEY, 0xda21, {KEY_F20} },
> +	{KE_KEY, 0xda22, {KEY_F21} },
> +	{KE_KEY, 0xda23, {KEY_F22} },
> +	{KE_KEY, 0xda24, {KEY_F23} },
>  	{KE_END, 0}
>  };
>  
> @@ -232,6 +256,7 @@ static bool ec_raw_mode;
>  static bool has_type_aa;
>  static u16 commun_func_bitmap;
>  static u8 commun_fn_key_number;
> +static u8 macro_key_state = 0;
>  
>  module_param(mailled, int, 0444);
>  module_param(brightness, int, 0444);
> @@ -1731,6 +1756,25 @@ static void acer_wmi_notify(u32 value, void *context)
>  	case WMID_ACCEL_EVENT:
>  		acer_gsensor_event();
>  		break;
> +	case WMID_MACROKEY_EVENT:
> +		switch(return_value.key_num) {
> +		case 1:
> +			if(return_value.device_state >= 1 && return_value.device_state <= 3)
> +				macro_key_state = return_value.device_state - 1;
> +			else
> +				pr_warn("acer_wmi: macro key state set to %d (only values 1 to 3 are known)", return_value.device_state);
> +			break;
> +		case 2:
> +			if(return_value.device_state >= 1 && return_value.device_state <= 5)
> +				sparse_keymap_report_event(acer_wmi_input_dev, 0xda00 + (macro_key_state<<4) + return_value.device_state-1, 1, true);
> +			else
> +				pr_warn("acer_wmi: macro key %d pressed (only 1 to 5 are known)", return_value.device_state);
> +			break;
> +		default:
> +			pr_warn("Unknown macro key event: %d %d %d", return_value.key_num, return_value.device_state, return_value.reserved);
> +			break;
> +		}
> +		break;
>  	default:
>  		pr_warn("Unknown function number - %d - %d\n",
>  			return_value.function, return_value.key_num);
> -- 
> 2.7.2
> 

      parent reply	other threads:[~2016-03-07  5:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06  6:08 [PATCH] Add support for Acer Predator macro keys Bernhard Rosenkränzer
2016-03-06  6:17 ` Bernhard Rosenkränzer
2016-05-05 22:40   ` Darren Hart
2016-03-07  5:03 ` joeyli [this message]

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=20160307050306.GC6160@linux-rxt1.site \
    --to=jlee@suse.com \
    --cc=bero@lindev.ch \
    --cc=carlos@strangeworlds.co.uk \
    --cc=platform-driver-x86@vger.kernel.org \
    /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