Mail Archives: cygwin/2005/08/23/17:35:49
---559023410-342241519-1124832923=:27271
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: 8BIT
Ugh, top-posting. Reformatted...
On Tue, 23 Aug 2005, pppd wrote:
> De: cygwin-owner AT XXXXXX DOT XXX
> Para: "pppd" pppd AT XXXXX DOT XXX DOT XX
> Cópia: cygwin AT XXXXXX DOT XXX
<http://cygwin.com/acronyms/#PCYMTNQREAIYR>. Thanks.
> Data: Tue, 23 Aug 2005 15:08:59 -0400 (EDT)
> Assunto: Re: 1.5.18 ( 0.132/4/2 ) - read() - blocks ( serial programming )
>
> > On Tue, 23 Aug 2005, pppd wrote:
> >
> > > Hello guys,
> > >
> > > I´m working to convert a Linux application to work with
> > > Windows XP under Cygwin 1.5.18 ( 0.132/4/2 ). Ncurses package and
> > > parallel port programming works without changes ( congratulations ).
> > > I have a problem with serial programming.
> > >
> > > First, I did two C files: ( attached )
> > >
> > > setcmc7.c - Sets serial configuration through Win32 API. (
> > > Linux termios settings/functions doesn't work for me :-( ).
> > > cmc7.c - Read caracters from serial.
> > >
> > > After setting serial configuration by setcmc7.c I can read serial port
> > > using cmc7.
> > >
> > > My doubt is: Why read() function blocks the terminal (keyboard) until
> > > read a caracter ? At Linux it's work fine ( same code ).
> > >
> > > My application needs to read keyboard at the same time with serial.
> > > I have tried some flags with open ( O_NONBLOCK, O_NDELAY .. )
> > > unfortunately doesn't work too.
> > >
> > > Does anybody can help me please?
>
> Igor,
>
> Thanks for your advice.
>
> > I doubt the same code works on Linux, since open("COM1") will fail
> > there.
>
> It's work, of course we´ll need change "COM1" for "/dev/ttyS0" and will
> work on Linux.
Then why not use "/dev/ttyS0" on Cygwin?
> > You need to open something that Cygwin knows is a serial port, i.e.,
> > "/dev/ttyS0" (or "/dev/com1", but not "COM1").
>
> I already tried it with /dev/ttyS0 and /dev/COM1 but doesn't work
> too.
Please post the exact program that doesn't work for you (and that uses the
known Cygwin serial device).
> Unfortunately keeping blocking my keyboard. Do you have an example
> "without block" for serial ?
I don't understand what "without block" means. What is blocking?
Again, please post *code*, with expected results and actual results.
> BTW, "COM1" works for me like "/dev/com1" and "/dev/ttyS0" on Cygwin.
No it doesn't. You may think it does, because it still communicates with
the serial port, but as far as Cygwin is concerned, "COM1" is a *file*,
not a serial device, so you won't be able to set any serial parameters,
and the behavior is going to be unpredictable.
> > Plus, you can probably write setcmc7.c using Cygwin calls as well
> > (instead of Win32, that is).
> > Igor
>
> Keeping blocking.. :(
> Could you help me ?
When you have posted a small reproducible testcase, people will try it out
on their machines to determine whether this is a general Cygwin issue, or
something with your local configuration. But until we have the testcase,
it's impossible to debug this problem.
HTH,
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA
---559023410-342241519-1124832923=:27271
Content-Type: text/plain; charset=us-ascii
--
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/
---559023410-342241519-1124832923=:27271--
- Raw text -