ignore libusb NotImplementedError when detaching the driver

this is not meaningful (or possible) on Windows, so we can just ignore
it and move on

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
Brian S. Stephan 2024-01-08 14:35:50 -06:00
parent 933e44566c
commit 64d892eea0
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
1 changed files with 6 additions and 2 deletions

View File

@ -56,8 +56,12 @@ def get_bootsel_endpoints() -> tuple[usb.core.Endpoint, usb.core.Endpoint]:
if not pico_device:
raise ValueError("RP2040 board in BOOTSEL mode could not be found!")
if pico_device.is_kernel_driver_active(0):
pico_device.detach_kernel_driver(0)
try:
if pico_device.is_kernel_driver_active(0):
pico_device.detach_kernel_driver(0)
except NotImplementedError:
# detaching the driver is for *nix, not possible/relevant on Windows
pass
pico_configuration = pico_device.get_active_configuration()
# two interfaces are present, we want the direct rather than mass storage