Skip to content

Commit 1a42177

Browse files
committed
header: Clarify comment on hid_read() and hid_read_timeout()
Clarify that a return value of zero means no packet was available.
1 parent 40cf516 commit 1a42177

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hidapi/hidapi.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ extern "C" {
218218
219219
@returns
220220
This function returns the actual number of bytes read and
221-
-1 on error.
221+
-1 on error. If no packet was available to be read within
222+
the timeout period, this function returns 0.
222223
*/
223224
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
224225

@@ -237,7 +238,8 @@ extern "C" {
237238
238239
@returns
239240
This function returns the actual number of bytes read and
240-
-1 on error.
241+
-1 on error. If no packet was available to be read and
242+
the handle is in non-blocking mode, this function returns 0.
241243
*/
242244
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
243245

0 commit comments

Comments
 (0)