Problem open(...) serial port /dev/com20 and tcgetattr(...)

Stan Pinte stan@sauvages.be
Wed Jan 17 09:48:00 GMT 2007


Hello,

accessing serial port under cygwin, with ids above 10 is broken:

Using "/dev/com20" results in a "No such file or directory" error.

#include <unistd.h>
#include <fcntl.h>
#include <termios.h>

int main (int argument_count, char * arguments [])   
{   
    printf("opening com20:");
    int fd = open("/dev/com20", O_RDONLY | O_NONBLOCK);   
    perror(NULL);
    struct termios options;
    int result = tcgetattr(fd, &options);
    perror(NULL);   
}

The following post:
http://www.cygwin.com/ml/cygwin/1999-12/msg00323.html says I should use

"\\\\.\\com20" instead of "/dev/com20". If I do that, the call to open(...) succeed, 
but the call to tcgetattr raises a "Inappropriate ioctl for device" error.

I checked the example using "/dev/com3", and it works all right, so the
issue is limited to ports id above 9.

I already checked the following posts:
http://sourceware.org/ml/insight/2004-q4/msg00078.html, so it seems to
be a bug.

Do you have a workaround for this?

Kind regards,

Stan.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20070117/ae40f12a/attachment.sig>


More information about the Cygwin mailing list