I am developing a software wherein I have to receive data via serial port. I am opening the port in canonical mode and setting the VEOL flag to 0X78(hexadecimal). The problem I am facing is that read is exiting every time it receives byte value 0X0A in between. Can somebody help me in resolving this issue, I want read to block till I receive end byte as 0X78. This is the code I have written so far
struct termios tio;
char buf[255];
int fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY);
if (fd <0) {
perror(MODEMDEVICE);
exit(−1);
}
bzero(&tio, sizeof(tio));
tio.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
tio.c_iflag = IGNPAR;
tio.c_oflag = 0;
tio.c_lflag = 1;
tio.c_cc[VEOL] = 0X78;
tcflush(fd, TCIFLUSH);
tcsetattr(fd,TCSANOW,&tio);
int read=read(fd,buf,255);
printf("Number of bytes read is %d\n",read);
Thank you in advance.