linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dmitry Mastykin <dmastykin@astralinux.ru>
Cc: Bastien Nocera <hadess@hadess.net>,
	Hans de Goede <hdegoede@redhat.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v3 1/2] Input: goodix - Add support for more then one touch-key
Date: Tue, 24 Mar 2020 11:51:21 -0700	[thread overview]
Message-ID: <20200324185121.GA75430@dtor-ws> (raw)
In-Reply-To: <20200316075302.3759-1-dmastykin@astralinux.ru>

Hi Dmitry,

On Mon, Mar 16, 2020 at 10:53:03AM +0300, Dmitry Mastykin wrote:
> +static void goodix_ts_report_key(struct goodix_ts_data *ts, u8 *data)
> +{
> +	int touch_num;
> +	u8 key_value;
> +	int i;
> +
> +	if (data[0] & GOODIX_HAVE_KEY) {
> +		touch_num = data[0] & 0x0f;
> +		key_value = data[1 + ts->contact_size * touch_num];
> +		for (i = 0; i < GOODIX_MAX_KEYS; ++i)
> +			if (key_value & (1 << i))
> +				input_report_key(ts->input_dev, ts->keymap[i], 1);
> +	} else
> +		for (i = 0; i < GOODIX_MAX_KEYS; ++i)
> +			input_report_key(ts->input_dev, ts->keymap[i], 0);

Should this be written as:

	if (data[0] & GOODIX_HAVE_KEY) {
		touch_num = data[0] & 0x0f;
		key_value = data[1 + ts->contact_size * touch_num];
	} else {
		/* Release all keys */
		key_value = 0;
	}

	for (i = 0; i < GOODIX_MAX_KEYS; i++)
		input_report_key(ts->input_dev, ts->keymap[i],
				 key_value & BIT(i);

or the device may send incremental updates to the keys pressed without
resending currently pressed keys (sounds unlikely)?

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2020-03-24 18:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16  7:53 [PATCH v3 1/2] Input: goodix - Add support for more then one touch-key Dmitry Mastykin
2020-03-16  7:53 ` [PATCH v3 2/2] Input: goodix - Fix spurious key release events Dmitry Mastykin
2020-03-24 10:24   ` Bastien Nocera
2020-03-24 18:52   ` Dmitry Torokhov
2020-03-24 10:24 ` [PATCH v3 1/2] Input: goodix - Add support for more then one touch-key Bastien Nocera
2020-03-24 18:51 ` Dmitry Torokhov [this message]
2020-03-24 19:38   ` Dmitry Mastykin
2020-03-24 21:45     ` Dmitry Torokhov

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=20200324185121.GA75430@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=dmastykin@astralinux.ru \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    /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).