delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/29/15:50:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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-Authenticated: #312426
Message-ID: <42EA870C.4070403@gmx.net>
Date: Fri, 29 Jul 2005 21:44:12 +0200
From: "H. Henning Schmidt" <hhschmidt AT gmx DOT net>
Reply-To: henning AT hhschmidt DOT de
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
MIME-Version: 1.0
To: mccarthy AT cs DOT bris DOT ac DOT uk, cygwin AT cygwin DOT com
Subject: RE: Serial Port Problems
X-Y-GMX-Trusted: 0

> Hi there,
>
> I have been experiencing some problems interfacing the serial ports on 
> two seperate systems: a windows 2000 PC and a windows XP laptop.  
> Basically, all I want to do is read some data from a device that is 
> connected to the serial port.
>
> I am using some code (that works under linux) to open the serial port 
> (/dev/ttyS0) as read-only and read the incoming data.  The setup of 
> the baud rate and flags seems to go smoothly, yet the program hangs on 
> the read() function.  However, I know that data is arriving because 
> HyperTerminal shows that it is there.
>
> stty gives some interesting results:
>
> $ stty -F /dev/ttyS0
> speed 0 baud; line = 0;
> intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = 
> <undef>;
> swtch = <undef>; susp = <undef>; rprnt = <undef>; werase = <undef>;
> lnext = <undef>; flush = <undef>; min = 0; time = 0;
> -cread
> -brkint -icrnl -imaxbel
> -opost -onlcr
> -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
>
> as well as:
>
> $ stty -F /dev/ttyS0 -a
> speed 0 baud;stty: /dev/ttyS0: Function not implemented
>
>
> Not sure if this is normal (a zero baud rate?).  The same results 
> occur on both systems.  Anyway, I have found a few posts that look 
> somewhat similar to my problem:
>
>   http://www.cygwin.com/ml/cygwin/1998-12/msg00695.html
>   http://www.cygwin.com/ml/cygwin/2002-01/msg00062.html
>   http://www.cygwin.com/ml/cygwin/2003-07/msg01312.html
>
> But no solutions posted.
>
> Any suggestions/comments would be greatly appreciated.

You can configure your serial port -attached file-desc to return after 
one single byte or after a timeout by configuring the appropriate 
members of the struct termios -member <c_cc>. Read 
http://www.easysw.com/~mike/serial/serial.html for details.

;Henning



-- 
H. Henning Schmidt
email: henning AT hhschmidt DOT de
phone: +49 (0) 6155 / 899 283
fax:   +49 (0) 6155 / 899 284


--
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