From bd0c541b216820f0f5a7a8d2a700583f96754542 Mon Sep 17 00:00:00 2001 From: mndza Date: Mon, 20 May 2024 16:14:08 +0200 Subject: [PATCH] apollo_fpga: fix handing off USB port to Apollo under Windows --- apollo_fpga/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apollo_fpga/__init__.py b/apollo_fpga/__init__.py index a84612a..07ba0be 100644 --- a/apollo_fpga/__init__.py +++ b/apollo_fpga/__init__.py @@ -7,6 +7,7 @@ import os import time import usb.core +import platform from .jtag import JTAGChain from .spi import DebugSPIConnection @@ -129,6 +130,10 @@ def _request_handoff(cls, device): if stub_if is None: raise DebuggerNotFound("No Apollo stub interface found") + # In Windows, we first need to claim the target interface. + if platform.system() == "Windows": + usb.util.claim_interface(device, stub_if) + # Send the request intf_number = stub_if.bInterfaceNumber REQUEST_APOLLO_ADV_STOP = 0xF0