Module: wine
Branch: master
Commit: 51ae926240f05ac6fe3538728aec1e65ad7abf2c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=51ae926240f05ac6fe353872…
Author: Rémi Bernon <rbernon(a)codeweavers.com>
Date: Mon Oct 4 10:20:19 2021 +0200
hidclass.sys: Overwrite queued reports as FIFO instead of LIFO.
Based on a patch from Ivo Ivanov <logos128(a)gmail.com>.
The issue causes severe skipping and non smooth movement tracking in
apps/games, when the HidP/HidD APIs are used to control the device
(joysticks, controllers, steering wheels, etc.).
Usually such devices use constant stream of INPUT reports to report
their coords, so any report skipping or change of the sequence,
when the interested apps are reading, would lead to such issues.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/hidclass.sys/device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index e4592c4d242..cebdc3e1e65 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -190,10 +190,12 @@ static void hid_queue_push_report( struct hid_queue *queue, struct hid_report *r
KeAcquireSpinLock( &queue->lock, &irql );
prev = queue->reports[i];
queue->reports[i] = report;
- if (next != queue->read_idx) queue->write_idx = next;
+ if (next == queue->read_idx) queue->read_idx = next + 1;
+ if (queue->read_idx >= queue->length) queue->read_idx = 0;
KeReleaseSpinLock( &queue->lock, irql );
hid_report_decref( prev );
+ queue->write_idx = next;
}
static struct hid_report *hid_queue_pop_report( struct hid_queue *queue )
Module: wine
Branch: master
Commit: 9411ecf6707bd40eddca4e21f43e1b09282db7a0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9411ecf6707bd40eddca4e21…
Author: Rémi Bernon <rbernon(a)codeweavers.com>
Date: Mon Oct 4 10:18:14 2021 +0200
hidclass.sys: Drop reports when length doesn't match their declaration.
Based on a patch from Ivo Ivanov <logos128(a)gmail.com>.
Instead of using the descriptor input report length, which is the
maximum length of all input reports.
Tests show that the reports should be dropped, in non-polled mode, when
their length is invalid, but we were dropping too many of them.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51828
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/hidclass.sys/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 6530efcdb84..e4592c4d242 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -349,7 +349,8 @@ static DWORD CALLBACK hid_device_thread(void *args)
packet->reportBuffer = buffer;
packet->reportBufferLen = io.Information;
- if (polled || io.Information == desc->InputLength)
+ report = find_report_with_type_and_id( ext, HidP_Input, buffer[0], FALSE );
+ if (polled || (report && report->InputLength == io.Information))
hid_device_queue_input( device, packet );
}