Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2107308ybb; Sun, 29 Mar 2020 22:49:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtXi6MqhTDKklDqBjDG6Grr9o+FwfuRzStm8IqY+hUa+3wsoDwaw/N66s5IjYUc7DP/Kdl0 X-Received: by 2002:aca:5712:: with SMTP id l18mr6593987oib.178.1585547396612; Sun, 29 Mar 2020 22:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585547396; cv=none; d=google.com; s=arc-20160816; b=dZW5VKxwc8jSn94D8JarzJJI7s3C7k/bdKhz7JGpHhhFthd/0IpUAxTYzwexAWqS6H WyTggXZjvVDZ/asWJH7cxZp8CeSoDmRp/DIG/IIsqQ3/G3zgZT4PG1OARMMpD/OIRX6z 6WGv/Z/Dn9ANHkKqJjGzYhv7LWJxhdwLKxg7WM5LiGwRhI6SZfH5lrzZcR4TVw057x25 KaBtWW6InzyNzAqRcp6tLDorB2kdYXWZoYQpgfg76hwd9p6Dz9wwcI6E3PBEQxFCgVNc kBctFWCGG6/O81k7gy5dGdpIEAgQ57MnDOprIHCNKLrrrKIoUOXtP6bYa4tGfC5S2p9d Et5Q== 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=u0Zzn9te90gLVUK0A7R32bpvgryGgShQVBvczp5koOk=; b=Q8sdd2HioJy49c5QTIfM1BNAlraPKLqkyhEwW2hdE8uS20VounsbyGkxIEV3EctS6t Borw5ueX7lahwC9yzv2hDgD10bOnClvUD4FLIsz1OeePyW+NRCztl8NWiLh1DQ0uXklo 0OG3ezTeQhZp+6o6abYVOjvcPA6HsLk/CnZn+jo6M3tTUQxZvsDVAxjCFgiZ9SYcM7oz MGbT3kHeh0skxxmr5+D7TzTL+bYymQyL3hiaKRL7T1zvtg2oqLio6uGCxx4Jc9sbY0zh fH0RvElxyBfr9V1letjxSW7evsLV8YXefSb1Y0ESYpyakF/n4RjFYig3u3s+olg0YeOg GRFg== 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 m2si5859434oof.17.2020.03.29.22.49.43; Sun, 29 Mar 2020 22:49:56 -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 S1728698AbgC3Fpp (ORCPT + 99 others); Mon, 30 Mar 2020 01:45:45 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:54411 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgC3Fpo (ORCPT ); Mon, 30 Mar 2020 01:45:44 -0400 X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="35013932" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 30 Mar 2020 13:45:12 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(20942:0:AUTH_RELAY) (envelope-from ); Mon, 30 Mar 2020 13:45:14 +0800 (CST) Received: from 192.168.55.71 by webmail.emc.com.tw with Mail2000 ESMTPA Server V7.00(2486:0:AUTH_LOGIN) (envelope-from ); Mon, 30 Mar 2020 13:45:13 +0800 (CST) From: "Johnny.Chuang" To: "'Peter Hutterer'" Cc: "'Johnny Chuang'" , "'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> <001501d6062e$849afb60$8dd0f220$@emc.com.tw> <20200330034732.GA156101@jelly> In-Reply-To: <20200330034732.GA156101@jelly> Subject: RE: [PATCH] Input: elants_i2c - support palm detection Date: Mon, 30 Mar 2020 13:45:10 +0800 Message-ID: <000001d60656$600c47e0$2024d7a0$@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: AQFNlY3ZGTB8jr2YC71KGESJaTtjnwHvPYN1Aovp+zsCHnbTnqk8tEmw Content-Language: zh-tw x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcMDUwMTBcYXBwZGF0YVxyb2FtaW5nXDA5ZDg0OWI2LTMyZDMtNGE0MC04NWVlLTZiODRiYTI5ZTM1Ylxtc2dzXG1zZy05ZDI1OTI5NS03MjQ5LTExZWEtYWQ1Zi03YzVjZjg3NDk0NzhcYW1lLXRlc3RcOWQyNTkyOTctNzI0OS0xMWVhLWFkNWYtN2M1Y2Y4NzQ5NDc4Ym9keS50eHQiIHN6PSI0ODgyIiB0PSIxMzIzMDAyMDcwOTQyMjU5MTUiIGg9Ikc2Y3VnL1ZZU3NpYWsvNFU3YmdOWFU0S3dqQT0iIGlkPSIiIGJsPSIwIiBibz0iMSIvPjwvbWV0YT4= 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: Monday, March 30, 2020 11:48 AM > To: Johnny.Chuang > Cc: 'Johnny Chuang'; 'Dmitry Torokhov'; 'Benjamin Tissoires'; > linux-kernel@vger.kernel.org; linux-input@vger.kernel.org; 'Rob Schonberger'; > 'James Chen'; 'Jennifer Tsai'; 'Paul Liang'; 'Jeff Chuang' > Subject: Re: [PATCH] Input: elants_i2c - support palm detection > > On Mon, Mar 30, 2020 at 08:59:51AM +0800, Johnny.Chuang wrote: > > > -----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? > > yes please. > > Cheers, > Peter > OK, I will submit patch v2 today. > > > > > 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 > > > > > >