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/