diff options
| author | Christian Kolset <ckolset@colostate.edu> | 2026-08-13 11:09:03 -0600 |
|---|---|---|
| committer | Christian Kolset <ckolset@colostate.edu> | 2026-08-13 11:09:03 -0600 |
| commit | 4d08be2656d5599caf60ab5163a9d2305b397daf (patch) | |
| tree | d78e764e21995b47eca79d184460f14eb52cdd22 /devices/serial_device.py | |
| parent | 012a1093e3cb9a1b376fc3beee4df859ccfb8da5 (diff) | |
Re-detect serial device ports by identity when a profile loads on another machine
COM/tty numbers aren't stable across machines or replugs. Devices now save
their USB serial number and OS description alongside the port; on profile
load, if the saved port isn't present, ArduinoLayer.find_port_by_identity()
looks for a match and remaps it. Falls back to the saved port (device shows
ERROR) if nothing matches.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'devices/serial_device.py')
| -rw-r--r-- | devices/serial_device.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/devices/serial_device.py b/devices/serial_device.py index cef34e8..d402f09 100644 --- a/devices/serial_device.py +++ b/devices/serial_device.py @@ -210,6 +210,11 @@ class SerialDevice(BaseDevice): "parse_format": self._fmt, "simulate": self.simulate, } + if not self.simulate: + # Saved so a profile loaded on another machine (different COM/tty + # numbering) can still find this device — see ProfileManager.apply(). + cfg["port_desc"] = ArduinoLayer.describe_port(self._port) + cfg["port_serial"] = ArduinoLayer.port_serial_number(self._port) if self._fmt in _GENERIC_FORMATS: cfg.update({ "num_channels": len(self.info.channels), |
