From 4d08be2656d5599caf60ab5163a9d2305b397daf Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Thu, 13 Aug 2026 11:09:03 -0600 Subject: 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 --- devices/serial_device.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'devices/serial_device.py') 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), -- cgit v1.2.3