Commit 8dfb156
Discover the Millennia eV port by its STM32 USB-CDC VID/PID
Problem: MillenniaEv25Device could only be constructed with an explicit
portPath; doInitializeDevice opened SerialPort(portPath=...) and never fell
back to VID/PID discovery, so a caller (e.g. the MillenniaUI app) had to know
the OS port name up front. The class did not set classIdVendor/classIdProduct,
so nothing identified the device by its USB descriptor.
Solution: Set classIdVendor = 0x0483 / classIdProduct = 0x5740 (the STM32
Virtual COM Port identity the lab eV25s enumerates as) and have
doInitializeDevice discover the port by that identity when no portPath is
given, mirroring FieldMasterDevice: it builds SerialPort(idVendor, idProduct,
serialNumber) -> matchAnyPort over pyserial's comports(), and raises a clear
UnableToInitialize naming the identity when nothing matches. An explicit
portPath still wins; a serialNumber narrows discovery when several STM32 CDC
ports are present. serialNumber is passed only when it actually narrows, so
matchPorts stays on its vid/pid path and never regex-matches a possibly-None
descriptor serial. The generic-STM32-VCP caveat is documented in the code.
DebugMillenniaEv25Device is unaffected: it overrides doInitializeDevice and
keeps its own fake identity. testMillennia.py passes (14 passed, 6 skipped).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d4c4a5b commit 8dfb156
1 file changed
Lines changed: 28 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| |||
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | | - | |
| 83 | + | |
80 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
| |||
0 commit comments