Tools/SuperBoard/SerialDevice.cc
//delete all the data in the input buffer
delete all the data in the input buffer
delete all the data in the input buffer
int SerialDevice::FlushInputBuffer()
{
  char c[1000];
  if (!this->connected)
  {
    SD_LOG_ERROR("not connected to the device");
    return -1;
  }
  int block=this->block;
  _SetNonBlockingIO();
  while (read(this->fd,c,1000) > 0){}
  if (block==1)
  {
    _SetBlockingIO();
  }
  return 0;
}
int SerialDevice :: FlushInputBuffer ( ) { char c [ 1000 ] ; if ( ! this -> connected ) { SD_LOG_ERROR ( " " ) ; return -1 ; } int block = this -> block ; _SetNonBlockingIO ( ) ; while ( read ( this -> fd , c , 1000 ) > 0 ) { } if ( block == 1 ) { _SetBlockingIO ( ) ; } return 0 ; }
delete all the data in the input buffer
delete all the data in the input buffer
//check whether we are connected to the device //TODO tcflush for some reason does not work..  //tcflush(this->fd, TCIFLUSH); //read off all the chars