Skip to content

Commit 84aecf2

Browse files
jigpuJiri Kosina
authored andcommitted
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 <[email protected]> Tested-by: Joshua Dickens <[email protected]> Fixes: 6d09085 ("HID: wacom: Adding Support for new usages") Signed-off-by: Jiri Kosina <[email protected]>
1 parent 359673e commit 84aecf2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/hid/wacom_wac.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2386,6 +2386,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
23862386
wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS3, 0);
23872387
features->quirks &= ~WACOM_QUIRK_PEN_BUTTON3;
23882388
break;
2389+
case WACOM_HID_WD_SEQUENCENUMBER:
2390+
wacom_wac->hid_data.sequence_number = -1;
2391+
break;
23892392
}
23902393
}
23912394

@@ -2510,7 +2513,8 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
25102513
wacom_wac->hid_data.barrelswitch3 = value;
25112514
return;
25122515
case WACOM_HID_WD_SEQUENCENUMBER:
2513-
if (wacom_wac->hid_data.sequence_number != value) {
2516+
if (wacom_wac->hid_data.sequence_number != value &&
2517+
wacom_wac->hid_data.sequence_number >= 0) {
25142518
int sequence_size = field->logical_maximum - field->logical_minimum + 1;
25152519
int drop_count = (value - wacom_wac->hid_data.sequence_number) % sequence_size;
25162520
hid_warn(hdev, "Dropped %d packets", drop_count);

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ struct hid_data {
326326
int bat_connected;
327327
int ps_connected;
328328
bool pad_input_event_flag;
329-
unsigned short sequence_number;
329+
int sequence_number;
330330
ktime_t time_delayed;
331331
};
332332

0 commit comments

Comments
 (0)