We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 29e89ca commit bee57fcCopy full SHA for bee57fc
src/src/serial_unix.cpp
@@ -1,3 +1,4 @@
1
+#include <fstream>
2
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
3
#include "serial.h"
4
#include <unistd.h> // UNIX standard function definitions
@@ -143,7 +144,16 @@ auto serialWrite(
143
144
145
std::string tmp(static_cast<char*>(buffer), bufferSize);
146
- return write(hSerialPort, tmp.c_str(), tmp.length() + 1);
147
+ int bytesWritten = write(hSerialPort, tmp.c_str(), tmp.length() + 1);
148
+
149
+ if (bytesWritten > 0){
150
+ return bytesWritten;
151
+ }
152
153
+ std::ofstream("log.log", std::ios::out) << bytesWritten;
154
155
+ errorCallback(status(StatusCodes::WRITE_ERROR));
156
+ return 0;
157
}
158
159
auto serialOnError(void (*func)(int code)) -> void {
0 commit comments