Skip to content

Commit

Permalink
HID: wacom: Properly report negative values from Intuos Pro 2 Bluetooth
Browse files Browse the repository at this point in the history
The wacom driver's IRQ handler for Bluetooth reports from the 2nd-gen
Intuos Pro does not correctly process negative numbers. Values for
tilt and rotation (which can go negative) are instead interpreted as
unsigned and so jump to very large values when the data should be
negative. This commit properly casts the data to ensure we report
negative numbers when necessary.

Fixes: 4922cd2 ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface")
Cc: stable@vger.kernel.org # v4.11
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jason Gerecke authored and Jiri Kosina committed Sep 6, 2017
1 parent e57f4e6 commit b63c4c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/hid/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,9 @@ static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
if (range) {
input_report_abs(pen_input, ABS_X, get_unaligned_le16(&frame[1]));
input_report_abs(pen_input, ABS_Y, get_unaligned_le16(&frame[3]));
input_report_abs(pen_input, ABS_TILT_X, frame[7]);
input_report_abs(pen_input, ABS_TILT_Y, frame[8]);
input_report_abs(pen_input, ABS_Z, get_unaligned_le16(&frame[9]));
input_report_abs(pen_input, ABS_TILT_X, (char)frame[7]);
input_report_abs(pen_input, ABS_TILT_Y, (char)frame[8]);
input_report_abs(pen_input, ABS_Z, (int16_t)get_unaligned_le16(&frame[9]));
input_report_abs(pen_input, ABS_WHEEL, get_unaligned_le16(&frame[11]));
}
input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
Expand Down

0 comments on commit b63c4c2

Please sign in to comment.