File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include < dirent.h>
1313#endif
1414
15+ #ifdef TARGET_LINUX
16+ #include < linux/serial.h>
17+ #endif
1518
1619#pragma comment(lib, "setupapi.lib")
1720#include < fcntl.h>
@@ -418,8 +421,21 @@ bool ofSerial::setup(string portName, int baud)
418421 options.c_cflag &= ~PARENB;
419422 options.c_cflag &= ~CSTOPB;
420423 options.c_cflag &= ~CSIZE;
424+ options.c_iflag &= (tcflag_t ) ~(INLCR | IGNCR | ICRNL | IGNBRK);
425+ options.c_oflag &= (tcflag_t ) ~(OPOST);
426+ #if defined( TARGET_LINUX )
427+ options.c_cflag |= CRTSCTS;
428+ options.c_lflag &= ~(ICANON | ECHO | ISIG);
429+ #endif
421430 options.c_cflag |= CS8;
422431 tcsetattr (fd,TCSANOW,&options);
432+ #ifdef TARGET_LINUX
433+ struct serial_struct kernel_serial_settings;
434+ if (ioctl (fd, TIOCGSERIAL, &kernel_serial_settings) == 0 ) {
435+ kernel_serial_settings.flags |= ASYNC_LOW_LATENCY;
436+ ioctl (fd, TIOCSSERIAL, &kernel_serial_settings);
437+ }
438+ #endif
423439
424440 bInited = true ;
425441 printf (" Success in opening serial connection!\n\n " );
You can’t perform that action at this time.
0 commit comments