Skip to content

Commit 5010aed

Browse files
committed
HID: wacom: Do not warn about dropped packets for first packet
The driver currently assumes that the first sequence number it will see is going to be 0. This is not a realiable assumption and can break if, for example, the tablet has already been running for some time prior to the kernel driver connecting to the device. This commit initializes the expected sequence number to -1 and will only print the "Dropped" warning the it has been updated to a non-negative value. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Tested-by: Joshua Dickens <joshua.dickens@wacom.com> Fixes: 6d09085b38e5 ("HID: wacom: Adding Support for new usages") Signed-off-by: Jiri Kosina <jkosina@suse.com> [jason.gerecke@wacom.com: Imported into input-wacom (84aecf2d251a)] Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
1 parent c739e17 commit 5010aed

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

4.18/wacom_wac.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
24132413
wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS3, 0);
24142414
features->quirks &= ~WACOM_QUIRK_PEN_BUTTON3;
24152415
break;
2416+
case WACOM_HID_WD_SEQUENCENUMBER:
2417+
wacom_wac->hid_data.sequence_number = -1;
2418+
break;
24162419
}
24172420
}
24182421

@@ -2537,7 +2540,8 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
25372540
wacom_wac->hid_data.barrelswitch3 = value;
25382541
return;
25392542
case WACOM_HID_WD_SEQUENCENUMBER:
2540-
if (wacom_wac->hid_data.sequence_number != value) {
2543+
if (wacom_wac->hid_data.sequence_number != value &&
2544+
wacom_wac->hid_data.sequence_number >= 0) {
25412545
int sequence_size = field->logical_maximum - field->logical_minimum + 1;
25422546
int drop_count = (value - wacom_wac->hid_data.sequence_number) % sequence_size;
25432547
hid_warn(hdev, "Dropped %d packets", drop_count);

4.18/wacom_wac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ struct hid_data {
353353
int bat_connected;
354354
int ps_connected;
355355
bool pad_input_event_flag;
356-
unsigned short sequence_number;
356+
int sequence_number;
357357
#ifdef WACOM_INPUT_SET_TIMESTAMP
358358
ktime_t time_delayed;
359359
#endif

0 commit comments

Comments
 (0)