linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kurtz <djkurtz@chromium.org>
To: Henrik Rydberg <rydberg@euromail.se>
Cc: dmitry.torokhov@gmail.com, chase.douglas@canonical.com,
	rubini@cvml.unipv.it, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, derek.foreman@collabora.co.uk,
	daniel.stone@collabora.co.uk, olofj@chromium.org
Subject: Re: [PATCH 02/12] Input: synaptics - do not invert y if 0
Date: Tue, 5 Jul 2011 12:29:51 +0800	[thread overview]
Message-ID: <CAGS+omDXhiZz2i5eniu_eOCES1Eq_fKs4JVWU-+wz6ot7kyhSA@mail.gmail.com> (raw)
In-Reply-To: <20110704210838.GA23915@polaris.bitmath.org>

Hi Henrik
Thanks for the review.

On Tue, Jul 5, 2011 at 5:08 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
>
> Hi Daniel,
>
> > Synaptics touchpads report increasing y from bottom to top.
> > This is inverted from normal userspace "top of screen is 0" coordinates.
> > Thus, the kernel driver reports inverted y coordinates to userspace.
> >
> > In some cases, however, y = 0 is sent by the touchpad.
> > In these cases, the kernel driver should not invert, and just report 0.
> >
> > This patch also refactors the inversion into a macro, and moves it
> > into packet processing instead of during position reporting.
>
> The patch seems to invert the current output?

By 'current' do you mean referenced from the previous implementation?
Or referenced from the raw input.
It does indeed invert the raw input.
This is the same as the previous implementation did.
The difference is that it does not also invert the special 'y=0' into
an arbitrarily large value.
Is this your concern?
-Dan

>
> >
> > Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> > ---
> >  drivers/input/mouse/synaptics.c |   16 +++++++++-------
> >  1 files changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> > index e06e045..f6d0c04 100644
> > --- a/drivers/input/mouse/synaptics.c
> > +++ b/drivers/input/mouse/synaptics.c
> > @@ -44,6 +44,8 @@
> >  #define YMIN_NOMINAL 1408
> >  #define YMAX_NOMINAL 4448
> >
> > +#define INVERT_Y(y) (((y) != 0) ? (YMAX_NOMINAL + YMIN_NOMINAL - (y)) : 0)
> > +
> >
> >  /*****************************************************************************
> >   *   Stuff we need even when we do not want native Synaptics support
> > @@ -409,9 +411,9 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
> >               hw->x = (((buf[3] & 0x10) << 8) |
> >                        ((buf[1] & 0x0f) << 8) |
> >                        buf[4]);
> > -             hw->y = (((buf[3] & 0x20) << 7) |
> > +             hw->y = INVERT_Y((((buf[3] & 0x20) << 7) |
> >                        ((buf[1] & 0xf0) << 4) |
> > -                      buf[5]);
> > +                      buf[5]));
> >
> >               hw->z = buf[2];
> >               hw->w = (((buf[0] & 0x30) >> 2) |
> > @@ -421,7 +423,8 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
> >               if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) && hw->w == 2) {
> >                       /* Gesture packet: (x, y, z) at half resolution */
> >                       priv->mt.x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
> > -                     priv->mt.y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1;
> > +                     priv->mt.y = INVERT_Y((((buf[4] & 0xf0) << 4)
> > +                                           | buf[2]) << 1);
> >                       priv->mt.z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
> >                       return 1;
> >               }
> > @@ -473,7 +476,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
> >               }
> >       } else {
> >               hw->x = (((buf[1] & 0x1f) << 8) | buf[2]);
> > -             hw->y = (((buf[4] & 0x1f) << 8) | buf[5]);
> > +             hw->y = INVERT_Y(((buf[4] & 0x1f) << 8) | buf[5]);
> >
> >               hw->z = (((buf[0] & 0x30) << 2) | (buf[3] & 0x3F));
> >               hw->w = (((buf[1] & 0x80) >> 4) | ((buf[0] & 0x04) >> 1));
> > @@ -491,8 +494,7 @@ static void set_slot(struct input_dev *dev, int slot, bool active, int x, int y)
> >       input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
> >       if (active) {
> >               input_report_abs(dev, ABS_MT_POSITION_X, x);
> > -             input_report_abs(dev, ABS_MT_POSITION_Y,
> > -                              YMAX_NOMINAL + YMIN_NOMINAL - y);
> > +             input_report_abs(dev, ABS_MT_POSITION_Y, y);
> >       }
> >  }
> >
> > @@ -584,7 +586,7 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> >
> >       if (num_fingers > 0) {
> >               input_report_abs(dev, ABS_X, hw.x);
> > -             input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
> > +             input_report_abs(dev, ABS_Y, hw.y);
> >       }
> >       input_report_abs(dev, ABS_PRESSURE, hw.z);
> >
> > --
> > 1.7.3.1
> >
>
> Thanks,
> Henrik

  reply	other threads:[~2011-07-05  4:30 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29  5:07 [PATCH 00/12] Synaptics image sensor support djkurtz
2011-06-29  5:07 ` [PATCH 01/12] Input: synaptics - cleanup 0x0c query documentation djkurtz
2011-07-05 17:33   ` Chase Douglas
2011-07-06 13:50     ` Daniel Kurtz
2011-07-07  6:30   ` Dmitry Torokhov
2011-06-29  5:07 ` [PATCH 02/12] Input: synaptics - do not invert y if 0 djkurtz
2011-07-04 21:08   ` Henrik Rydberg
2011-07-05  4:29     ` Daniel Kurtz [this message]
2011-07-05 18:07       ` Henrik Rydberg
2011-07-05 18:39         ` Chris Bagwell
2011-07-05 23:02         ` Daniel Kurtz
2011-07-05 17:42   ` Chase Douglas
2011-07-05 22:50     ` Daniel Kurtz
2011-07-05 23:06       ` Chase Douglas
2011-07-05 23:15         ` Daniel Kurtz
2011-07-05 23:25           ` Dmitry Torokhov
2011-06-29  5:07 ` [PATCH 03/12] Input: synaptics - fix minimum reported ABS_TOOL_WIDTH djkurtz
2011-06-29 13:28   ` Chris Bagwell
2011-06-29 16:48     ` Daniel Kurtz
2011-06-29 19:46       ` Chris Bagwell
2011-07-04 21:14         ` Henrik Rydberg
2011-07-09  6:24   ` Jeffrey Brown
2011-06-29  5:07 ` [PATCH 04/12] Input: synaptics - set resolution for MT_POSITION_X/Y axes djkurtz
2011-07-05 17:44   ` Chase Douglas
2011-07-07  6:23     ` Dmitry Torokhov
2011-06-29  5:07 ` [PATCH 05/12] Input: synaptics - process button bits in AGM packets djkurtz
2011-07-04 21:24   ` Henrik Rydberg
2011-07-05  4:38     ` Daniel Kurtz
2011-07-05 18:18       ` Henrik Rydberg
2011-07-05 18:19         ` Chase Douglas
2011-07-05 17:47   ` Chase Douglas
2011-07-07  6:24     ` Dmitry Torokhov
2011-06-29  5:07 ` [PATCH 06/12] Input: synaptics - fuzz position if touchpad reports reduced filtering djkurtz
2011-07-05 17:49   ` Chase Douglas
2011-07-07  6:25     ` Dmitry Torokhov
2011-06-29  5:07 ` [PATCH 07/12] Input: synaptics - rename synaptics_data.mt to agm djkurtz
2011-07-04 21:26   ` Henrik Rydberg
2011-07-05  4:39     ` Daniel Kurtz
2011-07-05 18:20       ` Henrik Rydberg
2011-07-05 17:53   ` Chase Douglas
2011-06-29  5:07 ` [PATCH 08/12] Input: synaptics - rename set_slot to be more descriptive djkurtz
2011-07-05 17:54   ` Chase Douglas
2011-07-07  6:27     ` Dmitry Torokhov
2011-06-29  5:07 ` [PATCH 09/12] Input: synaptics - add image sensor support djkurtz
2011-07-04 21:42   ` Henrik Rydberg
2011-07-05  5:08     ` Daniel Kurtz
2011-07-05 19:27       ` Henrik Rydberg
2011-07-06 16:41         ` Daniel Kurtz
2011-07-06 17:08           ` Chase Douglas
2011-07-06 17:45           ` Dmitry Torokhov
2011-07-06 18:47             ` Henrik Rydberg
2011-07-06 18:58               ` Dmitry Torokhov
2011-07-06 19:31                 ` Henrik Rydberg
2011-07-06 20:00                   ` Dmitry Torokhov
2011-07-06 20:20                     ` Henrik Rydberg
2011-07-06 21:22                       ` Chase Douglas
2011-07-06 21:36                         ` Dmitry Torokhov
2011-07-06 22:16                           ` Chase Douglas
2011-07-06 22:35                             ` Henrik Rydberg
2011-07-06 23:30                               ` Chase Douglas
2011-06-29  5:07 ` [PATCH 10/12] Input: synaptics - decode AGM packet types djkurtz
2011-06-29 10:02   ` Chase Douglas
2011-06-29 10:07     ` Daniel Stone
2011-06-29 10:32       ` Chase Douglas
2011-06-29 11:26         ` Daniel Kurtz
2011-06-29 11:04     ` Daniel Kurtz
2011-07-05 18:17   ` Chase Douglas
2011-07-05 18:55     ` Chris Bagwell
2011-07-06 16:53       ` Daniel Kurtz
2011-06-29  5:07 ` [PATCH 11/12] Input: synaptics - process finger (<=3) transitions djkurtz
2011-06-29  5:07 ` [PATCH 12/12] Input: synaptics - process finger (<=5) transitions djkurtz

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=CAGS+omDXhiZz2i5eniu_eOCES1Eq_fKs4JVWU-+wz6ot7kyhSA@mail.gmail.com \
    --to=djkurtz@chromium.org \
    --cc=chase.douglas@canonical.com \
    --cc=daniel.stone@collabora.co.uk \
    --cc=derek.foreman@collabora.co.uk \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olofj@chromium.org \
    --cc=rubini@cvml.unipv.it \
    --cc=rydberg@euromail.se \
    /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).