ts-7000
[Top] [All Lists]

[ts-7000] Re: TS-7800 COM2 port won't transmit until program has ended

To:
Subject: [ts-7000] Re: TS-7800 COM2 port won't transmit until program has ended
From: "Kris" <>
Date: Mon, 17 Jan 2011 16:52:11 -0000
#include <termios.h>

int tcdrain(int fildes);

That will force the flush of the buffer, this is normal linux behavior.

-Kris Bahnsen
Technologic Systems



--- In  "tommessum" <> wrote:
>
> 
> 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/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU