X-Spam-Check-By: sourceware.org Date: Wed, 27 Sep 2006 18:36:24 -0400 (EDT) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: ahnkle cc: cygwin AT cygwin DOT com Subject: Re: tcgetattr problem In-Reply-To: <20060927193049.GA29552@flixx.linux.bogus> Message-ID: References: <20060927193049 DOT GA29552 AT flixx DOT linux DOT bogus> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: Content-Disposition: INLINE Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 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/