linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ideapad-laptop: add a new WMI string for ESC key
@ 2016-05-09 21:49 Arnd Bergmann
  2016-05-11 20:09 ` Darren Hart
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-05-09 21:49 UTC (permalink / raw)
  To: Ike Panhc, Darren Hart
  Cc: Arnd Bergmann, Denis Gordienko, Hans de Goede, Josh Boyer,
	Philippe Coval, Christian Hesse, Dmitry Tunin, John Dahlstrom,
	platform-driver-x86, linux-kernel

My patch to the ideapad-laptop driver to get the ESC key working on the
Yoga 1170 (Yoga 3) failed to do the same for the following model, the
Lenovo Yoga 700.

Denis Gordienko managed to get it working by adding another GUID for the
new WMI interface. I have adapted his patch to normal coding style
and simplified it a bit for inclusion, but this patch is currently
untested.

Link: https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/YOGA-3-14-How-to-reclaim-my-Esc-key-and-permanently-disable/m-p/3317499
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Denis Gordienko <denis.gordienko.mail@gmail.com>
---
 drivers/platform/x86/ideapad-laptop.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 1d49db124753..531ecca9dbe3 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -48,7 +48,10 @@
 #define CFG_CAMERA_BIT	(19)
 
 #if IS_ENABLED(CONFIG_ACPI_WMI)
-static const char ideapad_wmi_fnesc_event[] = "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6";
+static const char* ideapad_wmi_fnesc_events[] = {
+	"26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6", /* Yoga 3 */
+	"56322276-8493-4CE8-A783-98C991274F5E", /* Yoga 700 */
+};
 #endif
 
 enum {
@@ -93,6 +96,7 @@ struct ideapad_private {
 	struct dentry *debug;
 	unsigned long cfg;
 	bool has_hw_rfkill_switch;
+	const char *fnesc_guid;
 };
 
 static bool no_bt_rfkill;
@@ -990,8 +994,16 @@ static int ideapad_acpi_add(struct platform_device *pdev)
 		ACPI_DEVICE_NOTIFY, ideapad_acpi_notify, priv);
 	if (ret)
 		goto notification_failed;
+
 #if IS_ENABLED(CONFIG_ACPI_WMI)
-	ret = wmi_install_notify_handler(ideapad_wmi_fnesc_event, ideapad_wmi_notify, priv);
+	for (i = 0; i < ARRAY_SIZE(ideapad_wmi_fnesc_events); i++) {
+		ret = wmi_install_notify_handler(ideapad_wmi_fnesc_events[i],
+						 ideapad_wmi_notify, priv);
+		if (ret == AE_OK) {
+			priv->fnesc_guid = ideapad_wmi_fnesc_events[i];
+			break;
+		}
+        }
 	if (ret != AE_OK && ret != AE_NOT_EXIST)
 		goto notification_failed_wmi;
 #endif
@@ -1021,7 +1033,8 @@ static int ideapad_acpi_remove(struct platform_device *pdev)
 	int i;
 
 #if IS_ENABLED(CONFIG_ACPI_WMI)
-	wmi_remove_notify_handler(ideapad_wmi_fnesc_event);
+	if (priv->fnesc_guid)
+		wmi_remove_notify_handler(priv->fnesc_guid);
 #endif
 	acpi_remove_notify_handler(priv->adev->handle,
 		ACPI_DEVICE_NOTIFY, ideapad_acpi_notify);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ideapad-laptop: add a new WMI string for ESC key
  2016-05-09 21:49 [PATCH] ideapad-laptop: add a new WMI string for ESC key Arnd Bergmann
@ 2016-05-11 20:09 ` Darren Hart
       [not found]   ` <CAOxJCxfxmTyZhsAwp9oDkAEVd9iPPygKJcZvBkqQ=VrU_Vrzog@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Darren Hart @ 2016-05-11 20:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ike Panhc, Denis Gordienko, Hans de Goede, Josh Boyer,
	Philippe Coval, Christian Hesse, Dmitry Tunin, John Dahlstrom,
	platform-driver-x86, linux-kernel

On Mon, May 09, 2016 at 11:49:21PM +0200, Arnd Bergmann wrote:
> My patch to the ideapad-laptop driver to get the ESC key working on the
> Yoga 1170 (Yoga 3) failed to do the same for the following model, the
> Lenovo Yoga 700.
> 
> Denis Gordienko managed to get it working by adding another GUID for the
> new WMI interface. I have adapted his patch to normal coding style
> and simplified it a bit for inclusion, but this patch is currently
> untested.
> 
> Link: https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/YOGA-3-14-How-to-reclaim-my-Esc-key-and-permanently-disable/m-p/3317499
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Denis Gordienko <denis.gordienko.mail@gmail.com>

Looks good to me, but of course I would like to see some testing. Denis, I
presume you have a Yoga 700 you could verify this version of your patch on?
Would you be willing to do so?


> ---
>  drivers/platform/x86/ideapad-laptop.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 1d49db124753..531ecca9dbe3 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -48,7 +48,10 @@
>  #define CFG_CAMERA_BIT	(19)
>  
>  #if IS_ENABLED(CONFIG_ACPI_WMI)
> -static const char ideapad_wmi_fnesc_event[] = "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6";
> +static const char* ideapad_wmi_fnesc_events[] = {
> +	"26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6", /* Yoga 3 */
> +	"56322276-8493-4CE8-A783-98C991274F5E", /* Yoga 700 */
> +};
>  #endif
>  
>  enum {
> @@ -93,6 +96,7 @@ struct ideapad_private {
>  	struct dentry *debug;
>  	unsigned long cfg;
>  	bool has_hw_rfkill_switch;
> +	const char *fnesc_guid;
>  };
>  
>  static bool no_bt_rfkill;
> @@ -990,8 +994,16 @@ static int ideapad_acpi_add(struct platform_device *pdev)
>  		ACPI_DEVICE_NOTIFY, ideapad_acpi_notify, priv);
>  	if (ret)
>  		goto notification_failed;
> +
>  #if IS_ENABLED(CONFIG_ACPI_WMI)
> -	ret = wmi_install_notify_handler(ideapad_wmi_fnesc_event, ideapad_wmi_notify, priv);
> +	for (i = 0; i < ARRAY_SIZE(ideapad_wmi_fnesc_events); i++) {
> +		ret = wmi_install_notify_handler(ideapad_wmi_fnesc_events[i],
> +						 ideapad_wmi_notify, priv);
> +		if (ret == AE_OK) {
> +			priv->fnesc_guid = ideapad_wmi_fnesc_events[i];
> +			break;
> +		}
> +        }
>  	if (ret != AE_OK && ret != AE_NOT_EXIST)
>  		goto notification_failed_wmi;
>  #endif
> @@ -1021,7 +1033,8 @@ static int ideapad_acpi_remove(struct platform_device *pdev)
>  	int i;
>  
>  #if IS_ENABLED(CONFIG_ACPI_WMI)
> -	wmi_remove_notify_handler(ideapad_wmi_fnesc_event);
> +	if (priv->fnesc_guid)
> +		wmi_remove_notify_handler(priv->fnesc_guid);
>  #endif
>  	acpi_remove_notify_handler(priv->adev->handle,
>  		ACPI_DEVICE_NOTIFY, ideapad_acpi_notify);
> -- 
> 2.7.0
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ideapad-laptop: add a new WMI string for ESC key
       [not found]     ` <CAOxJCxdsMDCY33JHr+JrQtEwQ4Jh7UyvUFS4SNeoA71ojDxYpg@mail.gmail.com>
@ 2016-05-16 23:38       ` Darren Hart
  0 siblings, 0 replies; 3+ messages in thread
From: Darren Hart @ 2016-05-16 23:38 UTC (permalink / raw)
  To: Denis Gordienko
  Cc: Christian Hesse, Philippe Coval, Ike Panhc, linux-kernel,
	Dmitry Tunin, platform-driver-x86, John Dahlstrom, Hans de Goede,
	Arnd Bergmann, Josh Boyer

On Thu, May 12, 2016 at 12:34:05AM +0300, Denis Gordienko wrote:
> Hi, Darren. This patch already tested on my laptop and I can confirm - it's
> work fine.

Awesome, thanks! Added your tested-by.

> Denis
> 11 Май 2016 г. 23:09 пользователь "Darren Hart" <dvhart@infradead.org>
> написал:
> 
> On Mon, May 09, 2016 at 11:49:21PM +0200, Arnd Bergmann wrote:
> > My patch to the ideapad-laptop driver to get the ESC key working on the
> > Yoga 1170 (Yoga 3) failed to do the same for the following model, the
> > Lenovo Yoga 700.
> >
> > Denis Gordienko managed to get it working by adding another GUID for the
> > new WMI interface. I have adapted his patch to normal coding style
> > and simplified it a bit for inclusion, but this patch is currently
> > untested.
> >
> > Link:
> https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/YOGA-3-14-How-to-reclaim-my-Esc-key-and-permanently-disable/m-p/3317499
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Cc: Denis Gordienko <denis.gordienko.mail@gmail.com>
> 
> Looks good to me, but of course I would like to see some testing. Denis, I
> presume you have a Yoga 700 you could verify this version of your patch on?
> Would you be willing to do so?
> 
> 
> > ---
> >  drivers/platform/x86/ideapad-laptop.c | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/platform/x86/ideapad-laptop.c
> b/drivers/platform/x86/ideapad-laptop.c
> > index 1d49db124753..531ecca9dbe3 100644
> > --- a/drivers/platform/x86/ideapad-laptop.c
> > +++ b/drivers/platform/x86/ideapad-laptop.c
> > @@ -48,7 +48,10 @@
> >  #define CFG_CAMERA_BIT       (19)
> >
> >  #if IS_ENABLED(CONFIG_ACPI_WMI)
> > -static const char ideapad_wmi_fnesc_event[] =
> "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6";
> > +static const char* ideapad_wmi_fnesc_events[] = {

Arnd, should this be:

static const char *const ideapad_wmi_fnesc_events[] = {

?

Checkpatch complains, I see both usages throughout the kernel. I believe we do
want a const array of const char arrays, so I think this is a better
declaration.

Any objection to this change?

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-16 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 21:49 [PATCH] ideapad-laptop: add a new WMI string for ESC key Arnd Bergmann
2016-05-11 20:09 ` Darren Hart
     [not found]   ` <CAOxJCxfxmTyZhsAwp9oDkAEVd9iPPygKJcZvBkqQ=VrU_Vrzog@mail.gmail.com>
     [not found]     ` <CAOxJCxdsMDCY33JHr+JrQtEwQ4Jh7UyvUFS4SNeoA71ojDxYpg@mail.gmail.com>
2016-05-16 23:38       ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).