Browse Source

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.
QGC4.4
Lorenz Meier 8 years ago
parent
commit
5c56bd037a
  1. 7
      src/comm/LinkManager.cc
  2. 21
      src/comm/QGCSerialPortInfo.cc
  3. 3
      src/comm/QGCSerialPortInfo.h

7
src/comm/LinkManager.cc

@ -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();

21
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) bool QGCSerialPortInfo::canFlash(void)
{ {
BoardType_t boardType; BoardType_t boardType;

3
src/comm/QGCSerialPortInfo.h

@ -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;

Loading…
Cancel
Save