linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Luke D Jones <luke@ljones.dev>, Jiri Kosina <jkosina@suse.cz>,
	Sasha Levin <sashal@kernel.org>,
	linux-input@vger.kernel.org
Subject: [PATCH AUTOSEL 5.12 08/49] HID: asus: filter G713/G733 key event to prevent shutdown
Date: Mon,  7 Jun 2021 12:11:34 -0400	[thread overview]
Message-ID: <20210607161215.3583176-8-sashal@kernel.org> (raw)
In-Reply-To: <20210607161215.3583176-1-sashal@kernel.org>

From: Luke D Jones <luke@ljones.dev>

[ Upstream commit c980512b4512adf2c6f9edb948ce19423b23124d ]

The G713 and G733 both emit an unexpected keycode on some key
presses such as Fn+Pause. The device in this case is emitting
two events on key down, and 3 on key up, the third key up event
is report ID 0x02 and is unfiltered, causing incorrect event.

This patch filters out the single problematic event.

Signed-off-by: Luke D Jones <luke@ljones.dev>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-asus.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 1ed1c05c3d54..60606c11bdaf 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -355,6 +355,16 @@ static int asus_raw_event(struct hid_device *hdev,
 				return -1;
 			}
 		}
+		if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+			/*
+			 * G713 and G733 send these codes on some keypresses, depending on
+			 * the key pressed it can trigger a shutdown event if not caught.
+			*/
+			if(data[0] == 0x02 && data[1] == 0x30) {
+				return -1;
+			}
+		}
+
 	}
 
 	return 0;
-- 
2.30.2


  parent reply	other threads:[~2021-06-07 16:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210607161215.3583176-1-sashal@kernel.org>
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 02/49] HID: asus: Filter keyboard EC for old ROG keyboard Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 03/49] HID: quirks: Set INCREMENT_USAGE_ON_DUPLICATE for Saitek X65 Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 04/49] HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K15A keyboard-dock Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 05/49] HID: a4tech: use A4_2WHEEL_MOUSE_HACK_B8 for A4TECH NB-95 Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 06/49] HID: hid-input: add mapping for emoji picker key Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 07/49] HID: hid-sensor-hub: Return error for hid_set_field() failure Sasha Levin
2021-06-07 16:11 ` Sasha Levin [this message]
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 09/49] HID: quirks: Add quirk for Lenovo optical mouse Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 10/49] HID: multitouch: set Stylus suffix for Stylus-application devices, too Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 11/49] HID: Add BUS_VIRTUAL to hid_connect logging Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 12/49] HID: usbhid: fix info leak in hid_submit_ctrl Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 23/49] HID: multitouch: Disable event reporting on suspend on the Asus T101HA touchpad Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 24/49] HID: gt683r: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-06-07 16:11 ` [PATCH AUTOSEL 5.12 25/49] HID: intel-ish-hid: ipc: Add Alder Lake device IDs Sasha Levin

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=20210607161215.3583176-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).