Windows: Filter out non-libusb I/O completions
authorChris Dickens <christopher.a.dickens@gmail.com>
Sat, 16 Jan 2021 01:18:34 +0000 (17:18 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Sat, 16 Jan 2021 01:18:34 +0000 (17:18 -0800)
commitb51c743e4210756a98f4f60c69a34745e4b27a55
tree7a7a0cb715daa2df22aeba82a805c7e63a455c76
parent08e0029f105de993d798ea902827ae2efe7798a8
Windows: Filter out non-libusb I/O completions

The I/O completion port thread gets notified of every I/O operation that
completes for a given HANDLE, but not all I/O operations originate from
within libusb. For example, libusbK performs a number of I/O control
calls during initialization and specific device operations, such as
setting an interface alternate setting. These non-libusb operations need
to be ignored as the OVERLAPPED associated with such operations is not
tied to a libusb_transfer structure.

Resolve this situation by using the libusb device handle as the I/O
completion port's unique key and keeping a list of active transfers for
each device handle. When the I/O competion port thread is notified of an
I/O completion, it will first match the OVERLAPPED to an outstanding
transfer before acting on it.

Closes #844

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/os/windows_common.c
libusb/os/windows_common.h
libusb/os/windows_usbdk.c
libusb/os/windows_winusb.c
libusb/version_nano.h