From 0cff44dbd46e9ad19cf03856c4819f49d0f5e296 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 1 Jun 2023 07:27:51 -0700
Subject: [PATCH] Updated with upstream suggestions in
https://github.com/libusb/hidapi/pull/577
---
src/hidapi/windows/hid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c
index 0ddc40d03f77..bf989b77e05e 100644
--- a/src/hidapi/windows/hid.c
+++ b/src/hidapi/windows/hid.c
@@ -1234,7 +1234,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
res = WaitForSingleObject(ev, milliseconds >= 0 ? (DWORD)milliseconds : INFINITE);
if (res != WAIT_OBJECT_0) {
/* There was no data this time. Return zero bytes available,
- but leave the Overlapped I/O running. */
+ but leave the Overlapped I/O running. */
return 0;
}
@@ -1242,7 +1242,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
array which was passed to ReadFile(). We must not wait here because we've
already waited on our event above, and since it's auto-reset, it will have
been reset back to unsignalled by now. */
- res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, FALSE/*don't wait*/);
+ res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, FALSE/*don't wait now - already did on the prev step*/);
}
/* Set pending back to false, even if GetOverlappedResult() returned error. */
dev->read_pending = FALSE;