File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 66import usb .backend .libusb1
77
88def main ():
9+ # Test get_library_path().
10+ path = libusb_package .get_library_path ()
11+ print (f"Path to included library: { path } " )
12+
13+ # Test find_library().
914 libusb1_backend = usb .backend .libusb1 .get_backend (find_library = libusb_package .find_library )
1015 if not libusb1_backend :
1116 print ("Unable to load libusb backend!" )
1217 sys .exit (1 )
1318 print (f"libusb1_backend = { libusb1_backend } " )
1419
15- # Use pyusb directly with the loaded backend .
20+ # Test get_libusb1_backend() .
1621 print ("usb.core.show_devices output:" )
17- usb .core .show_devices (backend = libusb1_backend )
22+ print ( usb .core .show_devices (backend = libusb_package . get_libusb1_backend ()) )
1823
1924 # Try out the find() wrapper.
2025 print ("libusb_package.find output:" )
2126 for dev in libusb_package .find (find_all = True ):
22- print (dev )
27+ try :
28+ print (f"{ dev .idVendor :04x} :{ dev .idProduct :04x} : { dev .manufacturer } { dev .product } ({ dev .serial_number } )" )
29+ except Exception as err :
30+ print (f"{ dev .idVendor :04x} :{ dev .idProduct :04x} : error reading strings ({ err } )" )
2331
2432if __name__ == "__main__" :
2533 main ()
You can’t perform that action at this time.
0 commit comments