On Tue, 22 Aug 2006, Ernesto Paiser wrote:

> Hello Corinna,

FYI, this is a mailing list, and unless you're replying to a specific
message, you're actually talking to many people.

> I have problems with read() function blocking and
> waiting for characters on serial line with cygwin:
>
> Here are some code fragments:
> ========================================================
> fd = open(sl, O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY)
>
> newpio.c_cflag = brate | CS8 | CLOCAL | CREAD;
> newpio.c_iflag = IGNPAR | ICRNL;
> newpio.c_oflag = 0;
> newpio.c_lflag = 0;
> newpio.c_cc[VTIME]    = 1;
> newpio.c_cc[VMIN]     = 0;
> ...
>
> n = ioctl(fd, TIOCINQ, &n); //It gives me an error (return -1) why??!!!
>
> and
>
> n = read(fd, buffer, 1);  <<< HERE IS BLOCKING!!!
> ========================================================
>
> TIOCINQ is working on CYGWIN,
>
> Is there another way to solve this problem???

Please post a complete compilable test case that reproduces the problem.
For example, in the above code, it's unclear what the variable sl contains
(and I suspect it contains "COM1", which is a no-no -- you should be using
"/dev/ttyS0").
        Igor
-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_            [EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'           old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

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

Reply via email to