All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Diamand <chris@diamand.org>
To: Richard Pospesel <pospeselr@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org
Cc: phonesyfreakies@gmail.com, Michael Shell <list1@michaelshell.org>,
	Ondrej Zary <linux@rainbow-software.org>,
	Chris Diamand <chris@diamand.org>
Subject: [PATCH] Input: byd - use DMI detection
Date: Fri, 11 Nov 2016 23:57:59 +0000	[thread overview]
Message-ID: <20161111235759.11988-1-chris@diamand.org> (raw)

Because the BYD touchpad uses standard PS/2 commands for its
detection sequence, some other models are incorrectly detected as BYD
touchpads. This causes chaos when byd_init() later fails.

To fix this, init() and detect() should be merged. However, this
would slow down detection for other mouse models. Instead, add a DMI
check before attempting touchpad detection.

Signed-off-by: Chris Diamand <chris@diamand.org>
---
Hi all,

This patch should fix the mis-detection of some mouse models as BYD touchpads,
as mentioned in a few bug reports and other threads.

However, I no longer have a machine with a BYD touchpad (although I did record
its DMI data), so this is mostly untested - could anyone *with* a BYD touchpad
please try this patch to check their touchpad still works, and could anyone
with a misdetected non-BYD touchpad please check that this fixes the
misdetection?

Also, the DMI fields really are pretty much all like that ("To Be Filled By
O.E.M.", etc). I've tried to choose the most specific ones, but it's still
fairly arbitrary...

Cheers!
Chris

 drivers/input/mouse/byd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
index b27aa63..b4c5fd0 100644
--- a/drivers/input/mouse/byd.c
+++ b/drivers/input/mouse/byd.c
@@ -13,6 +13,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/dmi.h>
 #include <linux/input.h>
 #include <linux/libps2.h>
 #include <linux/serio.h>
@@ -235,6 +236,17 @@ struct byd_data {
 	bool touch;
 };
 
+static const struct dmi_system_id byd_dmi_table[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "SharkBay Platform"),
+			DMI_MATCH(DMI_PRODUCT_SERIAL, "System Serial Number"),
+			DMI_MATCH(DMI_BOARD_NAME, "WhiteTip Mountain1 Fab2"),
+			DMI_MATCH(DMI_CHASSIS_VENDOR, "To Be Filled By O.E.M."),
+		},
+	},
+};
+
 static void byd_report_input(struct psmouse *psmouse)
 {
 	struct byd_data *priv = psmouse->private;
@@ -439,6 +451,9 @@ int byd_detect(struct psmouse *psmouse, bool set_properties)
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
 	u8 param[4] = {0x03, 0x00, 0x00, 0x00};
 
+	if (!dmi_check_system(byd_dmi_table))
+		return -1;
+
 	if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
 		return -1;
 	if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES))
-- 
2.10.1


             reply	other threads:[~2016-11-11 23:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 23:57 Chris Diamand [this message]
2016-11-12 12:12 ` [PATCH] Input: byd - use DMI detection Pali Rohár
2016-11-12 14:48   ` Chris Diamand
2016-11-12 15:04     ` Pali Rohár
2016-11-12 17:33       ` Richard Pospesel
2016-11-12 17:48         ` Pali Rohár
2016-11-12 18:01           ` Richard Pospesel
2016-11-12 19:13 ` Dmitry Torokhov

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=20161111235759.11988-1-chris@diamand.org \
    --to=chris@diamand.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux@rainbow-software.org \
    --cc=list1@michaelshell.org \
    --cc=phonesyfreakies@gmail.com \
    --cc=pospeselr@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.