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:
@@ -16,7 +16,7 @@ from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
from .protocol import Session
|
||||
from .usb_link import Juc500Link, list_devices
|
||||
from .usb_link import Juc500Link, list_devices, doctor
|
||||
|
||||
DEFAULT_GUI_PORT = 8765
|
||||
|
||||
@@ -398,8 +398,23 @@ class Handler(BaseHTTPRequestHandler):
|
||||
|
||||
def _api_get(self, path: str, qs: dict[str, list[str]]) -> None:
|
||||
if path == "/api/status":
|
||||
devices = list_devices()
|
||||
try:
|
||||
devices = list_devices()
|
||||
list_err = None
|
||||
except Exception as exc: # noqa: BLE001
|
||||
devices = []
|
||||
list_err = str(exc)
|
||||
cable = devices[0] if devices else None
|
||||
if devices:
|
||||
auto = STATE.auto_status if _session_alive() else "케이블 감지됨 — 연결을 누르세요"
|
||||
elif list_err:
|
||||
auto = f"USB 오류: {list_err}"
|
||||
else:
|
||||
auto = (
|
||||
"JUC500 미감지 — python -m juc500_xfer doctor 로 진단하세요"
|
||||
if not STATE.connecting
|
||||
else STATE.auto_status
|
||||
)
|
||||
self._json(
|
||||
200,
|
||||
{
|
||||
@@ -417,13 +432,16 @@ class Handler(BaseHTTPRequestHandler):
|
||||
"root": STATE.peer_name or "JUC500",
|
||||
"remote_start": "",
|
||||
"remote_receive": "",
|
||||
"auto_status": STATE.auto_status,
|
||||
"auto_status": auto if not _session_alive() else STATE.auto_status,
|
||||
"progress": STATE.last_progress,
|
||||
"device": {
|
||||
"serial": cable.serial if cable else None,
|
||||
"product": cable.product if cable else None,
|
||||
"count": len(devices),
|
||||
"vid": f"{cable.vid:04x}" if cable else None,
|
||||
"pid": f"{cable.pid:04x}" if cable else None,
|
||||
},
|
||||
"usb_error": list_err,
|
||||
"inputshare": {
|
||||
"supported": False,
|
||||
"enabled": False,
|
||||
@@ -434,6 +452,10 @@ class Handler(BaseHTTPRequestHandler):
|
||||
)
|
||||
return
|
||||
|
||||
if path == "/api/doctor":
|
||||
self._json(200, doctor().to_dict())
|
||||
return
|
||||
|
||||
if path == "/api/settings/ports":
|
||||
# Reuse settings modal: expose local_root / serial as "ports"-like rows
|
||||
self._json(
|
||||
|
||||
Reference in New Issue
Block a user