void SerialPort::setRawMode(int minNumBytes,int timeOut) { /* Read the current port settings: */ struct termios term; tcgetattr(port,&term); /* Disable canonical mode: */ term.c_lflag&=~ICANON; /* Set the min/time parameters: */ term.c_cc[VMIN]=cc_t(minNumBytes); term.c_cc[VTIME]=cc_t(timeOut); /* Set the port: */ tcsetattr(port,TCSANOW,&term); }
void SerialPort::setRawMode(int minNumBytes,int timeOut) { /* Read the current port settings: */ struct termios term; if(tcgetattr(fd,&term)!=0) Misc::throwStdErr("Comm::SerialPort::setRawMode: Unable to read device configuration"); /* Disable canonical mode: */ term.c_lflag&=~ICANON; /* Set the min/time parameters: */ term.c_cc[VMIN]=cc_t(minNumBytes); term.c_cc[VTIME]=cc_t(timeOut); /* Set the port: */ if(tcsetattr(fd,TCSANOW,&term)!=0) Misc::throwStdErr("Comm::SerialPort::setRawMode: Unable to configure device"); }
void SerialIO::setTimeout(double Timeout) { m_Timeout = Timeout; if (m_Device != -1) { m_tio.c_cc[VTIME] = cc_t(ceil(m_Timeout * 10.0)); ::tcsetattr(m_Device, TCSANOW, &m_tio); } }