Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp953863ybm; Tue, 21 May 2019 06:29:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyH7Ff2jHeGh2y3cl4pPyr7hQwiUJ1UcqCAVbBKa7cwQmWwnQqFlbYoxl+kL0mXsP8QQ5Ot X-Received: by 2002:a17:902:b941:: with SMTP id h1mr23916856pls.289.1558445367804; Tue, 21 May 2019 06:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558445367; cv=none; d=google.com; s=arc-20160816; b=wZct5VEWDdCawqF3nGGv+A3ex3oinSCim/gsI7WpGA95VVuyh6K3RZSmsutA91T7wv dfPndu1kWKAUcNu1K+A+nAjA4jzn5cyWDjnKWGD8VjyKSPnualpiETp2qnDgBBje/vde QGCXnWVkjcislRTnhKCRb5G+c5ZuHs4MHImT4LQwcgDswpAe0hbVT1a41/f+tz40SFL6 LvLE//zZsHyl0C8weYfOIli1c0I0KEK2+umWr89DUG9wOkRLn6vn4iW9gfOdbP6FLBRX HHX2SGRbo+FBkbvf9cNRj9F3rSecrjKi8BnzsHE27Ys95oeoo8H3YRgGHxHi2TzM06Dg 9p0A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TjJWLnwlGWBxYB2Ed5D+8vnllthB4BZw3UvtsYEbUiM=; b=k0KLhgxciqAo6zOT1ndzLS/1fAFcQlxmU6AeZWtjwGgUYcrpFrxkj8Ms4NvAKTTNeD iVegDufZ/OWiUl2iO2jZ8TdsuDb8EAiAS5/T3YKk/AgtyniRU/sRmmwadvVsiZ3cqKJV W/6Z8udub1EgfBcNwV8siL9diiPmONHuksBg3X4WmOr7melU5lbbjxwyb97pUTsepx/f UHjFfEGfGPLYcFIUDfLhNoNx4LGSFEM2eurSlkdqi8xgpDIydEHdG+sS4mjgf0u0tB7O DjUlmZgbnP/nNFw+LPax5IUnqE5KVNcxMY1fENwrO9uiEWJiE+YxaPXvs7RwtgLeTkBZ 910w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v130si23747197pfc.99.2019.05.21.06.29.12; Tue, 21 May 2019 06:29:27 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbfEUN1p (ORCPT + 99 others); Tue, 21 May 2019 09:27:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35280 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbfEUN1n (ORCPT ); Tue, 21 May 2019 09:27:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 969AB30044CC; Tue, 21 May 2019 13:27:38 +0000 (UTC) Received: from plouf.redhat.com (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D5CE60F8D; Tue, 21 May 2019 13:27:35 +0000 (UTC) From: Benjamin Tissoires To: Dmitry Torokhov , KT Liao , Rob Herring , Aaron Ma , Hans de Goede Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Benjamin Tissoires Subject: [PATCH v2 03/10] Input: elantech - detect middle button based on firmware version Date: Tue, 21 May 2019 15:27:05 +0200 Message-Id: <20190521132712.2818-4-benjamin.tissoires@redhat.com> In-Reply-To: <20190521132712.2818-1-benjamin.tissoires@redhat.com> References: <20190521132712.2818-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 21 May 2019 13:27:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks like the new generation of Lenovo machine also need to be added to the PnPID whitelist. This is definitively not going to scale, as there is nothing that tells us currently if a touchpad supports a true physical middle button. Consider that all new touchpads that are not clickpads (so matching ETP_NEW_IC_SMBUS_HOST_NOTIFY) are handling 3 physical buttons. Signed-off-by: Benjamin Tissoires -- new in v2 --- drivers/input/mouse/elantech.c | 16 ++++++---------- drivers/input/mouse/elantech.h | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 34b96b96fc96..057a3cf01eec 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1107,14 +1107,6 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = { { } }; -static const char * const middle_button_pnp_ids[] = { - "LEN2131", /* ThinkPad P52 w/ NFC */ - "LEN2132", /* ThinkPad P52 */ - "LEN2133", /* ThinkPad P72 w/ NFC */ - "LEN2134", /* ThinkPad P72 */ - NULL -}; - /* * Set the appropriate event bits for the input subsystem */ @@ -1133,8 +1125,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) __clear_bit(EV_REL, dev->evbit); __set_bit(BTN_LEFT, dev->keybit); - if (dmi_check_system(elantech_dmi_has_middle_button) || - psmouse_matches_pnp_id(psmouse, middle_button_pnp_ids)) + if (info->has_middle_button) __set_bit(BTN_MIDDLE, dev->keybit); __set_bit(BTN_RIGHT, dev->keybit); @@ -1748,6 +1739,11 @@ static int elantech_query_info(struct psmouse *psmouse, break; } + /* check for the middle button: DMI matching or new v4 firmwares */ + info->has_middle_button = dmi_check_system(elantech_dmi_has_middle_button) || + (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) && + !elantech_is_buttonpad(info)); + return 0; } diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index 194503ed59c5..16174b54ffc3 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -158,6 +158,7 @@ struct elantech_device_info { bool crc_enabled; bool set_hw_resolution; bool has_trackpoint; + bool has_middle_button; int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param); }; -- 2.21.0