Windows: Improve enumeration process
authorChris Dickens <christopher.a.dickens@gmail.com>
Wed, 3 Jan 2018 21:53:56 +0000 (13:53 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Wed, 3 Jan 2018 21:53:56 +0000 (13:53 -0800)
commitc74dce858335d87ae07e2eceb7c166fa275bc8fe
treeb26349c5e30faf6b849a400225a4cad9d8c15fda
parent8d248ab899e286aefa73c5700a23b3585d17b916
Windows: Improve enumeration process

Prior to this commit, there were some limitations and inefficiencies
during the enmeration process.

First, the maximum number of device interface GUIDs that could be
enumerated was fixed at 64. This limit has been removed and the list
of GUIDs is dynamically resized as new ones are encountered. Logic has
also been added to detect the presence of duplicate GUIDs in order to
speed up the enumeration process.

Next, when searching for device interface GUIDs, only the
"DeviceInterfaceGUIDs" registry key was being consulted. Now we will
also consider "DeviceInterfaceGUID" in order to support devices that
have the GUID listed under this key (such as some WCID devices).

Finally, there used to be a static list of USB PnP enumerator strings
that were used to detect devices during the GENeric enumeration pass. In
many cases, this is wasteful as these enumerators are only present with
very specific hardware. To improve this, we now keep track of the USB
PnP enumerator string encountered as we enumerate the hubs. This allows
the enumeration process to only search for devices that could possibly
be present on the system given the hardware and drivers that were
encountered.

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