Files
NODEDC_MISSION_CORE/plugins/vesc/runtime/controller_diagnostics.py
DCCONSTRUCTIONS f32c7b400b feat(vesc): extend motor diagnostics, configuration and transport recovery
Add firmware and extension catalogues, configuration transactions, sample review and QML diagnostics. Preserve explicit authority, bounded retries and stop recovery in motor transport.
2026-10-29 09:09:59 +03:00

19 lines
779 B
Python

"""Bounded, read-only firmware diagnostics and exact-attachment USB descriptors."""
from pathlib import Path
from .serial import check_attachment
def read_diagnostics(device):
attachment = device.attachment
check_attachment(attachment)
path = Path('/sys/bus/usb/devices') / attachment.usb
usb = {"port": attachment.usb, "tty": attachment.tty, "speed": attachment.speed}
for field in ('idVendor', 'idProduct', 'bcdDevice', 'manufacturer', 'product', 'serial'):
try:
usb[field] = (path / field).read_text()[:256].strip()
except OSError:
usb[field] = None
reports = {name: device.link.diagnostic(name) for name in ('hw_status', 'faults')}
check_attachment(attachment)
return {"usb": usb, "reports": reports}