Commit 17fee3a0 authored by Lorenz Meier's avatar Lorenz Meier

MAVLink: Disconnect link if it does not contain protocol data

This is important to avoid having QGC hijack links that are active (we read 2000 bytes!) but are definitely not MAVLink. This can have nasty side-effects, e.g. if we would talk to an LTE modem in a laptop or alike.
parent c9929114
......@@ -205,8 +205,12 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
else
{
warnedUserNonMavlink = true;
emit protocolStatusMessage(tr("MAVLink Protocol"), tr("There is a MAVLink Version or Baud Rate Mismatch. "
"Please check if the baud rates of %1 and your autopilot are the same.").arg(qgcApp()->applicationName()));
// Disconnect the link since its some other device and
// QGC clinging on to it and feeding it data might have unintended
// side effects (e.g. if its a modem)
qDebug() << "disconnected link" << link->getName() << "as it contained no MAVLink data";
QMetaObject::invokeMethod(_linkMgr, "disconnectLink", Q_ARG( LinkInterface*, link ) );
return;
}
}
}
......
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