Commit 257a1ec6 authored by Sebastien Royen's avatar Sebastien Royen Committed by Dmitry Torokhov

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: default avatarSebastien Royen <sebastien.royen@armadeus.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 80e3e532
...@@ -123,9 +123,9 @@ static void mma8450_poll(struct input_polled_dev *dev) ...@@ -123,9 +123,9 @@ static void mma8450_poll(struct input_polled_dev *dev)
if (ret < 0) if (ret < 0)
return; return;
x = ((buf[1] << 4) & 0xff0) | (buf[0] & 0xf); x = ((int)(s8)buf[1] << 4) | (buf[0] & 0xf);
y = ((buf[3] << 4) & 0xff0) | (buf[2] & 0xf); y = ((int)(s8)buf[3] << 4) | (buf[2] & 0xf);
z = ((buf[5] << 4) & 0xff0) | (buf[4] & 0xf); z = ((int)(s8)buf[5] << 4) | (buf[4] & 0xf);
input_report_abs(dev->input, ABS_X, x); input_report_abs(dev->input, ABS_X, x);
input_report_abs(dev->input, ABS_Y, y); input_report_abs(dev->input, ABS_Y, y);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment