In a nutshell I have: at the start:
fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY); (1) (2)
followed by:
tcgetattr(fd,&oldtio);
newtio.c_cflag = B115200 | CRTSCTS | CS8 | CLOCAL | CREAD ;
newtio.c_iflag = 0;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VMIN] = 1;
newtio.c_cc[VTIME] = 0;
tcsetattr(fd, TCSANOW, &newtio);
then later on, to write some data:
write(fd,"hello\r\n",7); (3)
The problem is that data doesn't get sent to the UART until the program is
terminated. The "write" must be buffering the output data obviously. But I
can't figure a way of forcing a flush after the "write".
There must be some simple obvious explanation, but I can't figure out why! Any
ideas?
Thanks!
NB:
(1) Also have tried including "O_NDELAY O_NONBLOCK"
(2) Also have tried including "fcntl(fd, F_SETFL, O_NONBLOCK)"
(3) Also tried adding fsync(fd), fflush(NULL) after write()
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|