diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index c115728a496e7eb9415b8cf2d36f2e3739544069..f4cdd0a046216c62dbe67f55ae5ccea1156c7210 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -501,6 +501,13 @@ void LinkManager::_updateAutoConnectLinks(void) QString boardName; if (portInfo.getBoardInfo(boardType, boardName)) { + + if (portInfo.isSystemPort()) { + // Don't connect to system ports + qCDebug(LinkManagerLog) << "Not opening known system ports" << portInfo.systemLocation(); + continue; + } + if (portInfo.isBootloader()) { // Don't connect to bootloader qCDebug(LinkManagerLog) << "Waiting for bootloader to finish" << portInfo.systemLocation(); diff --git a/src/comm/QGCSerialPortInfo.cc b/src/comm/QGCSerialPortInfo.cc index 1f07da7d2c152043b9ae16aef6f05584d804bfc0..8eabe4e2422c0fc65a1236a1a23c480c2c740446 100644 --- a/src/comm/QGCSerialPortInfo.cc +++ b/src/comm/QGCSerialPortInfo.cc @@ -271,6 +271,27 @@ bool QGCSerialPortInfo::isBootloader(void) const } } +bool QGCSerialPortInfo::isSystemPort(void) const +{ + // Known operating system peripherals that are NOT a drone + + // These are known Mac OS ports that + // are never connected to a drone but instead + // to other system peripherals. + if (systemLocation().contains("tty.MALS") + || systemLocation().contains("tty.SOC") + || systemLocation().contains("tty.Bluetooth-Incoming-Port") + // We open these by their cu.usbserial and cu.usbmodem handles + // already. We don't want to open them twice and conflict + // with ourselves. + || systemLocation().contains("tty.usbserial") + || systemLocation().contains("tty.usbmodem")) { + + return true; + } + return false; +} + bool QGCSerialPortInfo::canFlash(void) { BoardType_t boardType; diff --git a/src/comm/QGCSerialPortInfo.h b/src/comm/QGCSerialPortInfo.h index 0148da2f0747de614859a00fe69f5c7f42a91085..23b4c7cbee3fe27a1bf2b608e6ab515ca74f10d1 100644 --- a/src/comm/QGCSerialPortInfo.h +++ b/src/comm/QGCSerialPortInfo.h @@ -49,6 +49,9 @@ public: /// @return true: Board is currently in bootloader bool isBootloader(void) const; + /// @return true: Port is a system port and not an autopilot + bool isSystemPort(void) const; + private: typedef struct { const char* classString;