summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJason Gerecke <jason.gerecke@wacom.com>2024-09-09 22:32:08 +0200
committerJiri Kosina <jkosina@suse.com>2024-09-10 23:47:03 +0200
commit84aecf2d251a3359bc78b7c8e58f54b9fc966e89 (patch)
tree1cd00ca3a488e7dba426fa77157c848800b81ebe /drivers/hid
parentHID: wacom: Support sequence numbers smaller than 16-bit (diff)
downloadlinux-84aecf2d251a3359bc78b7c8e58f54b9fc966e89.tar.xz
linux-84aecf2d251a3359bc78b7c8e58f54b9fc966e89.zip
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/wacom_wac.c6
-rw-r--r--drivers/hid/wacom_wac.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 22b0d281ff5c..b7129cc7c6bf 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2386,6 +2386,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS3, 0);
features->quirks &= ~WACOM_QUIRK_PEN_BUTTON3;
break;
+ case WACOM_HID_WD_SEQUENCENUMBER:
+ wacom_wac->hid_data.sequence_number = -1;
+ break;
}
}
@@ -2510,7 +2513,8 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
wacom_wac->hid_data.barrelswitch3 = value;
return;
case WACOM_HID_WD_SEQUENCENUMBER:
- if (wacom_wac->hid_data.sequence_number != value) {
+ if (wacom_wac->hid_data.sequence_number != value &&
+ wacom_wac->hid_data.sequence_number >= 0) {
int sequence_size = field->logical_maximum - field->logical_minimum + 1;
int drop_count = (value - wacom_wac->hid_data.sequence_number) % sequence_size;
hid_warn(hdev, "Dropped %d packets", drop_count);
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 55e0c7a9fdcb..c8803d5c6a71 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -326,7 +326,7 @@ struct hid_data {
int bat_connected;
int ps_connected;
bool pad_input_event_flag;
- unsigned short sequence_number;
+ int sequence_number;
ktime_t time_delayed;
};