delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/04/27/02:02:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
To: cygwin AT cygwin DOT com
From: Jim Brain <brain AT jbrain DOT com>
Subject: Re: Need to replicate TIOCGICOUNT and TIOCMIWAIT on cygwin
Date: Tue, 27 Apr 2004 06:02:06 +0000 (UTC)
Lines: 43
Message-ID: <loom.20040427T075714-582@post.gmane.org>
References: <loom DOT 20040427T053617-292 AT post DOT gmane DOT org>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 12.217.179.222 (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322))

Jim Brain <brain <at> jbrain.com> writes:

> 
> I have an application that I need to port to windows, and it uses these two 
> Linux IOCTLs.  Specifically, the app needs to monitor the DSR line and signal 
> another process when it changes. 
> 
> I have migrated the rest of the app over with minimal work, but obviously 
> cygwin does not support linux/serial.h.  I am OK with a rewrite of this 
> function (the rest is working fine), and am also OK writing it in straight 
> Win32 calls, but I don't know how to relate my opened fd with a HANDLE to use 
> the relevant WIN32 calls. 
> 
> Of course, there might be a much easier way to monitor for changes to DSR 
line, 
> so I am up for an alternative (It would be nice to make the code portable to 
> *BSD* as well, which means losing this IOCTL), but I am lost at present.  Any 
> help would be appreciated.
> 
> I can send the current code to anyone who needs it.
> 
> Jim Brain

As a followup, I thought maybe I would use the Win32 API to open a serial port, 
use cygwin_attach_handle_to_fd() and save off both handles.  Then, when I need 
to WaitCommEvent, I'd use the HANDLE, otherwise, use the fd.  

Problem:

All the examples online use CreateFile, which I coded up, and cygwin gives me a 
fd of 8, but select returns immediately and I read -1 bytes on serial.  I 
looked at the cygwin source, which uses NtCreateFile, but I can't find headers 
or libraries for that. I am stumped.  I feel like I am so close...  It's rather 
a bummer there is a not a cygwin_get_win32_handle(int fd), as that is what I 
need.

Anyone got any ideas?

Jim






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