Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1953461ybb; Sun, 29 Mar 2020 18:09:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuXK/aX5Qu3RojGlFhNQsaLhEE1ryszQ2TS76iL9iIWtBqezlMp+LALTCGPDUTSszpPDi2+ X-Received: by 2002:a05:6830:1ac1:: with SMTP id r1mr3046519otc.139.1585530599505; Sun, 29 Mar 2020 18:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585530599; cv=none; d=google.com; s=arc-20160816; b=JSyQ0w4ijXF3dogosQJhMH9+20cqkR1vBDpzSW7+VeCxwfwQIaOsmE5MZTHx7AAcBO ZAs4LfgkQtsAtzyTsLYRnXAZpMzVoPd/7+DUNfPxXQaB9Eak1wR6YJacHxHI7kOQutfV Ibf2l4jFKLXxseIfDxBcU8nB1m3RikFVZChAR4aAfCHQ5Q8A+IMpvy2J1H6IT3eF4glG YhQN8l/JeDyEEbD07n4A4RR24j/ppPknCjAHqNzCVIr+TmnNm16wui7SK31UFRmeq/8N CweH6BfnvzvPJUSq1/DG6tbwMoBxOa+06JSoy6VbTingx8Lh2jwDODpLFl1QPTXnJlVn Ukeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from; bh=TJhsmFk3lelwDlKOsBDAaz3gmQTBk2ImKLs3qXGOIsg=; b=ZKMnSCWScQOjwFNxmfxbsS3MK/3KNxzr92za+IKEaxS3ut4X6jm9YxDy5UUWx/UrbA eXeQ50g5PZGMOeSxnujouumslGgktC9UVSZ7hkNL7A+rMUSyKU/oJSE+I5e+d1Nez56i JrYbyuboh/RTFPOJY2cZrvamlX5al2n776FYHUsAcJ2Oi/FzFwleR3p2m2LccvvaTkEZ nkEF8XTimeAG/AotjCkaFmMMzj5aBZ0qVAXt0F34KP6U0n9rYq9Uaz7tYHYjK4w+ytjo ge3wA78mCZvGX32RD2TKhOL4n8Q+xSP7J16dxch53mEZ2IfhqQj7OFvCigcPj5e86+rU QibA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16si5978961ote.190.2020.03.29.18.09.46; Sun, 29 Mar 2020 18:09:59 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727830AbgC3A75 (ORCPT + 99 others); Sun, 29 Mar 2020 20:59:57 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:13343 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbgC3A74 (ORCPT ); Sun, 29 Mar 2020 20:59:56 -0400 X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="35007758" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 30 Mar 2020 08:59:56 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(20970:0:AUTH_RELAY) (envelope-from ); Mon, 30 Mar 2020 08:59:54 +0800 (CST) Received: from 192.168.200.93 by webmail.emc.com.tw with Mail2000 ESMTPA Server V7.00(2486:1:AUTH_LOGIN) (envelope-from ); Mon, 30 Mar 2020 08:59:53 +0800 (CST) From: "Johnny.Chuang" To: "'Peter Hutterer'" , "'Johnny Chuang'" Cc: "'Dmitry Torokhov'" , "'Benjamin Tissoires'" , , , "'Rob Schonberger'" , "'James Chen'" , "'Jennifer Tsai'" , "'Paul Liang'" , "'Jeff Chuang'" References: <1585209525-6047-1-git-send-email-johnny.chuang.emc@gmail.com> <20200329021436.GA68168@jelly> In-Reply-To: <20200329021436.GA68168@jelly> Subject: RE: [PATCH] Input: elants_i2c - support palm detection Date: Mon, 30 Mar 2020 08:59:51 +0800 Message-ID: <001501d6062e$849afb60$8dd0f220$@emc.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFNlY3ZGTB8jr2YC71KGESJaTtjnwHvPYN1qWG1XYA= Content-Language: zh-tw x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcMDUwMTBcYXBwZGF0YVxyb2FtaW5nXDA5ZDg0OWI2LTMyZDMtNGE0MC04NWVlLTZiODRiYTI5ZTM1Ylxtc2dzXG1zZy1jMWQ1NDg2YS03MjIxLTExZWEtODNkOC03YzVjZjg3NDk0NzhcYW1lLXRlc3RcYzFkNTQ4NmMtNzIyMS0xMWVhLTgzZDgtN2M1Y2Y4NzQ5NDc4Ym9keS50eHQiIHN6PSIzODUzIiB0PSIxMzIzMDAwMzU5MTA0NjkwNjciIGg9IlRVcHNLb3AyYXZ2aHoyMi9iVytnN1BBQkJFUT0iIGlkPSIiIGJsPSIwIiBibz0iMSIvPjwvbWV0YT4= x-dg-rorf: true Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Peter Hutterer [mailto:peter.hutterer@who-t.net] > Sent: Sunday, March 29, 2020 10:15 AM > To: Johnny Chuang > Cc: Dmitry Torokhov; Benjamin Tissoires; linux-kernel@vger.kernel.org; > linux-input@vger.kernel.org; Rob Schonberger; Johnny Chuang; James Chen; > Jennifer Tsai; Paul Liang; Jeff Chuang > Subject: Re: [PATCH] Input: elants_i2c - support palm detection > > On Thu, Mar 26, 2020 at 03:58:45PM +0800, Johnny Chuang wrote: > > From: Johnny Chuang > > > > Elan define finger/palm detection on the least significant bit of byte 33. > > The default value is 1 for all firmwares, which report as MT_TOOL_FINGER. > > If firmware support palm detection, the bit will change to 0 and > > report as MT_TOOL_PALM when firmware detecting palm. > > > > Signed-off-by: Johnny Chuang > > --- > > drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/input/touchscreen/elants_i2c.c > > b/drivers/input/touchscreen/elants_i2c.c > > index 14c577c..3b4d9eb3 100644 > > --- a/drivers/input/touchscreen/elants_i2c.c > > +++ b/drivers/input/touchscreen/elants_i2c.c > > @@ -73,6 +73,7 @@ > > #define FW_POS_STATE 1 > > #define FW_POS_TOTAL 2 > > #define FW_POS_XY 3 > > +#define FW_POS_TOOL_TYPE 33 > > #define FW_POS_CHECKSUM 34 > > #define FW_POS_WIDTH 35 > > #define FW_POS_PRESSURE 45 > > @@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct elants_data > > *ts, u8 *buf) { > > struct input_dev *input = ts->input; > > unsigned int n_fingers; > > + unsigned int tool_type; > > u16 finger_state; > > int i; > > > > @@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct elants_data > *ts, u8 *buf) > > dev_dbg(&ts->client->dev, > > "n_fingers: %u, state: %04x\n", n_fingers, finger_state); > > > > + /* Note: all fingers have the same tool type */ > > + if (buf[FW_POS_TOOL_TYPE] & 0x01) > > + tool_type = MT_TOOL_FINGER; > > + else > > + tool_type = MT_TOOL_PALM; > > + > > for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) { > > if (finger_state & 1) { > > unsigned int x, y, p, w; > > @@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data > *ts, u8 *buf) > > i, x, y, p, w); > > > > input_mt_slot(input, i); > > - input_mt_report_slot_state(input, MT_TOOL_FINGER, true); > > + input_mt_report_slot_state(input, tool_type, true); > > input_event(input, EV_ABS, ABS_MT_POSITION_X, x); > > input_event(input, EV_ABS, ABS_MT_POSITION_Y, y); > > input_event(input, EV_ABS, ABS_MT_PRESSURE, p); @@ > -1307,6 +1315,7 > > @@ static int elants_i2c_probe(struct i2c_client *client, > > input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, > 0); > > input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); > > input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0); > > + input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0, > MT_TOOL_MAX, 0, > > +0); > > if you're only reporting pen and palm, can we set this to MT_TOOL_PALM > instead? Otherwise you're indicating you may also send MT_TOOL_DIAL which > is unlikely on this hardware :) > Yes, we do not have MT_TOOL_DIAL on touch screen. So I need to modify MT_TOOL_MAX to MT_TOOL_PALM, right? > Reviewed-by: Peter Hutterer otherwise > > Cheers, > Peter > > > input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); > > input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); > > input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1); > > -- > > 2.7.4 > >