From 868a3ffb50720748b3bc156a7962d4ddc8efd6c4 Mon Sep 17 00:00:00 2001 From: dmitrii-f-t27 Date: Sat, 10 Oct 2026 19:33:24 -0300 Subject: [PATCH] tools/jtag: libftdi from $T27_LIBFTDI or the platform default, so B2 reads on Linux (Closes #7927) mpsse_jtag.py loaded libftdi from the fixed Homebrew path, so stage B2 of t27c silicon (read_verdict.py) failed on Linux without a symlink (#7906). LIB is now $T27_LIBFTDI when set; else /opt/homebrew/lib/libftdi1.2.dylib on macOS (unchanged); else ctypes.util.find_library("ftdi1") or libftdi1.so.2. 3 lines in, 3 lines out: the file is listed in tools/policy/foreign-exceptions.txt (#7928) and foreign code does not grow. Closes #7927 --- tools/jtag/mpsse_jtag.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/jtag/mpsse_jtag.py b/tools/jtag/mpsse_jtag.py index 42f847302b..bc7e046e67 100644 --- a/tools/jtag/mpsse_jtag.py +++ b/tools/jtag/mpsse_jtag.py @@ -15,9 +15,9 @@ and a wrong one cannot be mistaken for success. That is lesson 429: compare against a case whose right answer you already have. """ -import ctypes, sys, time - -LIB = "/opt/homebrew/lib/libftdi1.2.dylib" +import ctypes, ctypes.util, os, sys, time +# libftdi1: $T27_LIBFTDI if set; else Homebrew on macOS; else the loader search, so B2 reads on Linux (#7927). +LIB = os.environ.get("T27_LIBFTDI") or ("/opt/homebrew/lib/libftdi1.2.dylib" if sys.platform == "darwin" else ctypes.util.find_library("ftdi1") or "libftdi1.so.2") VID, PID = 0x0403, 0x6014 # MPSSE opcodes