Commit 971aa24d authored by Lorenz Meier's avatar Lorenz Meier

Filter serial port handles already in initial list

This ensures no ports are being displayed to the user that are definitely unusable.
parent 8dcf6c4d
...@@ -502,12 +502,6 @@ void LinkManager::_updateAutoConnectLinks(void) ...@@ -502,12 +502,6 @@ void LinkManager::_updateAutoConnectLinks(void)
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();
......
...@@ -252,7 +252,9 @@ QList<QGCSerialPortInfo> QGCSerialPortInfo::availablePorts(void) ...@@ -252,7 +252,9 @@ QList<QGCSerialPortInfo> QGCSerialPortInfo::availablePorts(void)
QList<QGCSerialPortInfo> list; QList<QGCSerialPortInfo> list;
foreach(QSerialPortInfo portInfo, QSerialPortInfo::availablePorts()) { foreach(QSerialPortInfo portInfo, QSerialPortInfo::availablePorts()) {
list << *((QGCSerialPortInfo*)&portInfo); if (!isSystemPort(&portInfo)) {
list << *((QGCSerialPortInfo*)&portInfo);
}
} }
return list; return list;
...@@ -271,21 +273,22 @@ bool QGCSerialPortInfo::isBootloader(void) const ...@@ -271,21 +273,22 @@ bool QGCSerialPortInfo::isBootloader(void) const
} }
} }
bool QGCSerialPortInfo::isSystemPort(void) const bool QGCSerialPortInfo::isSystemPort(QSerialPortInfo* port)
{ {
// Known operating system peripherals that are NOT a drone // Known operating system peripherals that are NEVER a peripheral
// that we should connect to.
// These are known Mac OS ports that
// are never connected to a drone but instead // XXX Add Linux (LTE modems, etc) and Windows as needed
// to other system peripherals.
if (systemLocation().contains("tty.MALS") // MAC OS
|| systemLocation().contains("tty.SOC") if (port->systemLocation().contains("tty.MALS")
|| systemLocation().contains("tty.Bluetooth-Incoming-Port") || port->systemLocation().contains("tty.SOC")
|| port->systemLocation().contains("tty.Bluetooth-Incoming-Port")
// We open these by their cu.usbserial and cu.usbmodem handles // We open these by their cu.usbserial and cu.usbmodem handles
// already. We don't want to open them twice and conflict // already. We don't want to open them twice and conflict
// with ourselves. // with ourselves.
|| systemLocation().contains("tty.usbserial") || port->systemLocation().contains("tty.usbserial")
|| systemLocation().contains("tty.usbmodem")) { || port->systemLocation().contains("tty.usbmodem")) {
return true; return true;
} }
......
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
bool isBootloader(void) const; bool isBootloader(void) const;
/// @return true: Port is a system port and not an autopilot /// @return true: Port is a system port and not an autopilot
bool isSystemPort(void) const; static bool isSystemPort(QSerialPortInfo* port);
private: private:
typedef struct { typedef struct {
......
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