lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1425316291.516850.234429205.7068CEE9@webmail.messagingengine.com>
Date:	Mon, 02 Mar 2015 14:11:31 -0300
From:	Henrique de Moraes Holschuh <hmh@....eng.br>
To:	Bastien Nocera <hadess@...ess.net>,
	Darren Hart <dvhart@...radead.org>,
	ibm-acpi-devel@...ts.sourceforge.net,
	platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
	"linux-input" <linux-input@...r.kernel.org>,
	Jiri Kosina <jkosina@...e.cz>
Subject: Re: [PATCH 1/4] thinkpad_acpi: Remember adaptive kbd presence

On Mon, Mar 2, 2015, at 10:45, Bastien Nocera wrote:
> Rather than checking on each suspend and resume whether the laptop
> has an adaptive keyboard, check when the driver is initialised.
> 
> Signed-off-by: Bastien Nocera <hadess@...ess.net>

Acked-by: Henrique de Moraes Holschuh <hmh@....eng.br>

> ---
>  drivers/platform/x86/thinkpad_acpi.c | 37
>  ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c
> b/drivers/platform/x86/thinkpad_acpi.c
> index 3b8ceee..763aef0 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -319,6 +319,7 @@ static struct {
>  	u32 sensors_pdrv_attrs_registered:1;
>  	u32 sensors_pdev_attrs_registered:1;
>  	u32 hotkey_poll_active:1;
> +       u32 has_adaptive_kbd:1;
>  } tp_features;
>  
>  static struct {
> @@ -3227,6 +3228,15 @@ static int __init hotkey_init(struct
> ibm_init_struct *iibm)
>  	if (!tp_features.hotkey)
>  		return 1;
>  
> +       /*
> +        * Check if we have an adaptive keyboard, like on the
> +        * Lenovo Carbon X1 2014 (2nd Gen).
> +        */
> +       if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
> +               if ((hkeyv >> 8) == 2)
> +                       tp_features.has_adaptive_kbd = true;
> +       }
> +
>  	quirks = tpacpi_check_quirks(tpacpi_hotkey_qtable,
>  				     ARRAY_SIZE(tpacpi_hotkey_qtable));
>  
> @@ -3836,28 +3846,21 @@ static void hotkey_notify(struct ibm_struct *ibm,
> u32 event)
>  
>  static void hotkey_suspend(void)
>  {
> -       int hkeyv;
> -
>  	/* Do these on suspend, we get the events on early resume! */
>  	hotkey_wakeup_reason = TP_ACPI_WAKEUP_NONE;
>  	hotkey_autosleep_ack = 0;
>  
>  	/* save previous mode of adaptive keyboard of X1 Carbon */
> -       if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
> -               if ((hkeyv >> 8) == 2) {
> -                       if (!acpi_evalf(hkey_handle,
> -                                              
> &adaptive_keyboard_prev_mode,
> -                                               "GTRW", "dd", 0)) {
> -                               pr_err("Cannot read adaptive keyboard
> mode.\n");
> -                       }
> +       if (tp_features.has_adaptive_kbd) {
> +               if (!acpi_evalf(hkey_handle,
> &adaptive_keyboard_prev_mode,
> +                                       "GTRW", "dd", 0)) {
> +                       pr_err("Cannot read adaptive keyboard mode.\n");
>  		}
>  	}
>  }
>  
>  static void hotkey_resume(void)
>  {
> -       int hkeyv;
> -
>  	tpacpi_disable_brightness_delay();
>  
>  	if (hotkey_status_set(true) < 0 ||
> @@ -3872,14 +3875,10 @@ static void hotkey_resume(void)
>  	hotkey_poll_setup_safe(false);
>  
>  	/* restore previous mode of adapive keyboard of X1 Carbon */
> -       if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
> -               if ((hkeyv >> 8) == 2) {
> -                       if (!acpi_evalf(hkey_handle,
> -                                               NULL,
> -                                               "STRW", "vd",
> -                                              
> adaptive_keyboard_prev_mode)) {
> -                               pr_err("Cannot set adaptive keyboard
> mode.\n");
> -                       }
> +       if (tp_features.has_adaptive_kbd) {
> +               if (!acpi_evalf(hkey_handle, NULL, "STRW", "vd",
> +                                       adaptive_keyboard_prev_mode)) {
> +                       pr_err("Cannot set adaptive keyboard mode.\n");
>  		}
>  	}
>  }
> -- 
> 2.1.0
> 
> 


-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ