File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1515int hSerialPort;
1616termios2 tty;
1717
18+ std::ofstream log (" log.log" , std::ios::out);
19+
1820void (*errorCallback)(int errorCode);
1921void (*readCallback)(int bytes);
2022void (*writeCallback)(int bytes);
@@ -29,12 +31,11 @@ void serialOpen(
2931 char *portName = static_cast <char *>(port);
3032 // Open new serial connection
3133 hSerialPort = open (portName, O_RDWR);
34+
35+ log << strerror (errno);
3236
3337 // Error if open fails
3438 ioctl (hSerialPort, TCGETS2, &tty);
35- // if (tcgetattr(hSerialPort, &tty) != 0) {
36- // returnStatus(StatusCodes::INVALID_HANDLE_ERROR);
37- // }
3839
3940 tty.c_cflag &= ~PARENB; // Clear parity bit, disabling parity (most common)
4041 tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication (most common)
@@ -152,7 +153,7 @@ auto serialWrite(
152153 return bytesWritten;
153154 }
154155
155- std::ofstream ( " log.log " , std::ios::out) << strerror (errno);
156+ log << strerror (errno);
156157
157158 errorCallback (status (StatusCodes::WRITE_ERROR));
158159 return 0 ;
You can’t perform that action at this time.
0 commit comments