Patch "HID: wacom: Support sequence numbers smaller than 16-bit" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    HID: wacom: Support sequence numbers smaller than 16-bit

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hid-wacom-support-sequence-numbers-smaller-than-16-b.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8705e1e803720512cac575202404233f46c98d0b
Author: Jason Gerecke <jason.gerecke@xxxxxxxxx>
Date:   Mon Sep 9 13:32:07 2024 -0700

    HID: wacom: Support sequence numbers smaller than 16-bit
    
    [ Upstream commit 359673ea3a203611b4f6d0f28922a4b9d2cfbcc8 ]
    
    The current dropped packet reporting assumes that all sequence numbers
    are 16 bits in length. This results in misleading "Dropped" messages if
    the hardware uses fewer bits. For example, if a tablet uses only 8 bits
    to store its sequence number, once it rolls over from 255 -> 0, the
    driver will still be expecting a packet "256". This patch adjusts the
    logic to reset the next expected packet to logical_minimum whenever
    it overflows beyond logical_maximum.
    
    Signed-off-by: Jason Gerecke <jason.gerecke@xxxxxxxxx>
    Tested-by: Joshua Dickens <joshua.dickens@xxxxxxxxx>
    Fixes: 6d09085b38e5 ("HID: wacom: Adding Support for new usages")
    Signed-off-by: Jiri Kosina <jkosina@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 5db26a8af7728..c3c576641a38e 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2492,9 +2492,14 @@ 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)
-			hid_warn(hdev, "Dropped %hu packets", (unsigned short)(value - wacom_wac->hid_data.sequence_number));
+		if (wacom_wac->hid_data.sequence_number != value) {
+			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);
+		}
 		wacom_wac->hid_data.sequence_number = value + 1;
+		if (wacom_wac->hid_data.sequence_number > field->logical_maximum)
+			wacom_wac->hid_data.sequence_number = field->logical_minimum;
 		return;
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux