This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.5.18: get strange characters from rs232-port on a Windows XP machine


Moritz Herrmann wrote:

> I'm working on a little c program to receive and save strings from the
> serial-port into a local file on a Windows XP/2003 Server machine.
> The program is working very well on a linux machine but if I try to run it
> under windows I just get stupid characters like:

If you want to use the serial port under Cygwin you need to open
/dev/ttyS1 and not "com2".  Remember that Cygwin is trying to emulate a
posix environment.

http://cygwin.com/cygwin-ug-net/using-specialnames.html

You can in fact open the serial devices as "com1", "com2" etc.  But in
doing so you implicily tell Cygwin that you are going to use Windows
native methods to access the port, and so things like tcgetattr() and
tcsetattr() will have no effect -- you would have to use the native
win32 API serial port functions.  That is why it only works if you first
initialize the port with hyperterminal.

Brian

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]