Rémi Bernon : hidclass.sys: Complete all pending reads in polled mode only.

Alexandre Julliard julliard at winehq.org
Tue Sep 14 16:00:13 CDT 2021


Module: wine
Branch: master
Commit: 46f3ca4919f2834eb349607324bb31b92d5625ff
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=46f3ca4919f2834eb349607324bb31b92d5625ff

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Sep 14 10:38:43 2021 +0200

hidclass.sys: Complete all pending reads in polled mode only.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput8/tests/hid.c   | 4 ----
 dlls/hidclass.sys/device.c | 5 ++++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index 5745fcedad3..86e878d5ecb 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -2194,9 +2194,7 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         /* second read should still be pending */
         Sleep( 50 );
         ret = GetOverlappedResult( async_file, &overlapped2, &value, FALSE );
-        todo_wine
         ok( !ret, "GetOverlappedResult succeeded\n" );
-        todo_wine
         ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %u\n", GetLastError() );
 
         memset( buffer + caps.InputReportByteLength, 0x3b, 5 );
@@ -2211,11 +2209,9 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         ok( value == caps.InputReportByteLength, "got length %u, expected %u\n", value, caps.InputReportByteLength );
 
         off = report_id ? 0 : 1;
-        todo_wine
         ok( memcmp( report, buffer, caps.InputReportByteLength ), "expected different report\n" );
         ok( !memcmp( report + off, report + caps.InputReportByteLength, caps.InputReportByteLength - off ),
             "expected identical reports\n" );
-        todo_wine
         ok( !memcmp( buffer + off, buffer + caps.InputReportByteLength, caps.InputReportByteLength - off ),
             "expected identical reports\n" );
 
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index b9b31045297..8e998bd71be 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -182,6 +182,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
 {
     BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
     HIDP_COLLECTION_DESC *desc = ext->u.pdo.device_desc.CollectionDesc;
+    const BOOL polled = ext->u.pdo.information.Polled;
     struct hid_report *last_report, *report;
     struct hid_report_queue *queue;
     RAWINPUT *rawinput;
@@ -223,8 +224,9 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
     hid_report_queue_push( queue, last_report );
     KeReleaseSpinLock( &ext->u.pdo.report_queues_lock, irql );
 
-    while ((irp = pop_irp_from_queue( ext )))
+    do
     {
+        if (!(irp = pop_irp_from_queue( ext ))) break;
         queue = irp->Tail.Overlay.OriginalFileObject->FsContext;
 
         if (!(report = hid_report_queue_pop( queue ))) hid_report_incref( (report = last_report) );
@@ -235,6 +237,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
 
         IoCompleteRequest( irp, IO_NO_INCREMENT );
     }
+    while (polled);
 
     hid_report_decref( last_report );
 }




More information about the wine-cvs mailing list