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)
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();
......
......@@ -252,7 +252,9 @@ QList<QGCSerialPortInfo> QGCSerialPortInfo::availablePorts(void)
QList<QGCSerialPortInfo> list;
foreach(QSerialPortInfo portInfo, QSerialPortInfo::availablePorts()) {
list << *((QGCSerialPortInfo*)&portInfo);
if (!isSystemPort(&portInfo)) {
list << *((QGCSerialPortInfo*)&portInfo);
}
}
return list;
......@@ -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
// 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")
// Known operating system peripherals that are NEVER a peripheral
// that we should connect to.
// XXX Add Linux (LTE modems, etc) and Windows as needed
// MAC OS
if (port->systemLocation().contains("tty.MALS")
|| port->systemLocation().contains("tty.SOC")
|| port->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")) {
|| port->systemLocation().contains("tty.usbserial")
|| port->systemLocation().contains("tty.usbmodem")) {
return true;
}
......
......@@ -50,7 +50,7 @@ public:
bool isBootloader(void) const;
/// @return true: Port is a system port and not an autopilot
bool isSystemPort(void) const;
static bool isSystemPort(QSerialPortInfo* port);
private:
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