From: Henrik Rydberg <rydberg@euromail.se>
To: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
kyungmin.park@samsung.com
Subject: Re: [PATCH v2] input: qt602240 - Add ATMEL QT602240 touchscreen driver
Date: Fri, 25 Jun 2010 16:08:46 +0200 [thread overview]
Message-ID: <4C24B86E.1030407@euromail.se> (raw)
In-Reply-To: <1277430882-3685-1-git-send-email-jy0922.shim@samsung.com>
Hi Joonyoung,
some follow-up comments on the MT events.
> +static void qt602240_input_report(struct qt602240_data *data, int single_id)
> +{
> + struct qt602240_finger *finger = data->finger;
> + struct input_dev *input_dev = data->input_dev;
> + int finger_num = 0;
> + int id;
> +
> + for (id = 0; id < QT602240_MAX_FINGER; id++) {
> + if (!finger[id].status)
> + continue;
> +
> + input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR,
> + finger[id].area);
> +
> + if (finger[id].status == QT602240_RELEASE)
> + finger[id].status = 0;
> + else {
> + input_report_abs(input_dev, ABS_MT_POSITION_X,
> + finger[id].x);
> + input_report_abs(input_dev, ABS_MT_POSITION_Y,
> + finger[id].y);
> + finger_num++;
> + }
> +
> + input_mt_sync(input_dev);
> + }
> +
> + input_report_key(input_dev, BTN_TOUCH, finger_num > 0);
> +
> + if (finger[single_id].status != QT602240_RELEASE) {
> + input_report_abs(input_dev, ABS_X, finger[single_id].x);
> + input_report_abs(input_dev, ABS_Y, finger[single_id].y);
> + }
> +
> + input_sync(input_dev);
> +}
The problem still persists here. I will try to explain in code form instead:
for (id = 0; id < QT602240_MAX_FINGER; id++) {
if (!finger[id].status)
continue;
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR,
finger[id].status != QT602240_RELEASE ? finger[id].area : 0);
input_report_abs(input_dev, ABS_MT_POSITION_X,
finger[id].x);
input_report_abs(input_dev, ABS_MT_POSITION_Y,
finger[id].y);
input_mt_sync(input_dev);
if (finger[id].status == QT602240_RELEASE)
finger[id].status = 0;
else
finger_num++;
}
Regarding the single_id, I can understand the need for it, but the logic for a
single touch is slightly confusing. If single_id is to be interpreted as the
contact currently being tracked as the single pointer, and that single_id
changes as the number of fingers on the pad is reduced, until there is only one
left, then it would still be clearer logically to do something like this:
if (finger_num > 0) {
input_report_key(input_dev, BTN_TOUCH, 1);
input_report_abs(input_dev, ABS_X, finger[single_id].x);
input_report_abs(input_dev, ABS_Y, finger[single_id].y);
} else {
input_report_key(input_dev, BTN_TOUCH, 0);
}
input_sync(input_dev);
Would it not?
Thanks,
Henrik
next prev parent reply other threads:[~2010-06-25 14:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-25 1:54 [PATCH v2] input: qt602240 - Add ATMEL QT602240 touchscreen driver Joonyoung Shim
2010-06-25 14:08 ` Henrik Rydberg [this message]
2010-06-28 5:16 ` Joonyoung Shim
2010-06-28 7:37 ` Henrik Rydberg
2010-06-28 8:17 ` Joonyoung Shim
2010-06-28 8:34 ` Henrik Rydberg
2010-06-28 8:42 ` Dmitry Torokhov
2010-06-28 8:46 ` Henrik Rydberg
2010-06-28 9:01 ` Dmitry Torokhov
2010-06-28 9:10 ` Henrik Rydberg
2010-06-28 9:05 ` Joonyoung Shim
2010-06-28 9:17 ` Henrik Rydberg
2010-06-28 10:00 ` Joonyoung Shim
2010-06-28 10:22 ` Henrik Rydberg
2010-06-28 11:12 ` Joonyoung Shim
2010-06-28 12:23 ` Henrik Rydberg
2010-06-28 12:58 ` Joonyoung Shim
2010-06-28 13:24 ` Henrik Rydberg
2010-06-28 13:41 ` Joonyoung Shim
[not found] ` <AANLkTikNh-LTClIgXGAIEkegLCmWNnN2Zk05XhZWOumb@mail.gmail.com>
2010-06-28 14:33 ` Dan Murphy
2010-06-29 3:33 ` Joonyoung Shim
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=4C24B86E.1030407@euromail.se \
--to=rydberg@euromail.se \
--cc=dmitry.torokhov@gmail.com \
--cc=jy0922.shim@samsung.com \
--cc=kyungmin.park@samsung.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).