delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/27/19:17:10

X-Spam-Check-By: sourceware.org
Message-ID: <451B0662.5020608@cygwin.com>
Date: Wed, 27 Sep 2006 19:16:50 -0400
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060727 Fedora/1.5.0.5-1.fc4.remi Thunderbird/1.5.0.5 Mnenhy/0.7.4.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: tcgetattr problem
References: <20060927193049 DOT GA29552 AT flixx DOT linux DOT bogus> <Pine DOT GSO DOT 4 DOT 63 DOT 0609271833460 DOT 15013 AT access1 DOT cims DOT nyu DOT edu> <20060927231017 DOT GC29552 AT flixx DOT linux DOT bogus>
In-Reply-To: <20060927231017.GC29552@flixx.linux.bogus>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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 09/27/2006, ahnkle wrote:
> On 18:36 Wed 27 Sep     , Igor Peshansky wrote:
> > > 
> > > #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").
> 
> Strangely, com1 *does* work in the call to open. Having tried "/dev/ttyS0",
> tcgetattr() works ok.
> 
> I also note that read() and write() work ok too using "com1", but
> tcsetattr() also fails.

"/dev/ttyS0" is an emulated device in Cygwin.  "com1" is a DOS/Windows device.
If you want POSIX behavior from a device, use the Cygwin emulated device.
Otherwise, you're stuck with DOS/Windows devices and their semantics.  That's
why "/dev/ttyS0" exists.  There's no magic here.  And there certainly isn't
any bug.

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

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