delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/02/19:10:24

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
Delivered-To: mailing list cygwin AT cygwin DOT com
Subject: problem with reading off windows serial port
To: cygwin AT cygwin DOT com
X-Mailer: Lotus Notes Release 5.0 (Intl) 30 March 1999
Message-ID: <OFD79A65FE.766A9FA9-ONE9256B35.00835EFB@int.csc.com.au>
From: nzissopo AT csc DOT com DOT au
Date: Thu, 3 Jan 2002 10:40:19 +1030
X-MIMETrack: Serialize by Router on AUS-SYD11/AUST/CSC(Release 5.0.4a |July 24, 2000) at
03-01-2002 11:11:02
MIME-Version: 1.0

Hi,

I have a query in regards to reading data off the serial port on a Windows
98 machine with cygwin.  The scenario is as follows:

I have a test program that opens a file descriptor (fd) on com1 via:

fd = open("com1", O_BINARY);

The port opens successfully.  Now there is a hardware device attached to
com1 that sends 1 byte of data at a time.  The test program attemps to read
the data from the serial port via:

no_of_bytes_received = read(fd, buffer, 1);

if (no_of_bytes_received == -1)
{
  cerr << "Read failed" << endl;
}
else
{
  cerr << "Read succeeded" << endl;
}

However, the read() call never completes, ie. in this case the if statement
is never executed.

Now I understand that read() behaves differently in cygwin than it does in
unix, as cygwin will block until the read completes.  However, in this case
because I am sending only 1 byte across the serial port, I would expect
cygwin to read the one byte, and complete, and hence execute the above if
statement.  This does not occur.  I may be overlooking something, but if
anyone can lead me in the right direction, I would be greatful!

Nick


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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