[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

termios raw question



I'm trying to use termios for reading/writing a raw data stream.
I am using tcgetattr to get the attributes then setting:

  termios_attr.c_iflag &= ~(IXON|IXANY|IXOFF);
  termios_attr.c_oflag &= ~OPOST;
  termios_attr.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
  termios_attr.c_cflag = CREAD;
  termios_attr.c_cflag &= ~(CSIZE|PARENB);

  Setting Baud rate in c_cflag based upon a table value
  Setting bits per charachter in c_cflag based upon a table value
  Setting parity in c_cflag based upon a table value
  Setting number in c_cflag of stop bits based upon a table value
  Settiing flow control in c_iflag based upon a table value

Then I use tcsetattr to set the attribute.  I found a problem where 0xd
was being changed to a 0xa with this code and replaced the first c_iflag
setting with:

  termios_attr.c_iflag &= ~(IXON|IXANY|IXOFF|ICRNL);

However this causes a queue overflow when reading the device.  Does anyone
know if clearing ICRNL, would have the effect of hoarding input characters
and if so how to keep this from happening?  Any other suggestions would be
appreciated.

Jennifer