From: Mario Limonciello <mario.limonciello@amd.com>
To: Jonathan Singer <jes965@nyu.edu>,
Hans de Goede <hdegoede@redhat.com>,
Mark Gross <markgross@kernel.org>
Cc: Jorge Lopez <jorge.lopez2@hp.com>,
Rishit Bansal <rishitbansal0@gmail.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org,
Kai-Heng Feng <kai.heng.feng@canonical.com>
Subject: Re: [PATCH v2 2/2] platform/x86: hp-wmi: Add HP Envy special key support
Date: Wed, 26 Apr 2023 10:40:21 -0500 [thread overview]
Message-ID: <ae3a6a20-c7e7-563f-baf4-2e744fbc5798@amd.com> (raw)
In-Reply-To: <20230426152139.1692-2-jes965@nyu.edu>
On 4/26/23 10:21, Jonathan Singer wrote:
> Previously, some support for certain keys on the HP keyboard has been
> added already in commit 3ee5447b2048 ("platform/x86: hp-wmi: Handle Omen
> Key event"), however this as tested did not allow even the fn+esc key on
> my HP Envy which uses the same keycode on my HP Envy x360 laptop to work
> --the keycode rather than being passed in as a separate int from WMI, was
> being passed in as the event_data for the HPWMI_OMEN_KEY event.
>
> This patch, as tested was able to properly get the keycode for fn+esc,
> and for fn+f12 which is supposed to be a programmable key according to
> HP's keyboard diagram and is thus mapped to KEY_PROG2. The fn+f8 key
> combination (mute microphone) was a standard HPWMI_BEZEL_BUTTON key,
> however it did not previously have an entry in the sparse keymap. This
> patch preserves the original HPWMI_OMEN_KEY behavior for laptops that
> use it by only taking the keycode from the event_data only when the
> event_data is nonzero.
>
> Signed-off-by: Jonathan Singer <jes965@nyu.edu>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/platform/x86/hp/hp-wmi.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
> index a7fb33ac49b8..399163b4aca0 100644
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -212,6 +212,7 @@ struct bios_rfkill2_state {
> static const struct key_entry hp_wmi_keymap[] = {
> { KE_KEY, 0x02, { KEY_BRIGHTNESSUP } },
> { KE_KEY, 0x03, { KEY_BRIGHTNESSDOWN } },
> + { KE_KEY, 0x270, { KEY_MICMUTE } },
> { KE_KEY, 0x20e6, { KEY_PROG1 } },
> { KE_KEY, 0x20e8, { KEY_MEDIA } },
> { KE_KEY, 0x2142, { KEY_MEDIA } },
> @@ -222,6 +223,7 @@ static const struct key_entry hp_wmi_keymap[] = {
> { KE_IGNORE, 0x121a4, }, /* Win Lock Off */
> { KE_KEY, 0x21a5, { KEY_PROG2 } }, /* HP Omen Key */
> { KE_KEY, 0x21a7, { KEY_FN_ESC } },
> + { KE_KEY, 0x21a8, { KEY_PROG2 } }, /* HP Envy x360 programmable key */
> { KE_KEY, 0x21a9, { KEY_TOUCHPAD_OFF } },
> { KE_KEY, 0x121a9, { KEY_TOUCHPAD_ON } },
> { KE_KEY, 0x231b, { KEY_HELP } },
> @@ -847,11 +849,20 @@ static void hp_wmi_notify(u32 value, void *context)
> case HPWMI_SMART_ADAPTER:
> break;
> case HPWMI_BEZEL_BUTTON:
> - case HPWMI_OMEN_KEY:
> key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
> if (key_code < 0)
> break;
>
> + if (!sparse_keymap_report_event(hp_wmi_input_dev,
> + key_code, 1, true))
> + pr_info("Unknown key code - 0x%x\n", key_code);
> + break;
> + case HPWMI_OMEN_KEY:
> + if (event_data) /* Only should be true for HP Omen */
> + key_code = event_data;
> + else
> + key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
> +
> if (!sparse_keymap_report_event(hp_wmi_input_dev,
> key_code, 1, true))
> pr_info("Unknown key code - 0x%x\n", key_code);
next prev parent reply other threads:[~2023-04-26 15:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 15:21 [PATCH v2 1/2] platform/x86: hp-wmi: Add HP WMI camera switch Jonathan Singer
2023-04-26 15:21 ` [PATCH v2 2/2] platform/x86: hp-wmi: Add HP Envy special key support Jonathan Singer
2023-04-26 15:40 ` Mario Limonciello [this message]
2023-04-26 15:39 ` [PATCH v2 1/2] platform/x86: hp-wmi: Add HP WMI camera switch Mario Limonciello
2023-04-26 16:06 ` Hans de Goede
2023-04-26 16:09 ` Hans de Goede
2023-04-26 16:49 ` Jonathan Singer
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=ae3a6a20-c7e7-563f-baf4-2e744fbc5798@amd.com \
--to=mario.limonciello@amd.com \
--cc=hdegoede@redhat.com \
--cc=jes965@nyu.edu \
--cc=jorge.lopez2@hp.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rishitbansal0@gmail.com \
/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
all inboxes | Powered by JetHome®