Merge pull request #1 from Elktro/master

Add try-catch for USB device set_configuration()
This commit is contained in:
Ted Morin 2021-04-13 13:53:52 -07:00 • committed by GitHub
commit f343d16767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -403,7 +403,11 @@ else:
return self._connected
# Copy the default configuration.
usb_device.set_configuration()
try:
usb_device.set_configuration()
except core.USBError as e:
log.warning('Error connecting: %s', e)
self._error()
config = usb_device.get_active_configuration()
interface = config[(0, 0)]

0
setup.py Normal file → Executable file
View file