linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sergei A. Trusov" <sergei.a.trusov@ya.ru>
To: Bastien Nocera <hadess@hadess.net>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	russianneuromancer@ya.ru, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: goodix: Add support for capacitive home button found on some x86 tablets
Date: Tue, 20 Jun 2017 20:11:22 +1000	[thread overview]
Message-ID: <3319693.GoGvQJigqa@z12> (raw)
In-Reply-To: <1497950941.2559.13.camel@hadess.net>

On Tuesday, 20 June 2017 19:29:01 +10 Bastien Nocera wrote:
> On Tue, 2017-06-20 at 19:26 +1000, Sergei A. Trusov wrote:
> > 
> <snip>
> > Thank you for this point. Now I see all the changes above are
> > redundant:
> > we can use a value returned in the *data buffer. It is enough to add 
> > only two lines of code to achieve the behaviour of this entire patch.
> 
> A bit more with a comment explaining the reason behind those 2 lines,
> but shorter patches get my vote ;)

Current goodix_ts_read_input_report() function puts data from hardware
into point_data buffer. Then in masks high niblle of the first byte and 
returns it as touch_num. We need this masked nibble to check, so I was 
trying to remove mask operation. After your comment I just realized that
proposed patch should be much shorter. I have included more context lines
to make cleaner my attempts to explain (as I am affraid my English is not
so good):

---
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 240b16f3ee97..0c3825c39288 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -262,16 +262,18 @@ static void goodix_process_events(struct goodix_ts_data *ts)
 	u8  point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
 	int touch_num;
 	int i;
 
 	touch_num = goodix_ts_read_input_report(ts, point_data);
 	if (touch_num < 0)
 		return;
 
+	input_report_key(ts->input_dev, KEY_LEFTMETA, !!(point_data[0] & 0x10));
+
 	for (i = 0; i < touch_num; i++)
 		goodix_ts_report_touch(ts,
 				&point_data[1 + GOODIX_CONTACT_SIZE * i]);
 
 	input_mt_sync_frame(ts->input_dev);
 	input_sync(ts->input_dev);
 }
 
@@ -607,16 +609,18 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts)
 
 	ts->input_dev->name = "Goodix Capacitive TouchScreen";
 	ts->input_dev->phys = "input/ts";
 	ts->input_dev->id.bustype = BUS_I2C;
 	ts->input_dev->id.vendor = 0x0416;
 	ts->input_dev->id.product = ts->id;
 	ts->input_dev->id.version = ts->version;
 
+	input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA);
+
 	error = input_register_device(ts->input_dev);
 	if (error) {
 		dev_err(&ts->client->dev,
 			"Failed to register input device: %d", error);
 		return error;
 	}
 
 	return 0;


  reply	other threads:[~2017-06-20 10:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-17  9:42 [PATCH] Input: goodix: Add support for capacitive home button found on some x86 tablets Sergei A. Trusov
2017-06-17 19:34 ` Hans de Goede
2017-06-19 22:32 ` Bastien Nocera
2017-06-20  2:51   ` Dmitry Torokhov
2017-06-20  8:36     ` Bastien Nocera
2017-06-20  9:02       ` Hans de Goede
2017-06-20  9:26   ` Sergei A. Trusov
2017-06-20  9:29     ` Bastien Nocera
2017-06-20 10:11       ` Sergei A. Trusov [this message]
2017-06-20 10:20         ` Bastien Nocera
2017-06-20 10:47           ` Sergei A. Trusov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3319693.GoGvQJigqa@z12 \
    --to=sergei.a.trusov@ya.ru \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=russianneuromancer@ya.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).