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 Date: Tue, 27 Apr 2004 11:50:28 -0500 From: Brian Ford <ford AT vss DOT fsi DOT com> Reply-To: cygwin AT cygwin DOT com To: Jim Brain <brain AT jbrain DOT com> cc: cygwin AT cygwin DOT com Subject: Re: Need to replicate TIOCGICOUNT and TIOCMIWAIT on cygwin In-Reply-To: <loom.20040427T075714-582@post.gmane.org> Message-ID: <Pine.CYG.4.58.0404271140220.5560@fordpc.vss.fsi.com> References: <loom DOT 20040427T053617-292 AT post DOT gmane DOT org> <loom DOT 20040427T075714-582 AT post DOT gmane DOT org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes On Tue, 27 Apr 2004, Jim Brain wrote: > 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. cygwin_attach_handle_to_fd currently has little to no error checking. I'll see if I can make a patch to fix that if I have time. You could too if you are so inclined. > 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. http://cygwin.com/acronyms/#PTC > Anyone got any ideas? You didn't say what version of Cygwin you are using. Please see http://cygwin.com/problems.html for the details we need. AFAIK, the NtCreateFile change is a very recent one, only available in fairly recent snapshots. It has a bug in that it doesn't support win32 device paths and thus the internally defined path to the COM ports. Hopefully, that will be fixed soon. This is temporarily a bad time to be working on COM port stuff :-(. -- Brian Ford Senior Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International the best safety device in any aircraft is a well-trained pilot... -- 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/