delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/27/18:36:38

X-Spam-Check-By: sourceware.org
Date: Wed, 27 Sep 2006 18:36:24 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: ahnkle <cygwin AT ekers DOT idps DOT co DOT uk>
cc: cygwin AT cygwin DOT com
Subject: Re: tcgetattr problem
In-Reply-To: <20060927193049.GA29552@flixx.linux.bogus>
Message-ID: <Pine.GSO.4.63.0609271833460.15013@access1.cims.nyu.edu>
References: <20060927193049 DOT GA29552 AT flixx DOT linux DOT bogus>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Wed, 27 Sep 2006, ahnkle wrote:

> hi
>
> I wrote a small program to test some serial stuff. I was puzzled because
> I recall that I was able to set baud rate on a serial port before, but
> now I cannot.
>
> I call tcgetattr() after I open the serial port, but it fails (the
> tcsetattr() also fails which first got my attention).
>
> I enclose a short example, and cygwin details, too. Any ideas?

Hmm...  Either you've asked this before, or I saw an almost exactly the
same program posted within the past month or two.  Quoting the first few
lines of your program:

#define PORT "com1"
...
  fd = open(PORT, O_RDWR | O_NOCTTY );

There's your problem.  When you open a port as "com1", it looks like a
file to Cygwin, since it doesn't recognize it as a valid device name.
Thus any attempt to manipulate that fd as a device will fail.

Use the Cygwin device (e.g., "/dev/ttyS0").
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019