Commit eb811905 authored by Don Gagne's avatar Don Gagne

Merge pull request #1357 from dogmaphobic/serialPortFix

Serial port fix
parents 34337970 cb63f6de
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// If you need to make an incompatible changes to stored settings, bump this version number // If you need to make an incompatible changes to stored settings, bump this version number
// up by 1. This will caused store settings to be cleared on next boot. // up by 1. This will caused store settings to be cleared on next boot.
#define QGC_SETTINGS_VERSION 3 #define QGC_SETTINGS_VERSION 4
#define QGC_APPLICATION_NAME "QGroundControl" #define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_ORG_NAME "QGroundControl.org" #define QGC_ORG_NAME "QGroundControl.org"
......
...@@ -465,7 +465,7 @@ void LinkManager::_updateConfigurationList(void) ...@@ -465,7 +465,7 @@ void LinkManager::_updateConfigurationList(void)
#endif #endif
// Is this a PX4? // Is this a PX4?
if (portInfo.vendorIdentifier() == 9900) { if (portInfo.vendorIdentifier() == 9900) {
SerialConfiguration* pSerial = _findSerialConfiguration(portInfo.portName()); SerialConfiguration* pSerial = _findSerialConfiguration(portInfo.systemLocation());
if (pSerial) { if (pSerial) {
//-- If this port is configured make sure it has the preferred flag set //-- If this port is configured make sure it has the preferred flag set
if(!pSerial->isPreferred()) { if(!pSerial->isPreferred()) {
...@@ -477,7 +477,7 @@ void LinkManager::_updateConfigurationList(void) ...@@ -477,7 +477,7 @@ void LinkManager::_updateConfigurationList(void)
pSerial = new SerialConfiguration(QString("Pixhawk on %1").arg(portInfo.portName().trimmed())); pSerial = new SerialConfiguration(QString("Pixhawk on %1").arg(portInfo.portName().trimmed()));
pSerial->setPreferred(true); pSerial->setPreferred(true);
pSerial->setBaud(115200); pSerial->setBaud(115200);
pSerial->setPortName(portInfo.portName()); pSerial->setPortName(portInfo.systemLocation());
addLinkConfiguration(pSerial); addLinkConfiguration(pSerial);
saveList = true; saveList = true;
} }
......
...@@ -588,7 +588,7 @@ QList<QString> SerialConfiguration::getCurrentPorts() ...@@ -588,7 +588,7 @@ QList<QString> SerialConfiguration::getCurrentPorts()
QList<QSerialPortInfo> portList = QSerialPortInfo::availablePorts(); QList<QSerialPortInfo> portList = QSerialPortInfo::availablePorts();
foreach (const QSerialPortInfo &info, portList) foreach (const QSerialPortInfo &info, portList)
{ {
ports.append(info.portName()); ports.append(info.systemLocation());
} }
return ports; return ports;
} }
...@@ -137,10 +137,16 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config) ...@@ -137,10 +137,16 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config)
//-- Check for "Unnamed" //-- Check for "Unnamed"
if (config->name() == tr("Unnamed")) { if (config->name() == tr("Unnamed")) {
switch(config->type()) { switch(config->type()) {
case LinkConfiguration::TypeSerial: case LinkConfiguration::TypeSerial: {
config->setName( QString tname = dynamic_cast<SerialConfiguration*>(config)->portName();
QString("Serial Device on %1").arg(dynamic_cast<SerialConfiguration*>(config)->portName())); #ifdef Q_OS_WIN32
tname.replace("\\\\.\\", "");
#else
tname.replace("/dev/", "");
#endif
config->setName(QString("Serial Device on %1").arg(tname));
break; break;
}
case LinkConfiguration::TypeUdp: case LinkConfiguration::TypeUdp:
config->setName( config->setName(
QString("UDP Link on Port %1").arg(dynamic_cast<UDPConfiguration*>(config)->localPort())); QString("UDP Link on Port %1").arg(dynamic_cast<UDPConfiguration*>(config)->localPort()));
......
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