File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 66from blinkstick .constants import VENDOR_ID , PRODUCT_ID
77from blinkstick .backends .base import BaseBackend
88from blinkstick .devices import BlinkStickDevice
9- from blinkstick .exceptions import BlinkStickException
9+ from blinkstick .exceptions import BlinkStickException , USBBackendNotAvailable
1010from blinkstick .models import SerialDetails
1111
1212
@@ -38,10 +38,17 @@ def _refresh_attached_blinkstick_device(self):
3838 def get_attached_blinkstick_devices (
3939 find_all : bool = True ,
4040 ) -> list [BlinkStickDevice [usb .core .Device ]]:
41- raw_devices = (
42- usb .core .find (find_all = find_all , idVendor = VENDOR_ID , idProduct = PRODUCT_ID )
43- or []
44- )
41+ try :
42+ raw_devices = (
43+ usb .core .find (
44+ find_all = find_all , idVendor = VENDOR_ID , idProduct = PRODUCT_ID
45+ )
46+ or []
47+ )
48+ except usb .core .NoBackendError :
49+ raise USBBackendNotAvailable (
50+ "Could not find USB backend. Is libusb installed?"
51+ )
4552 return [
4653 # TODO: refactor this to DRY up the usb.util.get_string calls
4754 BlinkStickDevice (
You can’t perform that action at this time.
0 commit comments