From 64d892eea0828bf8e0c260a2d3768aaf5e19aa2c Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Mon, 8 Jan 2024 14:35:50 -0600 Subject: [PATCH] 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 --- gp2040ce_bintools/rp2040.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gp2040ce_bintools/rp2040.py b/gp2040ce_bintools/rp2040.py index 0239f2b..dc766c2 100644 --- a/gp2040ce_bintools/rp2040.py +++ b/gp2040ce_bintools/rp2040.py @@ -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