delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/13/02:33:05

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-RAV-AntiVirus: This e-mail has been scanned for viruses on host: wg-ro-robe.inext.cz
Date: Mon, 13 Oct 2003 08:27:14 +0200
From: Martin Farnik <martin DOT farnik AT email DOT cz>
To: cygwin AT cygwin DOT com
Subject: tcflush hang problem
Message-Id: <20031013082714.77762606.martin.farnik@email.cz>
Mime-Version: 1.0

Hi.
I use CYGWIN_98-4.10 mine 1.5.5(0.94/3/2) 2003-09-20 16:31 i686 uknown unknown Cygwin

First i try to describe a situation:
I have a device which is connected with computer thru serial line.
Device is still sending data.These data isn't for my program.I have open com port and let them go into buffer . When a want to talk with device i flush input buffer,
send it a command paket and device stop sending data and wait  for my next command.
Problem is when I want to flush INPUTbuffer before I send a command. In this point it hangs, maybe for buffer full.
Here is piece of code:

-----I open port when i start program -----

 fd = open(PORT0, O_RDWR | O_NOCTTY );
 tcgetattr(fd,&oldtio); /* save current port settings */
        
        bzero(&newtio, sizeof(newtio));
        newtio.c_cflag = CS8 | CLOCAL | CREAD | CSTOPB;
        newtio.c_iflag = 0;
        newtio.c_oflag &= ~OPOST;
        newtio.c_lflag = 0;
         
        newtio.c_cc[VTIME]    = 1;  
        newtio.c_cc[VMIN]     = 0;   
        
	cfsetispeed(&newtio,B19200);
	cfsetospeed(&newtio,B19200);
        tcflush(fd, TCIFLUSH);
        tcsetattr(fd,TCSANOW,&newtio);
-------------------------------------------------
--this code is execute when a want to talk with device----

       tcflush(fd, TCIFLUSH);	    <--------- in this point where it hangs
	err = write (fd,iobuffer,10);


thank for help
			Marty

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019