Skip to content

Commit

Permalink
wacom: Interpret tilt data from Intuos Pro BT as signed values
Browse files Browse the repository at this point in the history
The tilt data contained in the Bluetooth packets of an Intuos Pro are
supposed to be interpreted as signed values. Simply casting the values
to type `char` is not guaranteed to work since it is implementation-
defined whether it is signed or unsigned. At least one user has noticed
the data being reported incorrectly on their system. To ensure that the
data is interpreted properly, we specifically cast to `signed char`
instead.

Link: linuxwacom#445
Fixes: 4922cd26f03c ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface")
CC: stable@vger.kernel.org # 4.11+
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
  • Loading branch information
jigpu committed Oct 24, 2024
1 parent 4f0ee05 commit 2c27caa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 4.18/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,9 +1373,9 @@ static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
rotation -= 1800;

input_report_abs(pen_input, ABS_TILT_X,
(char)frame[7]);
(signed char)frame[7]);
input_report_abs(pen_input, ABS_TILT_Y,
(char)frame[8]);
(signed char)frame[8]);
input_report_abs(pen_input, ABS_Z, rotation);
input_report_abs(pen_input, ABS_WHEEL,
get_unaligned_le16(&frame[11]));
Expand Down

0 comments on commit 2c27caa

Please sign in to comment.