Skip to content

add the call to the CancelIo function #755

@jianweihao

Description

@jianweihao

https://github.com/libusb/hidapi/blob/f18d2c0768bed300d13758dd9f52b57163c0498f/windows/hid.c#L1129C3-L1133C4

This piece of if-judgment code needs to add the call to the CancelIo function. Otherwise, after WaitForSingleObject times out and returns, WriteFile may fail with a certain probability and keep being stuck in the IO_PENDING state. It is necessary to add the CancelIo operation to continue sending data normally.

eg :

	if (res != WAIT_OBJECT_0) {
		/* There was a Timeout. */
		CancelIo(dev->device_handle);   // add function
		register_winapi_error(dev, L"hid_write/WaitForSingleObject");
		goto end_of_function;
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    WindowsRelated to Windows backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions