[질문] 시리얼포트로 읽어오는데 tiimeout이 안걸립니다...

pangjun의 이미지

코드는 아래와 같은데요...
VTIME과 VMIN을 1과 4를 설정했는데...
4byte를 보내면 read가 넘어오는데...
VTIME은 아무리 기다려도 timeout이 안되네요...
계속 blocking 상태로 남아 있습니다...

뭐가 문제일까요? :oops:
고생중입니다... 검색을 해도 특별히 안될 이유를 찾을수가 없네요...

	struct termios oldtermios;
	struct termios newtermios;

	int fd = open ("/dev/ttyS0", O_RDWR | O_NOCTTY);

	tcgetattr (fd, &oldtermios);
	bzero (&newtermios, sizeof(struct termios));

	newtermios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
	newtermios.c_iflag = IGNPAR;
	newtermios.c_oflag = 0;
	newtermios.c_lflag = 0;

	newtermios.c_cc[VINTR] = 0;
	newtermios.c_cc[VQUIT] = 0;
	newtermios.c_cc[VERASE] = 0;
	newtermios.c_cc[VKILL] = 0;
	newtermios.c_cc[VEOF] = 4;
	newtermios.c_cc[VSWTC] = 0;
	newtermios.c_cc[VSTART] = 0;
	newtermios.c_cc[VSTOP] = 0;
	newtermios.c_cc[VSUSP] = 0;
	newtermios.c_cc[VEOL] = 0;
	newtermios.c_cc[VREPRINT] = 0;
	newtermios.c_cc[VDISCARD] = 0;
	newtermios.c_cc[VWERASE] = 0;
	newtermios.c_cc[VLNEXT] = 0;
	newtermios.c_cc[VEOL2] = 0;

	newtermios.c_cc[VTIME] = 1;
	newtermios.c_cc[VMIN] = 4;

	tcflush (fd, TCIFLUSH);
	if (tcsetattr (fd, TCSANOW, &newtermios) == 0)

	unsigned char buf[255];
	read (fd, buf, 255);