diff options
Diffstat (limited to 'daemon/src/connection_manager.cpp')
-rw-r--r-- | daemon/src/connection_manager.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/daemon/src/connection_manager.cpp b/daemon/src/connection_manager.cpp index faad061..88f6659 100644 --- a/daemon/src/connection_manager.cpp +++ b/daemon/src/connection_manager.cpp @@ -90,13 +90,20 @@ Connection_Manager::refresh_devices([[maybe_unused]] bool add, [[maybe_unused]] for (auto & [id, device] : m_connections) { + bool attached = false; for (auto const & [port, name] : port_map) { - if (name.contains(device->device_name)) + attached |= name.contains(device->device_name); + if (attached) { - device->reconnect(port); + device->connect(port); + break; } } + if (!attached) + { + device->disconnect(); + } } } |