greatscottgadgets / apollo

microcontroller-based FPGA / JTAG programmer
BSD 3-Clause "New" or "Revised" License
54 stars 28 forks source link

On Windows, create the libusb1 backend explicitly by specifying the installed location of libusb-1.0.dll #101

Closed antoinevg closed 1 week ago

antoinevg commented 2 weeks ago

On Windows the usb1 Python package installs the libusb1 dll within the usb1 module directory but can not locate it to create a backend unless the module directory is added to the system PATH environment variable.

This PR modifies the ApolloDebugger._find_device() static method to, on Windows, obtain the backend by passing the location of the installed libusb-1.0.dll to libusb1.get_backend() and then passing that backend to usb.core.find().

This PR also modifies the other usage of usb.core.find() in FlashBridgeConnectionto use ApolloDebugger._find_device() instead.

It's important to note that, for future work on Apollo, the usb.core.find() method should no longer be used if Windows compatibility is to be maintained!

This is a companion PR to the one in Cynthion: https://github.com/greatscottgadgets/cynthion/pull/129