Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3819469ybi; Mon, 29 Jul 2019 13:14:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1ipzSQXGkwZqqqiFg6lZ7TriC6mJrxzUizekscZVfg0FMCJ8EbIHwFa92Bw/XUVC5TKUk X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr115471122plb.30.1564431291979; Mon, 29 Jul 2019 13:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431291; cv=none; d=google.com; s=arc-20160816; b=mS6+chefgf/eRFOTkRkSWF3ApfNJnprdd4HSJJ1X/899BAd9oVJSRqM3slVVbf1/9d vj70mngCuBbfcsMjqW7sHmQmhb/86lc4qFSDqCnhed5CZiVWkPs/IRpfnv0JvarYilcl oNG4QodlAeLtx9Y1mDtUVbU4Bgu+OAeMwLrKpHFcLfmtmf4KiItmqeihBulJfHLTsELT vcinqK5yMnkHdRd7awtKhZPIwdNeoWvLKh9etmCnYidGcVIKJztHBdHqnRbNwM2YzpAC 6mRLeKBjOBovRdY+fH/T9REZ7P8SV6Y8/4fHrg6r1/g92ojpg+l2J+7qg8F0dIg4qHXB sSHg== 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=6fKAefjFeYQC96OQyGDZ1C5SPGyVwAchYiWZBoYeUso=; b=0TOTEBRaz8X5A+CbizBK6FzGhEs5cEjEs/UB80NulyLsdFqs7SUwm6jvglimOqDvgO +n5Nt9QaBmOTvzGFbx6635bXw4aFu1efMTokbW7yCf3IWRzrXpe5dojfnKugphiIQ8ad mDqEZcMLB1fsiqe6FMSBCOQGmDXpnYdcDnhCyKwU8a9wjerGKFcAihbS44l4Suy80/SF EvfasUVd7V3WTXDVoqyvVr/Sb5FDnquMf20/sSMm/PUoWOPBqClOYYZzKxAhMiFQqTgf vWWe17WxDY65s4MQx+XuKsS+qh9BvPsidQTT27O/ZoOBCTWAH2UWfRCYe3j7VxVne4pb r/8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y7WpP2Bu; 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 k10si27900435pjw.1.2019.07.29.13.14.37; Mon, 29 Jul 2019 13:14:51 -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=Y7WpP2Bu; 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 S2387953AbfG2TaG (ORCPT + 99 others); Mon, 29 Jul 2019 15:30:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:42810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387396AbfG2TaF (ORCPT ); Mon, 29 Jul 2019 15:30:05 -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 27EB721655; Mon, 29 Jul 2019 19:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428603; bh=ywvhupy/GmtkqJemVDgy4t2e4ZfZJC8dbZm0PYqQ8OQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7WpP2BuKWZQfMpkoibr9sAy4jIhrcJVfTN8jFsIprLp2yJb1re4+CJ4p6mQ9v736 wHYXWi4X3uMGa+4kwU/eUnXZZIvpb3hWuOxPxR8INw4d3gQy5t028QU9w48ZEy8Ugi nD7Hi9yQ2538lQK8UaQmjF1J+8VsGeRh3QID7yYs= 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.14 128/293] Input: alps - dont handle ALPS cs19 trackpoint-only device Date: Mon, 29 Jul 2019 21:20:19 +0200 Message-Id: <20190729190834.394611664@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 @@ -2860,6 +2861,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; @@ -3161,6 +3179,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