From: Jason Gerecke <killertofu@gmail.com>
To: linux-input@vger.kernel.org, Jiri Kosina <jikos@kernel.org>
Cc: stable@vger.kernel.org, Ping Cheng <pinglinux@gmail.com>,
Aaron Skomra <skomra@gmail.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Jason Gerecke <killertofu@gmail.com>,
Jason Gerecke <jason.gerecke@wacom.com>
Subject: [PATCH v2 1/2] HID: wacom: Properly report negative values from Intuos Pro 2 Bluetooth
Date: Wed, 30 Aug 2017 15:13:25 -0700 [thread overview]
Message-ID: <20170830221326.15877-1-killertofu@gmail.com> (raw)
In-Reply-To: <CANRwn3Qt4wr4dSi2=diw_5Yh2w67TpW6zxgUY+csZLzykgqGXA@mail.gmail.com>
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>
---
Changes from v1:
* Patch introduced.
drivers/hid/wacom_wac.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index bb17d7bbefd3..d7ca1eb9d559 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -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]));
--
2.14.1
next prev parent reply other threads:[~2017-08-30 22:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 23:09 [PATCH] HID: wacom: Correct coordinate system of touchring and pen twist Jason Gerecke
2017-08-29 18:34 ` Ping Cheng
2017-08-30 0:37 ` Jason Gerecke
2017-08-30 22:13 ` Jason Gerecke [this message]
2017-08-30 22:13 ` [PATCH v2 2/2] " Jason Gerecke
2017-09-06 9:02 ` [PATCH v2 1/2] HID: wacom: Properly report negative values from Intuos Pro 2 Bluetooth Jiri Kosina
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=20170830221326.15877-1-killertofu@gmail.com \
--to=killertofu@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jason.gerecke@wacom.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=pinglinux@gmail.com \
--cc=skomra@gmail.com \
--cc=stable@vger.kernel.org \
/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