Skip to content

Commit 2a629ef

Browse files
committed
fix(coral-tpu): automate UsbDk driver installation and refine detection
1 parent 38bf4aa commit 2a629ef

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

skills/detection/yolo-detection-2026-coral-tpu/deploy.bat

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,13 @@ echo {"event": "progress", "stage": "platform", "message": "Edge TPU DLLs ready.
101101

102102
REM ── Install UsbDk Driver (bundled MSI, required for Coral TPU on Windows)
103103
if exist "%SKILL_DIR%driver\UsbDk_1.0.22_x64.msi" (
104-
set "TMP_DIR=%TEMP%\coral_drv_%RANDOM%"
105-
mkdir "%TMP_DIR%"
106-
echo @echo off > "%TMP_DIR%\install_coral_driver.bat"
107-
echo start /wait "" msiexec /i "%SKILL_DIR%driver\UsbDk_1.0.22_x64.msi" /qn /norestart >> "%TMP_DIR%\install_coral_driver.bat"
108-
109-
echo %LOG_PREFIX% Prompting for Administrator rights to install Coral UsbDk driver... 1>&2
110-
echo {"event": "progress", "stage": "platform", "message": "A UAC prompt will appear. Approve it to install the Coral USB driver (UsbDk)."}
111-
112-
powershell -NoProfile -Command "Start-Process cmd.exe -ArgumentList '/c \"%TMP_DIR%\install_coral_driver.bat\"' -Verb RunAs -Wait" 2>nul
113-
114-
if %errorlevel% neq 0 (
115-
echo %LOG_PREFIX% UAC declined - hardware TPU driver not installed. CPU fallback available. 1>&2
116-
echo {"event": "progress", "stage": "platform", "message": "UAC skipped. CPU fallback available. Reinstall and approve UAC to enable hardware TPU."}
117-
) else (
118-
echo %LOG_PREFIX% Coral UsbDk driver installed. 1>&2
119-
echo {"event": "progress", "stage": "platform", "message": "Coral UsbDk driver installed. Unplug and replug your Coral USB Accelerator to activate."}
120-
)
121-
122-
rmdir /S /Q "%TMP_DIR%" 2>nul
104+
echo %LOG_PREFIX% Emitting Pause Modal for explicit driver installation... 1>&2
105+
echo {"event": "progress", "stage": "platform", "message": "Waiting for User to install UsbDk Driver..."}
106+
echo [AEGIS_PAUSE_MODAL] file=driver\UsbDk_1.0.22_x64.msi; msg=Google Coral TPU Requires the UsbDk system driver to run over USB. Click 'Launch Installer' to proceed.
107+
set /p "DUMMY_VAR=Press ENTER to continue deploy after installing UsbDk..."
108+
109+
echo %LOG_PREFIX% Continued deployment. Assuming UsbDk driver was installed. 1>&2
110+
echo {"event": "progress", "stage": "platform", "message": "Driver installation complete. Unplug and replug your Coral USB Accelerator to activate."}
123111
) else (
124112
echo %LOG_PREFIX% WARNING: UsbDk MSI not found in driver\. Skipping driver install. 1>&2
125113
)

skills/detection/yolo-detection-2026-coral-tpu/scripts/detect.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323
# Python 3.8+ no longer searches PATH for DLLs loaded by native C extensions.
2424
# We must register our local lib/ directory so that when ai_edge_litert loads
2525
# edgetpu.dll, Windows can also find libusb-1.0.dll in the same folder.
26+
# Native delegates loaded via C++ LoadLibrary also bypass Python's DLL directory,
27+
# so we must append it to the system PATH environment variable as well.
2628
_LIB_DIR = Path(__file__).parent.parent / "lib"
2729
if sys.platform == "win32" and _LIB_DIR.exists():
2830
os.add_dll_directory(str(_LIB_DIR))
31+
os.environ["PATH"] = str(_LIB_DIR) + os.pathsep + os.environ.get("PATH", "")
2932

3033
import numpy as np
3134
from PIL import Image

0 commit comments

Comments
 (0)