From patchwork Fri Nov 11 23:57:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Diamand X-Patchwork-Id: 9423801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 375FD6047D for ; Fri, 11 Nov 2016 23:58:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16A8329AF2 for ; Fri, 11 Nov 2016 23:58:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A6DA29BCD; Fri, 11 Nov 2016 23:58:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC9EB29AF2 for ; Fri, 11 Nov 2016 23:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964982AbcKKX6N (ORCPT ); Fri, 11 Nov 2016 18:58:13 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36117 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964958AbcKKX6N (ORCPT ); Fri, 11 Nov 2016 18:58:13 -0500 Received: by mail-wm0-f67.google.com with SMTP id m203so655123wma.3 for ; Fri, 11 Nov 2016 15:58:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diamand.org; s=google; h=from:to:cc:subject:date:message-id; bh=kKHG7Ulvyr649ZvHaePcp+YYXoR32MjvYbUR287aI3Q=; b=R4/tg837kctCqoDARrkqn+qrNxLYyh0prFyGDcmfO7myll5W3t+UKl52HsyLq7pyC5 JHrIiXOsMI/71A7x0j4V1riN0bxwDO38N3V8RZ29+dt7Mte5vMRenW99wk1YygtsrIcm YN05Zxl0RDnMufp0ttxW84ad4sSIttMxuZU44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kKHG7Ulvyr649ZvHaePcp+YYXoR32MjvYbUR287aI3Q=; b=AOm5NhspKtouxZVhc1RczVt7d/jinkijwKlln+DR6Qc4o29Jd5zTyKZGTMys4K6DQn TvXlTa1OZpJzYEbSaPf65i6w4gEtfiCicmRGRYj+85i++NS1ujiqLYaQmhqJsWJIQjhX XTPb1TtfwDIMR0dfrMQCWZf1K6zTt2BBlGW4PciFGDX1TU9ESmO0Xzs5sPdKEVtRShOg 9s2Ya4gYPo+DDLuZUeKFckYbR03J4ykNd6C2zQLl07JdDT3bt+/0epmxN3KZqLha0stv fSqGTo0WIZIVzhXyYQ42FZ4s87zVPQvVJAWjJNGqJyiH9DoRKVfvC/TPJ20sG7hgFUcq yMkw== X-Gm-Message-State: ABUngvd2FBjLcwXLKZgVrtIxoc7JUhH7qKOmZI587XKGgsSLpzUe7mJyM85hpsx/lEsr7Q== X-Received: by 10.28.172.3 with SMTP id v3mr454117wme.133.1478908691503; Fri, 11 Nov 2016 15:58:11 -0800 (PST) Received: from lsp.Home ([2a02:c7d:8e68:e300:98:dc27:3b40:2703]) by smtp.gmail.com with ESMTPSA id wh3sm13950154wjb.49.2016.11.11.15.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 15:58:10 -0800 (PST) From: Chris Diamand To: Richard Pospesel , Dmitry Torokhov , linux-input@vger.kernel.org Cc: phonesyfreakies@gmail.com, Michael Shell , Ondrej Zary , Chris Diamand Subject: [PATCH] Input: byd - use DMI detection Date: Fri, 11 Nov 2016 23:57:59 +0000 Message-Id: <20161111235759.11988-1-chris@diamand.org> X-Mailer: git-send-email 2.10.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 +#include #include #include #include @@ -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))