delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/19/15:35:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <494C0540.5000404@rettc.com>
Date: Fri, 19 Dec 2008 13:34:08 -0700
From: Alex Martin <alex AT rettc DOT com>
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: printf goes to serial port?
References: <494BE168 DOT 1020600 AT rettc DOT com> <E464473DC145404FBD632475DDAF55C6 AT DFW5RB41> <17393e3e0812191135v64035dfq1e8f25c2a352872 AT mail DOT gmail DOT com>
In-Reply-To: <17393e3e0812191135v64035dfq1e8f25c2a352872@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

Matt Wozniski wrote:
> On Fri, Dec 19, 2008 at 2:30 PM, Gary R. Van Sickle wrote:
>>> From: Alex Martin
>>>
>>> Hello,
>>>
>>> I have a cygwin environment, running some software I am
>>> writing to talk to some serial devices.
>>>
>>> Somehow, trying to debug why I could not see printf output to
>>> console, I ran a serial port sniffer and voila all of my
>>> printf commands are writing on the serial port.
>>>
>> I can't say that it would cross my mind to look for my missing printf output
>> on a serial port, even if I was using a serial port in other parts of the
>> program to talk to something.  Whatever it was that gave you the hunch to do
>> that is probably at the core of your problem.
> 
> My slightly wild guess is that you do an open() on the serial device
> without a controlling terminal and without passing the O_NOCTTY flag,
> causing the serial device to become your controlling terminal.
> 
> ~Matt
> 
Hello,

I do this:
//snip
     if (port == 1) {
        fd = ::open("/dev/ttyS0", O_NONBLOCK | O_RDWR | O_NOCTTY );
     }
//snip

Can you point me to some info about "controlling terminal"? I have been 
living in a strict c++/cygwin/fox-toolkit world and I am not familiar 
with terminals and things.

If I try to run my .exe from a cygwin prompt, it doesnt start up. If I 
run my exe from a cmd.exe window, it starts up my app but then returns 
to a prompt instead of staying open to catch printfs and such.

Any ideas?

Thanks for your help.

Alex Martin

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