Serial Port Problems
H. Henning Schmidt
hhschmidt@gmx.net
Fri Jul 29 21:26:00 GMT 2005
> 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@hhschmidt.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/
More information about the Cygwin
mailing list