Mail Archives: cygwin/2004/04/19/14:14:27
Hello,
thank you Dave, thank you Larry.
But unfortunately your advice to use "//./devX" did NOT solve the problem.
Dave:
Cygwin uses upto 16 COM ports, not only 8. I did not compile with
open("\\.\com8",...) but with open(buf,...) so I did not get
warnings from the compiler.
I corrected the examples below and got the result described.
What makes me nervous ist the errno = 20.
I must add that I use Win32-API to set baudrate and to read the modem
lines (DSR, DCD). I use the Win32 functions
GetCommModemStatus()
EscapeCommFunction()
GetCommState()
SetCommState()
in my program. That works fine as long as I use "/dev/comX" with X=1...16.
But it does not work with "//./comX".
I want to use (Windows-) COM port numbers greater
than 16, but when I use open() to get a file
descriptor for the devices I get the behaviour:
---1.case-----------------------------------------
errno = 0;
fd = open("/dev/com8", O_RDWR | O_NONBLOCK);
-> fd = 3, errno = 0
-> everything is OK,
I can use the opened COM port
---2.case-----------------------------------------
errno = 0;
fd = open("//./com8", O_RDWR | O_NONBLOCK);
-> fd = 3, errno = 20 = ERROR_BAD_UNIT
= "The system cannot find the device specified"
-> I can not use the opened COM port. The port
number 1...16 versus 17...255 does NOT matter.
---3.case-----------------------------------------
errno = 0;
fd = open("/dev/com23", O_RDWR | O_NONBLOCK);
-> fd = -1, errno = 2 = ERROR_FILE_NOT_FOUND
= "The system cannot find the file specified"
-> I can not use the opened COM port. The port
number 1...16 (OK) 17...255 (not OK) DOES matter.
---end cases------------------------------------
Is there a workaround?
Lutz Hoerl
Thorlabs GmbH
Gauss-Strasse 11
D-85757 Karlsfeld
Germany
Tel. +49 (0)8131 5956 44
FAX +49 (0)8131 5956 99
M A I L lhoerl at thorlabs dot com
--
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 -