Showing that we should probably not queue reports in this mode.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index cdb19808fcd..7f933df3b06 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -2174,6 +2174,40 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle "expected different report\n" ); ok( !memcmp( report, buffer, caps.InputReportByteLength ), "expected identical reports\n" );
+ value = 10; + SetLastError( 0xdeadbeef ); + ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &value, sizeof(ULONG), NULL, NULL ); + ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() ); + + Sleep( 600 ); + + SetLastError( 0xdeadbeef ); + ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped ); + todo_wine + ok( !ret, "ReadFile succeeded\n" ); + todo_wine + ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() ); + + SetLastError( 0xdeadbeef ); + ret = ReadFile( async_file, buffer, caps.InputReportByteLength, NULL, &overlapped2 ); + todo_wine + ok( !ret, "ReadFile succeeded\n" ); + todo_wine + ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() ); + + /* wait for second report to be ready */ + ret = GetOverlappedResult( async_file, &overlapped2, &value, TRUE ); + ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() ); + ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n", + value, (report_id ? 3 : 4) ); + /* first report should be ready and the same */ + ret = GetOverlappedResult( async_file, &overlapped, &value, FALSE ); + ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() ); + ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n", + value, (report_id ? 3 : 4) ); + todo_wine + ok( !memcmp( report, buffer, caps.InputReportByteLength ), "expected identical reports\n" ); + CloseHandle( overlapped.hEvent ); CloseHandle( overlapped2.hEvent ); }
Otherwise it's pointless to have it configurable.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hidclass.sys/device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 29b9215aa22..d588970150e 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -313,9 +313,9 @@ static DWORD CALLBACK hid_device_thread(void *args) BASE_DEVICE_EXTENSION *ext = device->DeviceExtension; HIDP_COLLECTION_DESC *desc = ext->u.pdo.device_desc.CollectionDesc; BOOL polled = ext->u.pdo.information.Polled; - ULONG report_id = 0, timeout = 0; HIDP_REPORT_IDS *report; HID_XFER_PACKET *packet; + ULONG report_id = 0; IO_STATUS_BLOCK io; BYTE *buffer; DWORD res; @@ -324,8 +324,6 @@ static DWORD CALLBACK hid_device_thread(void *args) buffer = (BYTE *)(packet + 1); packet->reportBuffer = buffer;
- if (polled) timeout = ext->u.pdo.poll_interval; - report = find_report_with_type_and_id( ext, HidP_Input, 0, TRUE ); if (!report) WARN("no input report found.\n"); else report_id = report->ReportID; @@ -356,7 +354,7 @@ static DWORD CALLBACK hid_device_thread(void *args) hid_device_queue_input( device, packet ); }
- res = WaitForSingleObject(ext->u.pdo.halt_event, timeout); + res = WaitForSingleObject(ext->u.pdo.halt_event, polled ? ext->u.pdo.poll_interval : 0); } while (res == WAIT_TIMEOUT);
TRACE("device thread exiting, res %#x\n", res);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 5 ----- dlls/hidclass.sys/device.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 7f933df3b06..a2719f65488 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -2183,16 +2183,12 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
SetLastError( 0xdeadbeef ); ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped ); - todo_wine ok( !ret, "ReadFile succeeded\n" ); - todo_wine ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
SetLastError( 0xdeadbeef ); ret = ReadFile( async_file, buffer, caps.InputReportByteLength, NULL, &overlapped2 ); - todo_wine ok( !ret, "ReadFile succeeded\n" ); - todo_wine ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
/* wait for second report to be ready */ @@ -2205,7 +2201,6 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() ); ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n", value, (report_id ? 3 : 4) ); - todo_wine ok( !memcmp( report, buffer, caps.InputReportByteLength ), "expected identical reports\n" );
CloseHandle( overlapped.hEvent ); diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index d588970150e..fb21e230ec4 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -264,7 +264,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack KeAcquireSpinLock( &ext->u.pdo.queues_lock, &irql ); LIST_FOR_EACH_ENTRY( queue, &ext->u.pdo.queues, struct hid_queue, entry ) { - hid_queue_push_report( queue, last_report ); + if (!polled) hid_queue_push_report( queue, last_report );
do {