From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Sebastien Royen <sebastien.royen@gmail.com>
Cc: Bill Pemberton <wfp5p@virginia.edu>,
linux-kernel@vger.kernel.org, seb <sebastien.royen@armadeus.com>
Subject: Re: [PATCH 1/1] Input: mma8450 - fix signed 12bits to 32bits conversion
Date: Sun, 31 Mar 2013 00:25:06 -0700 [thread overview]
Message-ID: <20130331072506.GA7919@core.coreip.homeip.net> (raw)
In-Reply-To: <1364480189-15062-1-git-send-email-sebastien.royen@armadeus.com>
On Thu, Mar 28, 2013 at 03:16:29PM +0100, Sebastien Royen wrote:
> From: seb <sebastien.royen@armadeus.com>
>
> Event value is wrong. Should be in range -2048 to 2047, but is in range 0 to 4095.
> Use s8 to int conversion and remove 0xfff mask.
>
> Signed-off-by: Sebastien Royen <sebastien.royen@armadeus.com>
Applied, thank you Sebastien.
> ---
> drivers/input/misc/mma8450.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c
> index 480557f..f330969 100644
> --- a/drivers/input/misc/mma8450.c
> +++ b/drivers/input/misc/mma8450.c
> @@ -123,9 +123,9 @@ static void mma8450_poll(struct input_polled_dev *dev)
> if (ret < 0)
> return;
>
> - x = ((buf[1] << 4) & 0xff0) | (buf[0] & 0xf);
> - y = ((buf[3] << 4) & 0xff0) | (buf[2] & 0xf);
> - z = ((buf[5] << 4) & 0xff0) | (buf[4] & 0xf);
> + x = ((int)(s8)buf[1] << 4) | (buf[0] & 0xf);
> + y = ((int)(s8)buf[3] << 4) | (buf[2] & 0xf);
> + z = ((int)(s8)buf[5] << 4) | (buf[4] & 0xf);
>
> input_report_abs(dev->input, ABS_X, x);
> input_report_abs(dev->input, ABS_Y, y);
> --
> 1.7.9.5
>
--
Dmitry
next prev parent reply other threads:[~2013-03-31 7:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 14:16 [PATCH 1/1] Input: mma8450 - fix signed 12bits to 32bits conversion Sebastien Royen
2013-03-31 7:25 ` Dmitry Torokhov [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-03-27 8:17 seb
2013-03-28 5:58 ` Dmitry Torokhov
2013-03-28 7:36 ` Sebastien Royen
2013-03-28 8:14 ` 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=20130331072506.GA7919@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sebastien.royen@armadeus.com \
--cc=sebastien.royen@gmail.com \
--cc=wfp5p@virginia.edu \
/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