Commit d7257ad4 authored by Don Gagne's avatar Don Gagne

Better Windows error reporting

parent e8b45972
...@@ -164,17 +164,15 @@ void QextSerialPortPrivate::translateError(ulong error) ...@@ -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,8 +202,8 @@ qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize) ...@@ -204,8 +202,8 @@ 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) ...@@ -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;
} }
......
...@@ -102,11 +102,6 @@ void PX4FirmwareUpgradeThreadWorker::_findBoardOnce(void) ...@@ -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;
......
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