add FORWARD_RAW_TTY define to use raw output as option to forward data to a serial connection with same params as a usual bus interface
This commit is contained in:
@@ -50,6 +50,22 @@ bool RotateFile::setEnabled(bool enabled) {
|
||||
if (enabled) {
|
||||
m_stream = fopen(m_fileName.c_str(), m_textMode ? "w" : "wb");
|
||||
m_fileSize = 0;
|
||||
#ifdef FORWARD_RAW_TTY
|
||||
if (!m_textMode && isatty(fileno(m_stream)) == 1) {
|
||||
int fd = fileno(m_stream);
|
||||
struct termios newSettings;
|
||||
memset(&newSettings, 0, sizeof(newSettings));
|
||||
|
||||
cfsetspeed(&newSettings, B2400);
|
||||
newSettings.c_cflag |= (CS8 | CLOCAL);
|
||||
newSettings.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // non-canonical mode
|
||||
newSettings.c_iflag |= IGNPAR; // ignore parity errors
|
||||
newSettings.c_oflag &= ~OPOST;
|
||||
|
||||
// activate new settings of serial device
|
||||
tcsetattr(fd, TCSANOW, &newSettings);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user