Add Wormhole auto-kill so Interface 5 can be claimed
Cable autorun holds IF5; kill on launch/connect and via GUI button/CLI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+19
-1
@@ -203,7 +203,7 @@ def _claim_failure_message(ifnum: int, exc: BaseException) -> str:
|
||||
f"{base}\n\n"
|
||||
"Windows가 Interface 5를 다른 드라이버(공식 Wormhole 등)로 붙잡고 있습니다.\n"
|
||||
"아래를 순서대로 하세요:\n"
|
||||
"1) 작업 관리자에서 Wormhole / SmartDataLink / j5create 관련 프로그램 모두 종료\n"
|
||||
"1) GUI의 'Wormhole 종료' 버튼 또는 `python -m juc500_xfer kill-wormhole`\n"
|
||||
"2) Zadig(https://zadig.akeo.ie/) 실행 (관리자)\n"
|
||||
"3) Options → List All Devices\n"
|
||||
"4) 목록에서 'Smart Data Link (Interface 5)' 또는 InstanceId에 MI_05 가 있는 항목 선택\n"
|
||||
@@ -464,6 +464,24 @@ class Juc500Link:
|
||||
try:
|
||||
usb.util.claim_interface(self._dev, ifnum)
|
||||
except usb.core.USBError as exc:
|
||||
# Official Wormhole often holds IF5 — kill and retry once.
|
||||
if _is_access_denied(exc) and ifnum == IF_VENDOR:
|
||||
try:
|
||||
from .wormhole_kill import kill_wormhole_processes
|
||||
|
||||
kill_wormhole_processes(force=True)
|
||||
time.sleep(0.6)
|
||||
if not _IS_WIN:
|
||||
try:
|
||||
if self._dev.is_kernel_driver_active(ifnum):
|
||||
self._dev.detach_kernel_driver(ifnum)
|
||||
except (NotImplementedError, usb.core.USBError):
|
||||
pass
|
||||
usb.util.claim_interface(self._dev, ifnum)
|
||||
self._claimed.append(ifnum)
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
if required:
|
||||
raise RuntimeError(_claim_failure_message(ifnum, exc)) from exc
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user