Reading data from ttyS fails

thunderboy42 thunderboy42@cooltoad.com
Thu May 24 12:12:00 GMT 2012


I have an embedded system connectet with my PC which sends debug data over the
rs232. A simple terminal program unter cygwin is used to analyze this data.
before cygwin 1.7.10 evertything went fine, but now it seems, most transmitted
characters get lost. even this simple example from wikibooks does not work
anymore:

        ...
        memset(&tio,0,sizeof(tio));
        tio.c_iflag=0;
        tio.c_oflag=0;
        tio.c_cflag=CS8|CREAD|CLOCAL;  
        tio.c_lflag=0;
        tio.c_cc[VMIN]=1;
        tio.c_cc[VTIME]=5;

        tty_fd=open("/dev/ttyS0", O_RDWR | O_NONBLOCK);
        cfsetospeed(&tio,B115200);            // 115200 baud
        cfsetispeed(&tio,B115200);            // 115200 baud

        tcsetattr(tty_fd,TCSANOW,&tio);
        while (c!='q')
        {
                if (read(tty_fd,&c,1)>0)        write(STDOUT_FILENO,&c,1);
        }
        ...

So what can I do?
 

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list