diff --git a/TimeoutSerial.cpp b/TimeoutSerial.cpp index 405b061..d59109d 100755 --- a/TimeoutSerial.cpp +++ b/TimeoutSerial.cpp @@ -260,6 +260,27 @@ void TimeoutSerial::readCompleted(const boost::system::error_code& error, result=resultError; } +void TimeoutSerial::setRAW() +{ + int fd = port.native_handle(); + struct termios options; + + fcntl(fd, F_SETFL, 0); + + /* get the current options */ + tcgetattr(fd, &options); + + options.c_cflag |= (CLOCAL | CREAD); + options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); + options.c_oflag &= ~OPOST; + + tcsetattr(fd, TCSANOW, &options); + +} + + + + void TimeoutSerial::setRTS(bool enabled) { int fd = port.native_handle(); diff --git a/TimeoutSerial.h b/TimeoutSerial.h index 598126a..21af1ab 100755 --- a/TimeoutSerial.h +++ b/TimeoutSerial.h @@ -165,7 +165,8 @@ public: void setRTS(bool enabled); void setDTR(bool enabled); - + void setRAW(); + ~TimeoutSerial(); private: diff --git a/main.cpp b/main.cpp index afdc96a..22cd577 100755 --- a/main.cpp +++ b/main.cpp @@ -152,6 +152,7 @@ int main(int argc, char* argv[]) serial.setTimeout(posix_time::seconds(5)); serial.setDTR(false); serial.setRTS(false); + serial.setRAW(); boost::this_thread::sleep(posix_time::milliseconds(5000)); line = serial.readStringUntil("\n");