Commit 5c56bd03 authored by Lorenz Meier's avatar Lorenz Meier

Serial links: Do not connect to known system peripherals

We were connecting to system peripherals before, which adds boot delay as QGC re-tries opening the port. We were also opening serial ports two times on Mac OS: Once as /dev/cu.usbmodem1 and once as /dev/tty.usbmodem1 - since the cu.usbmodem alias was already open, the 2nd opening always failed, leading to further boot delay.
parent 870f7cb9
...@@ -501,6 +501,13 @@ void LinkManager::_updateAutoConnectLinks(void) ...@@ -501,6 +501,13 @@ void LinkManager::_updateAutoConnectLinks(void)
QString boardName; QString boardName;
if (portInfo.getBoardInfo(boardType, 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()) { if (portInfo.isBootloader()) {
// Don't connect to bootloader // Don't connect to bootloader
qCDebug(LinkManagerLog) << "Waiting for bootloader to finish" << portInfo.systemLocation(); qCDebug(LinkManagerLog) << "Waiting for bootloader to finish" << portInfo.systemLocation();
......
...@@ -271,6 +271,27 @@ bool QGCSerialPortInfo::isBootloader(void) const ...@@ -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) bool QGCSerialPortInfo::canFlash(void)
{ {
BoardType_t boardType; BoardType_t boardType;
......
...@@ -49,6 +49,9 @@ public: ...@@ -49,6 +49,9 @@ public:
/// @return true: Board is currently in bootloader /// @return true: Board is currently in bootloader
bool isBootloader(void) const; bool isBootloader(void) const;
/// @return true: Port is a system port and not an autopilot
bool isSystemPort(void) const;
private: private:
typedef struct { typedef struct {
const char* classString; const char* classString;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment