How johnscotttt/witrn_hid_api works
WITRN HID is a small Python API for reading WITRN USB HID messages and decoding them into metadata. The main workflow is to open a device, read a 64-byte HID report, then dispatch it to general-message or USB-PD decoding. General reports are decoded locally; PD parsing and the shared metadata model come from usbpdparser. The README also documents metadata inspection, context helpers, and rendering. The graph reflects sampled core code and documented capabilities; external dependency internals are not shown.
Main entry points: core.py WITRN_DEV · __init__.py Public API
Components 13
HID Access
- Public API
witrnhid/__init__.py - WITRN_DEV
witrnhid/core.py - hidapi
Message Decoding
- auto_unpack
witrnhid/core.py - general_unpack
witrnhid/core.py - General report decoder
witrnhid/core.py - pd_unpack
witrnhid/core.py - USB PD Parser
Metadata Tools
- metadata
- PDO/RDO helpers
- Metadata renderer
Other components
- Python caller
- WITRN HID device
Connections 14
- Python caller → Public API: imports
- Python caller → WITRN_DEV: creates and calls
- WITRN_DEV → hidapi: opens, reads, closes
- hidapi → WITRN HID device: accesses
- WITRN HID device → hidapi: HID reports
- WITRN_DEV → auto_unpack: unpacks
- auto_unpack → general_unpack: dispatches general
- auto_unpack → pd_unpack: dispatches PD
- general_unpack → General report decoder: decodes report
- General report decoder → metadata: builds fields
- pd_unpack → USB PD Parser: calls parse
- USB PD Parser → metadata: returns parsed data
- Python caller → PDO/RDO helpers: checks context
- Python caller → Metadata renderer: renders metadata