Windows: Improve how root hubs are reported
authorChris Dickens <christopher.a.dickens@gmail.com>
Mon, 17 Aug 2020 21:15:10 +0000 (14:15 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Mon, 17 Aug 2020 21:15:10 +0000 (14:15 -0700)
commitd42410b21c4314143f31fd7f8494dd1d4c279663
tree3794d2e69c47b9b31ef56a36c7ff11d2b83ccad1
parentaa6ec9d92e9109510650d121db7cc7bee76638a0
Windows: Improve how root hubs are reported

Microsoft provides very little information about the actual root hub
characterstics beyond the number of ports. Determining the maximum
supported speed of the root hub is not directly possible but instead
requires that a device matching the highest speed of the root hub is
connected. Additionally, Windows 8 or later is required for _any_
successful detection of SuperSpeed devices.

One other inconvenience is that there are no descriptors exposed for
root hubs. This does not fit well with the structure of the library
because root hubs are considered first-class devices.

This change addresses some of these shortcomings. Each root hub is now
given a configuration descriptor that is matched to the fastest speed
detected for the root hub. The information is most accurate on Windows 8
or later, but the best information possible is constructed on earlier
versions. The device descriptor is also adjusted accordingly based on
the detected speed.

This solution is not perfect but is better than the status quo.

Closes #688

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