From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Daniel Mack <daniel@caiaq.de>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH 3/4] input: switch to input_abs_*() access functions
Date: Wed, 14 Jul 2010 01:09:39 -0700 [thread overview]
Message-ID: <20100714080939.GB2712@core.coreip.homeip.net> (raw)
In-Reply-To: <1274289757-2723-4-git-send-email-daniel@caiaq.de>
Hi Daniel,
On Wed, May 19, 2010 at 07:22:36PM +0200, Daniel Mack wrote:
> joydev->corr[i].type = JS_CORR_BROKEN;
> - joydev->corr[i].prec = dev->absfuzz[j];
> - joydev->corr[i].coef[0] =
> - (dev->absmax[j] + dev->absmin[j]) / 2 - dev->absflat[j];
> - joydev->corr[i].coef[1] =
> - (dev->absmax[j] + dev->absmin[j]) / 2 + dev->absflat[j];
> + joydev->corr[i].prec = input_abs_fuzz(dev, j);
> +
> + t = (input_abs_max(dev, j) + input_abs_min(dev, j)) / 2
> + - input_abs_flat(dev, j);
> + joydev->corr[i].coef[0] = t;
> + joydev->corr[i].coef[1] = t;
FYI: this is not equivalent transformation - note that original code
either added or subtracted flat from the average to get coefficient.
> @@ -128,17 +129,20 @@ static void mousedev_touchpad_event(struct input_dev *dev,
> struct mousedev *mousedev,
> unsigned int code, int value)
> {
> - int size, tmp;
> enum { FRACTION_DENOM = 128 };
> + int tmp;
> +
> + /* use X size for ABS_Y to keep the same scale */
> + int size = input_abs_max(dev, ABS_X) - input_abs_min(dev, ABS_X);
> +
> + if (size == 0)
> + size = 256 * 2;
>
> switch (code) {
>
> case ABS_X:
> fx(0) = value;
> if (mousedev->touch && mousedev->pkt_count >= 2) {
> - size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
> - if (size == 0)
> - size = 256 * 2;
> tmp = ((value - fx(2)) * 256 * FRACTION_DENOM) / size;
> tmp += mousedev->frac_dx;
> mousedev->packet.dx = tmp / FRACTION_DENOM;
> @@ -150,10 +154,6 @@ static void mousedev_touchpad_event(struct input_dev *dev,
> case ABS_Y:
> fy(0) = value;
> if (mousedev->touch && mousedev->pkt_count >= 2) {
> - /* use X size to keep the same scale */
> - size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
> - if (size == 0)
> - size = 256 * 2;
The reason we had the repeating code blocks is that we don't do
calculations for events we are not interested in. This especially
important for multitouch devices generating lots of data.
I think I will keep it the way it was.
No need to resubmit, I am working on the patches...
Thanks.
--
Dmitry
next prev parent reply other threads:[~2010-07-14 8:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 17:22 [RFC] linux-input: dynamically allocate ABS axis information Daniel Mack
2010-05-19 17:22 ` [PATCH 1/4] input: use ABS_CNT rather than (ABS_MAX + 1) Daniel Mack
2010-05-19 17:22 ` [PATCH 2/4] input: add static inline helpers for ABS properties Daniel Mack
2010-05-19 17:22 ` [PATCH 3/4] input: switch to input_abs_*() access functions Daniel Mack
2010-07-14 8:09 ` Dmitry Torokhov [this message]
2010-05-19 17:22 ` [PATCH 4/4] input: dynamically allocate ABS information Daniel Mack
2010-05-24 16:08 ` Daniel Mack
2010-05-24 16:15 ` Dmitry Torokhov
2010-06-16 8:39 ` Daniel Mack
2010-07-21 8:30 ` Dmitry Torokhov
2010-07-21 8:31 ` Dmitry Torokhov
2010-07-21 8:32 ` Dmitry Torokhov
2010-07-21 9:22 ` ext-phil.2.carmody
2010-07-21 9:22 ` ext-phil.2.carmody
2010-07-21 10:42 ` Artem Bityutskiy
2010-07-21 10:42 ` Artem Bityutskiy
2010-08-11 7:02 ` Daniel Mack
2010-08-13 3:35 ` Dmitry Torokhov
2010-08-07 15:23 ` Daniel Mack
2010-08-11 3:29 ` Dmitry Torokhov
2010-07-14 8:18 ` 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=20100714080939.GB2712@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=daniel@caiaq.de \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.