diff options
author | Jason Gerecke <killertofu@gmail.com> | 2019-11-06 22:59:46 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2019-11-06 23:37:29 +0300 |
commit | ff479731c3859609530416a18ddb3db5db019b66 (patch) | |
tree | 4a09d3a6037b7085058506029ceb1ed7beb2aac9 /drivers/hid/hid-quirks.c | |
parent | 43b7029f475e7497da1de1f4a1742241812bf266 (diff) | |
download | linux-ff479731c3859609530416a18ddb3db5db019b66.tar.xz |
HID: wacom: generic: Treat serial number and related fields as unsigned
The HID descriptors for most Wacom devices oddly declare the serial
number and other related fields as signed integers. When these numbers
are ingested by the HID subsystem, they are automatically sign-extended
into 32-bit integers. We treat the fields as unsigned elsewhere in the
kernel and userspace, however, so this sign-extension causes problems.
In particular, the sign-extended tool ID sent to userspace as ABS_MISC
does not properly match unsigned IDs used by xf86-input-wacom and libwacom.
We introduce a function 'wacom_s32tou' that can undo the automatic sign
extension performed by 'hid_snto32'. We call this function when processing
the serial number and related fields to ensure that we are dealing with
and reporting the unsigned form. We opt to use this method rather than
adding a descriptor fixup in 'wacom_hid_usage_quirk' since it should be
more robust in the face of future devices.
Ref: https://github.com/linuxwacom/input-wacom/issues/134
Fixes: f85c9dc678 ("HID: wacom: generic: Support tool ID and additional tool types")
CC: <stable@vger.kernel.org> # v4.10+
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-quirks.c')
0 files changed, 0 insertions, 0 deletions