webusb: check if a device is functional when enumerating

this fixes issue #223 on Windows, where a device would be returned in two copies, only one of which works
This commit is contained in:
matejcik 2018-03-06 13:28:26 +01:00
parent f75b90d260
commit 9f2583f893
1 changed files with 10 additions and 1 deletions

View File

@ -101,7 +101,16 @@ class WebUsbTransport(Transport):
continue
if not is_vendor_class(dev):
continue
devices.append(WebUsbTransport(dev))
try:
# workaround for issue #223:
# on certain combinations of Windows USB drivers and libusb versions,
# Trezor is returned twice (possibly because Windows know it as both
# a HID and a WebUSB device), and one of the returned devices is
# non-functional.
dev.getProduct()
devices.append(WebUsbTransport(dev))
except usb1.USBErrorNotSupported:
pass
return devices
def find_debug(self):