« Return to Thread: Looking for basic documentation on Cygwin and Serial Ports

Re: Looking for basic documentation on Cygwin and Serial Ports

by Nefastor :: Rate this Message:

Reply to Author | View in Thread

Brian Dessent wrote:
Nefastor wrote:

> (...) I don't know which of Cygwin's /dev/tty device corresponds to which serial
> port on my PC (that is, I only know the COM port number). I can "sort of
> guess" /dev/tty0 is COM1, but that's a guess, and I'd prefer some certainty.

Cygwin works the same as Linux, /dev/ttyS0 is the first serial device,
/dev/ttyS1 is the second, etc.  Please consult the users guide:
<http://cygwin.com/cygwin-ug-net/using-specialnames.html>.
That I have, Brian. What itches me is that I'm facing some kind of special case : My machine has two serial port, one on the MoBo and a USB-serial adapter, yet Windows calls them COM1 and COM3. I've searched the whole Device Manager but couldn't find any device that would be COM2. And I can rename COM1 to COM2.

Speaking of Windows' DM, it's rather quirky on the serial ports : I noticed that if I unplug my USB cable (COM3) and try to change the name of COM1, in the drop down box COM3 is listed as "in use"  .

So, I have a machine with two serial ports but no COM2, AND I can change the COM port number to whatever I want, plus Windows seems to have a bad case of "phantom limb syndrome". Getting back to your answer : how can know for sure what Cygwin calls "the first port", or "the second port" ?

Trial and error is obviously not what I'm after, rather I need a way for my program to know for sure what port it's dealing with. To help me write that program I'd need to know :

- is there a fixed relationship between COM port number "X" and dev/ttyS number "Y", such as Y = X - 1 ? For instance, if I change my COM port number from 3 to 7, will the dev/ttyS number go from 2 to 6, or will it remain unchanged ?

- if it remains unchanged, I'm assuming Cygwin does some sort of port enumeration : is that process deterministic ?

Additionally, can you point me to documentation on how to retrieve device / driver info from my program ? That way, worst case scenario, I can have the program look for the correct port on its own.

Thank you for your time, I know I'm asking for a lot of stuff but I've got the feeling the answers would be useful to many.

Nefastor

 « Return to Thread: Looking for basic documentation on Cygwin and Serial Ports