Larry Hall (Cygwin)
Wed Sep 27 23:17:00 GMT 2006
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
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
More information about the Cygwin