Skip to content

Commit ab41a31

Browse files
flying-elephantJiri Kosina
authored andcommitted
HID: wacom: generic: Avoid reporting a serial of '0' to userspace
The xf86-input-wacom driver does not treat '0' as a valid serial number and will drop any input report which contains an MSC_SERIAL = 0 event. The kernel driver already takes care to avoid sending any MSC_SERIAL event if the value of serial[0] == 0 (which is the case for devices that don't actually report a serial number), but this is not quite sufficient. Only the lower 32 bits of the serial get reported to userspace, so if this portion of the serial is zero then there can still be problems. This commit allows the driver to report either the lower 32 bits if they are non-zero or the upper 32 bits otherwise. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com> Fixes: f85c9dc ("HID: wacom: generic: Support tool ID and additional tool types") CC: stable@vger.kernel.org # v4.10 Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent bdab6c9 commit ab41a31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/hid/wacom_wac.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,14 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
25752575
wacom_wac->hid_data.tipswitch);
25762576
input_report_key(input, wacom_wac->tool[0], sense);
25772577
if (wacom_wac->serial[0]) {
2578-
input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]);
2578+
/*
2579+
* xf86-input-wacom does not accept a serial number
2580+
* of '0'. Report the low 32 bits if possible, but
2581+
* if they are zero, report the upper ones instead.
2582+
*/
2583+
__u32 serial_lo = wacom_wac->serial[0] & 0xFFFFFFFFu;
2584+
__u32 serial_hi = wacom_wac->serial[0] >> 32;
2585+
input_event(input, EV_MSC, MSC_SERIAL, (int)(serial_lo ? serial_lo : serial_hi));
25792586
input_report_abs(input, ABS_MISC, sense ? id : 0);
25802587
}
25812588

0 commit comments

Comments
 (0)