[PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys

Gašper Nemgar posted 1 patch 9 months, 1 week ago
[PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys
Posted by Gašper Nemgar 9 months, 1 week ago
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 30bd366d7..af124aafe 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -1308,6 +1308,14 @@ static const struct key_entry ideapad_keymap[] = {
 	/* Specific to some newer models */
 	{ KE_KEY,	0x3e | IDEAPAD_WMI_KEY, { KEY_MICMUTE } },
 	{ KE_KEY,	0x3f | IDEAPAD_WMI_KEY, { KEY_RFKILL } },
+	/*Star- (User Asignable Key)*/
+	{ KE_KEY,	0x44 | IDEAPAD_WMI_KEY, { KEY_PROG1 } },
+	/*Eye*/
+	{ KE_KEY,	0x45 | IDEAPAD_WMI_KEY, { KEY_DISPLAYTOGGLE } },
+	/*Performance*/
+	{ KE_KEY,	0x3d | IDEAPAD_WMI_KEY, { KEY_SPORT } },
+	/*shift + prtsc*/
+	{ KE_KEY,	0x2d | IDEAPAD_WMI_KEY, { KEY_PROG3 } },
 
 	{ KE_END },
 };
Re: [PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys
Posted by Hans de Goede 9 months, 1 week ago
Hi Gašper,

Thank you for your patch. 

First if all a few generic notes:

1. When sending out v2 of the patch please add
   platform-driver-x86@vger.kernel.org to the Cc

2. The patch subject (first line of commit message) should have
   a prefix describing the subsystem + driver, e.g. use:
   "platform/x86: ideapad-laptop: Add a few new keymap entries"

3. Your patch is missing a signed-off-by, see:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

4. Your commit message / patch should also have a body, e.g.
   the entirety of the commit message could look something like this:

-- begin --
platform/x86: ideapad-laptop: Add a few new keymap entries

The Yoga 9 2 in 1 14imh9 introduces 4 new hotkeys which are not
yet in ideapad_keymap[], add entries to map these keys.

Signed-off-by: Gašper Nemgar <your-email-here>
-- end --

A few more specific remarks below based on looking at
this picture of the keyboard:

https://ardes.bg/uploads/original/lenovo-yoga-9-2-in-1-14-g9-550178.jpg

On 13-Mar-25 4:17 PM, Gašper Nemgar wrote:
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 30bd366d7..af124aafe 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -1308,6 +1308,14 @@ static const struct key_entry ideapad_keymap[] = {
>  	/* Specific to some newer models */
>  	{ KE_KEY,	0x3e | IDEAPAD_WMI_KEY, { KEY_MICMUTE } },
>  	{ KE_KEY,	0x3f | IDEAPAD_WMI_KEY, { KEY_RFKILL } },
> +	/*Star- (User Asignable Key)*/
> +	{ KE_KEY,	0x44 | IDEAPAD_WMI_KEY, { KEY_PROG1 } },

Ack.

> +	/*Eye*/
> +	{ KE_KEY,	0x45 | IDEAPAD_WMI_KEY, { KEY_DISPLAYTOGGLE } },

It looks like the laptop already does display-toggle as Fn-F7 although
it like sends super + P for this (AKA meta + P).

So mapping this to KEY_DISPLAYTOGGLE seems wrong, what does this
do under Windows?

Maybe KEY_ZOOM ?

> +	/*Performance*/
> +	{ KE_KEY,	0x3d | IDEAPAD_WMI_KEY, { KEY_SPORT } },

I think that instead of mapping this it should be handled specially
and call platform_profile_cycle() instead of sending a key-press
to userspace

> +	/*shift + prtsc*/
> +	{ KE_KEY,	0x2d | IDEAPAD_WMI_KEY, { KEY_PROG3 } },

Looking a the symbol on the keyboard this should send
KEY_SELECTIVE_SCREENSHOT

>  
>  	{ KE_END },
>  };
> 

Regards,

Hans


Re: [PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys
Posted by Ike Panhc 9 months, 1 week ago
On 3/13/25 23:17, Gašper Nemgar wrote:
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 30bd366d7..af124aafe 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -1308,6 +1308,14 @@ static const struct key_entry ideapad_keymap[] = {
>  	/* Specific to some newer models */
>  	{ KE_KEY,	0x3e | IDEAPAD_WMI_KEY, { KEY_MICMUTE } },
>  	{ KE_KEY,	0x3f | IDEAPAD_WMI_KEY, { KEY_RFKILL } },
> +	/*Star- (User Asignable Key)*/
> +	{ KE_KEY,	0x44 | IDEAPAD_WMI_KEY, { KEY_PROG1 } },
> +	/*Eye*/
> +	{ KE_KEY,	0x45 | IDEAPAD_WMI_KEY, { KEY_DISPLAYTOGGLE } },
> +	/*Performance*/
> +	{ KE_KEY,	0x3d | IDEAPAD_WMI_KEY, { KEY_SPORT } },
> +	/*shift + prtsc*/
> +	{ KE_KEY,	0x2d | IDEAPAD_WMI_KEY, { KEY_PROG3 } },
>  
>  	{ KE_END },
>  };
> 

Acked-by: Ike Panhc <ike.pan@canonical.com>


Re: [PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys
Posted by Gergo Koteles 9 months, 1 week ago
Hi Gašper,

On 3/13/25 23:17, Gašper Nemgar wrote:
>  	/* Specific to some newer models */
>  	{ KE_KEY,	0x3e | IDEAPAD_WMI_KEY, { KEY_MICMUTE } },
>  	{ KE_KEY,	0x3f | IDEAPAD_WMI_KEY, { KEY_RFKILL } },
> +	/*Star- (User Asignable Key)*/

Asignable -> Assignable?
Could you please add a space before/after the body of the comment?

> +	{ KE_KEY,	0x44 | IDEAPAD_WMI_KEY, { KEY_PROG1 } },

Other Ideapads map this star key to KEY_FAVORITES, for consistency I
think it would be better if this one mapped there too.

Thanks,
Gergo
Re: [PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys
Posted by Gašper Nemgar 9 months, 1 week ago
Hello,
This specific laptop has one star with s in the middle which is
already handled by the driver and is assigned to key favourites.
There is another button with only a star, I think it is ok to assign
it to KEY_PROG1.

Thanks, Gašper


On Fri, 14 Mar 2025 at 12:52, Gergo Koteles <soyer@irl.hu> wrote:
>
> Hi Gašper,
>
> On 3/13/25 23:17, Gašper Nemgar wrote:
> >       /* Specific to some newer models */
> >       { KE_KEY,       0x3e | IDEAPAD_WMI_KEY, { KEY_MICMUTE } },
> >       { KE_KEY,       0x3f | IDEAPAD_WMI_KEY, { KEY_RFKILL } },
> > +     /*Star- (User Asignable Key)*/
>
> Asignable -> Assignable?
> Could you please add a space before/after the body of the comment?
>
> > +     { KE_KEY,       0x44 | IDEAPAD_WMI_KEY, { KEY_PROG1 } },
>
> Other Ideapads map this star key to KEY_FAVORITES, for consistency I
> think it would be better if this one mapped there too.
>
> Thanks,
> Gergo
>
>
Re: [PATCH] Fixed ideapad-laptop driver to support Yoga 9 2 in 1 14imh9 unknown keys
Posted by Gergo Koteles 9 months, 1 week ago
Hi Gašper,

On Fri, 2025-03-14 at 13:28 +0100, Gašper Nemgar wrote:
> Hello,
> This specific laptop has one star with s in the middle which is
> already handled by the driver and is assigned to key favourites.
> There is another button with only a star, I think it is ok to assign
> it to KEY_PROG1.
> 

Ah, I see, this laptop, like a good movie, has multiple stars ;)

I think KEY_PROG1 is ok.

Thanks,
Gergo