Improve JUC500 device discovery and Windows doctor diagnostics
Widen libusb DLL search, copy DLL into venv on setup, match sibling PIDs, and add doctor command with PnP VID_0711 hints for WinUSB. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+32
-3
@@ -10,7 +10,7 @@ from pathlib import Path
|
||||
|
||||
from . import __version__
|
||||
from .protocol import Session
|
||||
from .usb_link import list_devices, Juc500Link
|
||||
from .usb_link import list_devices, Juc500Link, doctor
|
||||
|
||||
|
||||
def _progress(prefix: str):
|
||||
@@ -34,13 +34,39 @@ def _progress(prefix: str):
|
||||
def cmd_info(_args: argparse.Namespace) -> int:
|
||||
devices = list_devices()
|
||||
if not devices:
|
||||
print("연결된 JUC500 장치가 없습니다.")
|
||||
print("연결된 JUC500 장치가 없습니다. 진단: python -m juc500_xfer doctor")
|
||||
return 1
|
||||
for d in devices:
|
||||
print(f"bus={d.bus} addr={d.address} serial={d.serial!r} product={d.product!r}")
|
||||
print(
|
||||
f"{d.vid:04x}:{d.pid:04x} bus={d.bus} addr={d.address} "
|
||||
f"serial={d.serial!r} product={d.product!r}"
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_doctor(_args: argparse.Namespace) -> int:
|
||||
rep = doctor()
|
||||
print(f"libusb: {rep.libusb_path or '(없음)'}")
|
||||
if rep.libusb_error:
|
||||
print(f"libusb 오류: {rep.libusb_error}")
|
||||
print(f"USB 장치 수(libusb): {rep.usb_device_count}")
|
||||
print(f"JUC500 후보: {len(rep.juc500)}")
|
||||
for j in rep.juc500:
|
||||
print(f" - {j}")
|
||||
if rep.sample_devices:
|
||||
print("USB 샘플:")
|
||||
for line in rep.sample_devices:
|
||||
print(f" {line}")
|
||||
if rep.pnp_vid0711:
|
||||
print("Windows PnP VID_0711:")
|
||||
for row in rep.pnp_vid0711:
|
||||
print(f" - {row}")
|
||||
print("안내:")
|
||||
for h in rep.hints:
|
||||
print(f" * {h}")
|
||||
return 0 if rep.ok else 1
|
||||
|
||||
|
||||
def cmd_probe(args: argparse.Namespace) -> int:
|
||||
with Juc500Link(serial=args.serial) as link:
|
||||
print(f"열림: serial={link.serial!r}")
|
||||
@@ -114,6 +140,9 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
s = sub.add_parser("info", help="연결된 JUC500 장치 목록")
|
||||
s.set_defaults(func=cmd_info)
|
||||
|
||||
s = sub.add_parser("doctor", help="USB/libusb/WinUSB 진단")
|
||||
s.set_defaults(func=cmd_doctor)
|
||||
|
||||
s = sub.add_parser("probe", help="USB 인터페이스 점유 및 송수신 프로브")
|
||||
s.add_argument("--serial", default=None)
|
||||
s.set_defaults(func=cmd_probe)
|
||||
|
||||
Reference in New Issue
Block a user