Hello,
I am trying to communicate with sensor via UART. I want to use canonical
input mode because my sensor sends its data line by line.
For this purpose I set up terminal interface like below:
structtermios config;
tcgetattr(_fd, &config)
/* Canonical Mode Selection */
config.c_lflag |= ICANON;
/* Disable Echo, Echo New line */
config.c_lflag &= ~(ECHO | ECHOE | ECHONL);
/* Line Settings */
config.c_cflag |= (CLOCAL | CREAD);/* ignore modem controls */
config.c_cflag &= ~CSIZE;
config.c_cflag |= CS8;/* 8-bit characters */
config.c_cflag &= ~PARENB;/* no parity bit */
config.c_cflag &= ~CSTOPB;/* only need 1 stop bit */
config.c_cflag &= ~CRTSCTS;/* no hardware flowcontrol */
cfsetispeed(&config, B115200);
cfsetospeed(&config, B115200)
tcsetattr(_fd, TCSANOW, &config);
After that I called read() function, and I expected to get a line from
device.
But I can't get a full line from device. read() function returns even if
sensor is not send any NL, EOF characters.
By the way I opened device in nonblocking mode.
Did you try canonical mode before ? I can't find any example. If you
tried canonical mode before could you give me any hint about this issue ?
Thanks,
Şükrü.