From: Dmitry Mastykin <dmastykin@astralinux.ru>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
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 22:38:10 +0300 [thread overview]
Message-ID: <4c0be7d7-4d88-5adf-bbb3-5af036115e7a@astralinux.ru> (raw)
In-Reply-To: <20200324185121.GA75430@dtor-ws>
Hi Dmitry,
we had discussed earlier this point with Hans:
Hans:
>>> 3) In goodix_ts_report_key you do:
>>>
>>> for (i = 0; i < GOODIX_MAX_KEYS; ++i)
>>> if (key_value & (1 << i))
>>> input_report_key(ts->input_dev,
ts->keymap[i], 1
>>>
>>> But if the user then jumps his finger from say touch_key 0 to
touch_key 1
>>> without us receiving a "packet" in between with GOODIX_HAVE_KEY set,
>>> then we never release touch_key 0. So instead this really should be:
>>>
>>> for (i = 0; i < GOODIX_MAX_KEYS; ++i)
>>> input_report_key(ts->input_dev,
ts->keymap[i],
>>> key_value & (1 << i));
>>>
Me:
>> It seems, that this problem never happens. When user moves finger from
>> button to button, we stably receive 2-3 packets without
>> GOODIX_HAVE_KEY in between, that release all previous touches. From
>> other hand, your change will not work when the same keycode is
>> assigned to several buttons - it will be immediately released.
Hans:
>
> Hmm, interesting point I did not think of that. That would be a bit
> weird thing to do, but it is not impossible...
>
> I'm afraid Dmitry (the input maintainer) will likely make the same
> remark as I do though (when you submit this upstream). But we'll see.
>
> Keeping this as is is fine with me.
So I'm impressed about your mutual understanding) And waiting for your
decision.
Thank you!
Kind regards
Dmitry Mastykin
On 3/24/20 9:51 PM, Dmitry Torokhov wrote:
> 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.
>
next prev parent reply other threads:[~2020-03-24 19:38 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
2020-03-24 19:38 ` Dmitry Mastykin [this message]
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=4c0be7d7-4d88-5adf-bbb3-5af036115e7a@astralinux.ru \
--to=dmastykin@astralinux.ru \
--cc=dmitry.torokhov@gmail.com \
--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).