Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10424225ybi; Wed, 24 Jul 2019 22:59:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBrUOczCOlGllnE75FLGayUSad7pNd+2gFhkVQ4dKbouHQvgLzDG2RcJf1d0leXYPkpQp4 X-Received: by 2002:a63:d84e:: with SMTP id k14mr85016960pgj.234.1564034362184; Wed, 24 Jul 2019 22:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034362; cv=none; d=google.com; s=arc-20160816; b=qyn+e6iwpcL5G26W0aVUr1kL7inTQZPvi9NcADrBjsTDuN84oA4o/9qCFKMQ/eQ9Ek sURk+Ix+OMzBXbNxL0XXYwzw0PM54F9FaSSjaRx2X93M7R+si8L3qewolSsGQ4bgrQr1 k97+wSyrcq8lI0Jc9OT19lF63TPP8JyQ+G7TtlMrjIHPQIl2FBGEZ7GB7BlTs9c7krZ/ ANYt2suOcQBJh/Dv7Ep37C4cmZoQCrhtldTD/eUsJyrf/oE0b4IyhSH7y9Vkq3Re5lOb rVYoA2OWpI9tU+Z1c5Py/xk+vaRzX4jMgo8ZLI+o0zBfXjE9NOMaZ244+VlzvF/dUels J/kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W+s8/+UYcex6qSZt+yh70+35tCIySdX5zEkLCPxlFHw=; b=pQVicxFnFsEPbInmFrisbwqo2lk5uVKZlUoXL6dDXb46ng8ZamG0xDYvmQRud+6y3p lW9BeyK0jlN/EpxIjEKYzaFoLmPT2jxUMb/M89f2dRA1NDXPuNYSscsSyuVxJPxYX2n+ eUIBGTL2PtnS5gQMGaAlOf2BpcOoHbkF053+lyK93ZAU9zxFNI3kRjpusiSY0tjpBqbm B9svsQAQv2Z2cQvU98q1Y9InC2lo//jZMqZCGJv1ng0AEps0qW5Y6a+UKtV60QkLgVdo +Fn0fpCjUi6C1k1gj6KmRdgpT0kaGhCx7L+O0ZDqWP/rd3bQ3SIvWWsh07dDi99gF5Qe ZGKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FfHrpTNj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si18134419pfq.115.2019.07.24.22.59.07; Wed, 24 Jul 2019 22:59:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FfHrpTNj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404892AbfGYFnK (ORCPT + 99 others); Thu, 25 Jul 2019 01:43:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:58084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390992AbfGYFnH (ORCPT ); Thu, 25 Jul 2019 01:43:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E46322CD1; Thu, 25 Jul 2019 05:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033386; bh=vlTIogb9tzHAuBPAyMF4RNDmYm61QUR+7qMqccJAo1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FfHrpTNjEBP/auz1S6VSMYnovzB7y6l9eYgJQoh+N4qMWMQqowTPsd9vmDsyMHOvy jsAvYfpgFSp+GzXcteBo6Wu0f0l2bxKTMRmhL4l7LN20ODJuRUWBIC+RWyHTqROtpE WKwAWcaE/YKYtvjm+BkT/ALTwbVn9fmXkiF8nE80= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, XiaoXiao Liu , Hui Wang , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Dmitry Torokhov Subject: [PATCH 4.19 190/271] Input: alps - dont handle ALPS cs19 trackpoint-only device Date: Wed, 24 Jul 2019 21:20:59 +0200 Message-Id: <20190724191711.395880096@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hui Wang commit 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 upstream. On a latest Lenovo laptop, the trackpoint and 3 buttons below it don't work at all, when we move the trackpoint or press those 3 buttons, the kernel will print out: "Rejected trackstick packet from non DualPoint device" This device is identified as an alps touchpad but the packet has trackpoint format, so the alps.c drops the packet and prints out the message above. According to XiaoXiao's explanation, this device is named cs19 and is trackpoint-only device, its firmware is only for trackpoint, it is independent of touchpad and is a device completely different from DualPoint ones. To drive this device with mininal changes to the existing driver, we just let the alps driver not handle this device, then the trackpoint.c will be the driver of this device if the trackpoint driver is enabled. (if not, this device will fallback to a bare PS/2 device) With the trackpoint.c, this trackpoint and 3 buttons all work well, they have all features that the trackpoint should have, like scrolling-screen, drag-and-drop and frame-selection. Signed-off-by: XiaoXiao Liu Signed-off-by: Hui Wang Reviewed-by: Pali Rohár Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/alps.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -24,6 +24,7 @@ #include "psmouse.h" #include "alps.h" +#include "trackpoint.h" /* * Definitions for ALPS version 3 and 4 command mode protocol @@ -2864,6 +2865,23 @@ static const struct alps_protocol_info * return NULL; } +static bool alps_is_cs19_trackpoint(struct psmouse *psmouse) +{ + u8 param[2] = { 0 }; + + if (ps2_command(&psmouse->ps2dev, + param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) + return false; + + /* + * param[0] contains the trackpoint device variant_id while + * param[1] contains the firmware_id. So far all alps + * trackpoint-only devices have their variant_ids equal + * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. + */ + return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20); +} + static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) { const struct alps_protocol_info *protocol; @@ -3165,6 +3183,20 @@ int alps_detect(struct psmouse *psmouse, return error; /* + * ALPS cs19 is a trackpoint-only device, and uses different + * protocol than DualPoint ones, so we return -EINVAL here and let + * trackpoint.c drive this device. If the trackpoint driver is not + * enabled, the device will fall back to a bare PS/2 mouse. + * If ps2_command() fails here, we depend on the immediately + * followed psmouse_reset() to reset the device to normal state. + */ + if (alps_is_cs19_trackpoint(psmouse)) { + psmouse_dbg(psmouse, + "ALPS CS19 trackpoint-only device detected, ignoring\n"); + return -EINVAL; + } + + /* * Reset the device to make sure it is fully operational: * on some laptops, like certain Dell Latitudes, we may * fail to properly detect presence of trackstick if device