Browse Source

Better Windows error reporting

QGC4.4
Don Gagne 11 years ago
parent
commit
d7257ad446
  1. 16
      libs/qextserialport/src/qextserialport_win.cpp
  2. 5
      src/ui/px4_configuration/PX4FirmwareUpgradeThread.cc

16
libs/qextserialport/src/qextserialport_win.cpp

@ -164,17 +164,15 @@ void QextSerialPortPrivate::translateError(ulong error)
lastOSErr = error; lastOSErr = error;
lastErr = E_OS_SPECIFIC; lastErr = E_OS_SPECIFIC;
LPVOID lpMsgBuf; char buf[256];
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, NULL,
error, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, buf, sizeof(buf),
0, NULL); NULL);
lastOSErrString = QString((char*)lpMsgBuf); lastOSErrString = buf;
LocalFree(lpMsgBuf);
} }
/* /*
@ -204,7 +202,7 @@ qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
if (!failed) if (!failed)
return (qint64)bytesRead; return (qint64)bytesRead;
lastErr = E_READ_FAILED; translateError(GetLastError());
return -1; return -1;
} }
@ -249,7 +247,7 @@ qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
if (!failed) if (!failed)
return (qint64)bytesWritten; return (qint64)bytesWritten;
lastErr = E_WRITE_FAILED; translateError(GetLastError());
return -1; return -1;
} }

5
src/ui/px4_configuration/PX4FirmwareUpgradeThread.cc

@ -102,11 +102,6 @@ void PX4FirmwareUpgradeThreadWorker::_findBoardOnce(void)
portName = info.systemLocation(); portName = info.systemLocation();
portDescription = info.description(); portDescription = info.description();
#ifdef Q_OS_WIN
// Stupid windows fixes
portName.prepend("\\\\.\\");
#endif
_closeFind(); _closeFind();
emit foundBoard(_findBoardFirstAttempt, portName, portDescription); emit foundBoard(_findBoardFirstAttempt, portName, portDescription);
return; return;

Loading…
Cancel
Save