Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9980776ybi; Wed, 24 Jul 2019 13:28:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqypU2rlhiz1Fn7AE813S3ccRlrmHsoMEC9r/Me3ck0fDrmQ5pxdBhvKxYPjQWmngeQrMmfu X-Received: by 2002:a65:640d:: with SMTP id a13mr82369925pgv.256.1564000112997; Wed, 24 Jul 2019 13:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000112; cv=none; d=google.com; s=arc-20160816; b=WF5iHzSalkSSEx6JEFXZ3uZ/8V9Ttubo3tkHT54DbP01w6HZrL1V+DN8aVsltFneNV Sk/e8ftme96wTBhaD8223XAMaMcLI0CE7mytncblM6PWPFfYSfMjtEKCKT88clOPMpLE 9Xak2eowi/Ni0/uAPOFp4aoYe1Hz+XyDnvodj+lSLHij100iH5SxkgBGS9ktGUU7NcPX hWkW0/jlv0HZkhWlSFn5vSsDw2jqEIE1rwMk04WaEJDBpEN760uHDEdAUwX+uSEbe2ca 6UWGW3ZEpqgsLmGZ8fWzm6eho1bUyyw24xXmhpjsX65Fqavpw0upl6jFGeKgugxrxxUR H/ug== 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=lz0CmaAE60F2kmRpbVqcCwvU8RP3XTk0CSlRj/PXmOY=; b=TpOf2uOtLkwyHoH9yyQqIg9hmcEpG6JrsqZQR4HLW3w5vfVDX9/1qdLLSBOvr9oKJi U095yiYBB5F5Z4TCCsiKMrnUtwRqSKI5uWnryCmuVjQ0tqTDaWMHyhcFrvKnu83gT3D4 LOuOQs+KO3NmAmhK+cbtZrg2tsRN/+Jg/SSnupSNT//TYDG2LT+kfkfE1TH7wjGPEm20 4h3/M9k4at/wdYCVdxHDPOlKr1LJZO4Gfc0gqtB6MV7uc9bzF4fb+zqoVaWtw/pDDI7W uQNa5MDR1Pqokts3p4wD7SeoZjFz2uiCW3pLkFGlAkeQi4PwFj3lKnUWBTWJSA56UEAm Wzug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WvoPcazG; 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 k16si14213856pfi.174.2019.07.24.13.28.18; Wed, 24 Jul 2019 13:28:32 -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=WvoPcazG; 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 S2388027AbfGXTgm (ORCPT + 99 others); Wed, 24 Jul 2019 15:36:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:36454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389013AbfGXTgk (ORCPT ); Wed, 24 Jul 2019 15:36:40 -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 6FF71214AF; Wed, 24 Jul 2019 19:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996998; bh=Gol6qUUSwO5qNPzGI3xflBF2e729mBDqdTgeySrquU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvoPcazGq7VGqmVzl1yVbczfQ7E23LCyb7dhF/T0QgIymiS945QRn4hWLpa1tiz+L URQxkzl7FE3CZjJ8KHQN7hgNxTi72b/PYN8X2sx/K0P8YSf+OTJLF8E6pnkMISxQzG V56dBgbEa3yO7U4yKyYAGe5SikpJTm7Mh5AMjquM= 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 5.2 287/413] Input: alps - dont handle ALPS cs19 trackpoint-only device Date: Wed, 24 Jul 2019 21:19:38 +0200 Message-Id: <20190724191756.789488011@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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 @@ -21,6 +21,7 @@ #include "psmouse.h" #include "alps.h" +#include "trackpoint.h" /* * Definitions for ALPS version 3 and 4 command mode protocol @@ -2861,6 +2862,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; @@ -3162,6 +3180,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