hidclass.sys: Only drop input reports when length is too short.
And add some warnings when we do. This otherwise makes the effect state reports from the tests to be always dropped as they are shorter than the returned length, which is the read buffer size and the maximum input report length. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b431dceeca
commit
c2f473d6c4
|
@ -322,7 +322,6 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||||
|
|
||||||
packet = malloc( sizeof(*packet) + desc->InputLength );
|
packet = malloc( sizeof(*packet) + desc->InputLength );
|
||||||
buffer = (BYTE *)(packet + 1);
|
buffer = (BYTE *)(packet + 1);
|
||||||
packet->reportBuffer = buffer;
|
|
||||||
|
|
||||||
report = find_report_with_type_and_id( ext, HidP_Input, 0, TRUE );
|
report = find_report_with_type_and_id( ext, HidP_Input, 0, TRUE );
|
||||||
if (!report) WARN("no input report found.\n");
|
if (!report) WARN("no input report found.\n");
|
||||||
|
@ -331,6 +330,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
packet->reportId = buffer[0] = report_id;
|
packet->reportId = buffer[0] = report_id;
|
||||||
|
packet->reportBuffer = buffer;
|
||||||
packet->reportBufferLen = desc->InputLength;
|
packet->reportBufferLen = desc->InputLength;
|
||||||
|
|
||||||
if (!report_id)
|
if (!report_id)
|
||||||
|
@ -345,14 +345,18 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||||
if (io.Status == STATUS_SUCCESS)
|
if (io.Status == STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
if (!report_id) io.Information++;
|
if (!report_id) io.Information++;
|
||||||
|
if (!(report = find_report_with_type_and_id( ext, HidP_Input, buffer[0], FALSE )))
|
||||||
|
WARN( "dropping unknown input id %u\n", buffer[0] );
|
||||||
|
else if (!polled && io.Information < report->InputLength)
|
||||||
|
WARN( "dropping short report, len %u expected %u\n", (ULONG)io.Information, report->InputLength );
|
||||||
|
else
|
||||||
|
{
|
||||||
packet->reportId = buffer[0];
|
packet->reportId = buffer[0];
|
||||||
packet->reportBuffer = buffer;
|
packet->reportBuffer = buffer;
|
||||||
packet->reportBufferLen = io.Information;
|
packet->reportBufferLen = io.Information;
|
||||||
|
|
||||||
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 );
|
hid_device_queue_input( device, packet );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res = WaitForSingleObject(ext->u.pdo.halt_event, polled ? ext->u.pdo.poll_interval : 0);
|
res = WaitForSingleObject(ext->u.pdo.halt_event, polled ? ext->u.pdo.poll_interval : 0);
|
||||||
} while (res == WAIT_TIMEOUT);
|
} while (res == WAIT_TIMEOUT);
|
||||||
|
|
Loading…
Reference in New Issue