diff options
author | Sebastien Royen <sebastien.royen@armadeus.com> | 2013-03-31 03:24:13 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-03-31 03:48:10 -0400 |
commit | 257a1ec603538036a2f2ae7e8433d775b7a7588a (patch) | |
tree | aa03041b80f470f1f107fd9ca7f5cd92f62888c8 /drivers/input/misc/mma8450.c | |
parent | 80e3e5328a9978fae3654ead657e9df653508713 (diff) |
Input: mma8450 - fix signed 12bits to 32bits conversion
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc/mma8450.c')
-rw-r--r-- | drivers/input/misc/mma8450.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c index 480557f14f23..f3309696d053 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) | |||
123 | if (ret < 0) | 123 | if (ret < 0) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | x = ((buf[1] << 4) & 0xff0) | (buf[0] & 0xf); | 126 | x = ((int)(s8)buf[1] << 4) | (buf[0] & 0xf); |
127 | y = ((buf[3] << 4) & 0xff0) | (buf[2] & 0xf); | 127 | y = ((int)(s8)buf[3] << 4) | (buf[2] & 0xf); |
128 | z = ((buf[5] << 4) & 0xff0) | (buf[4] & 0xf); | 128 | z = ((int)(s8)buf[5] << 4) | (buf[4] & 0xf); |
129 | 129 | ||
130 | input_report_abs(dev->input, ABS_X, x); | 130 | input_report_abs(dev->input, ABS_X, x); |
131 | input_report_abs(dev->input, ABS_Y, y); | 131 | input_report_abs(dev->input, ABS_Y, y); |