Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" 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 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 = ; quit = ; erase = ; kill = ; eof = > ; > swtch = ; susp = ; rprnt = ; werase = ; > lnext = ; flush = ; 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 . 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/