From: "José Expósito" <jose.exposito89@gmail.com>
To: hdegoede@redhat.com
Cc: alex.hung@canonical.com, mgross@linux.intel.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org,
"José Expósito" <jose.exposito89@gmail.com>,
"Tobias Gurtzick" <magic@wizardtales.com>
Subject: [PATCH] platform/x86/intel: hid: Add DMI switches allow list
Date: Mon, 20 Sep 2021 18:03:12 +0200 [thread overview]
Message-ID: <20210920160312.9787-1-jose.exposito89@gmail.com> (raw)
Some devices, even non convertible ones, can send incorrect
SW_TABLET_MODE reports.
Add an allow list and accept such reports only from devices in it.
Bug reported for Dell XPS 17 9710 on:
https://gitlab.freedesktop.org/libinput/libinput/-/issues/662
Reported-by: Tobias Gurtzick <magic@wizardtales.com>
Suggested-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Tobias Gurtzick <magic@wizardtales.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/platform/x86/intel/hid.c | 33 +++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/intel/hid.c b/drivers/platform/x86/intel/hid.c
index a33a5826e81a..24d26336e39a 100644
--- a/drivers/platform/x86/intel/hid.c
+++ b/drivers/platform/x86/intel/hid.c
@@ -118,6 +118,24 @@ static const struct dmi_system_id dmi_vgbs_allow_list[] = {
{ }
};
+/*
+ * Some devices, even non convertible ones, can send incorrect SW_TABLET_MODE
+ * reports. Accept such reports only from devices in this list.
+ */
+static const struct dmi_system_id dmi_switches_auto_add_allow_list[] = {
+ {
+ .matches = {
+ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */),
+ },
+ },
+ {
+ .matches = {
+ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */),
+ },
+ },
+ {} /* Array terminator */
+};
+
struct intel_hid_priv {
struct input_dev *input_dev;
struct input_dev *array;
@@ -455,11 +473,16 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
*
* See dual_accel_detect.h for more info on the dual_accel check.
*/
- if (!priv->switches && !priv->dual_accel && (event == 0xcc || event == 0xcd)) {
- dev_info(&device->dev, "switch event received, enable switches supports\n");
- err = intel_hid_switches_setup(device);
- if (err)
- pr_err("Failed to setup Intel HID switches\n");
+ if (event == 0xcc || event == 0xcd) {
+ if (!dmi_check_system(dmi_switches_auto_add_allow_list))
+ return;
+
+ if (!priv->switches && !priv->dual_accel) {
+ dev_info(&device->dev, "switch event received, enable switches supports\n");
+ err = intel_hid_switches_setup(device);
+ if (err)
+ pr_err("Failed to setup Intel HID switches\n");
+ }
}
if (priv->wakeup_mode) {
--
2.25.1
next reply other threads:[~2021-09-20 16:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 16:03 José Expósito [this message]
2021-09-20 18:43 ` [PATCH] platform/x86/intel: hid: Add DMI switches allow list Barnabás Pőcze
2021-09-21 13:13 ` Hans de Goede
2021-09-21 16:28 ` José Expósito
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=20210920160312.9787-1-jose.exposito89@gmail.com \
--to=jose.exposito89@gmail.com \
--cc=alex.hung@canonical.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=magic@wizardtales.com \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@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