Hi,
I’m trying to save connected serialport name on mac.
If I connect serialport by index it reports name like:
usbserial-########
and input- and outputpath is /dev/cu.usbserial-########
and when I’m connecting by path it report name like:
/dev/cu.usbserial-########
and input- and outputpath are same.
And then there are also /dev/tty.usbserial-########
that works also.
I can live with that but why is it so? Can someone explain me why there is /dev/cu.* and /dev/tty.*
and why name property is different when connecting by index or by path?
Thanks
Jukka
About tty. and cu. I found this from Godfrey van der Linden
[quote]For those that are interested.
Serial ports are commonly misunderstood. Having been involved with them
for a while I thought I clear up some of the confusion (to that end I’m
cross posting this to darwin dev from the usb list thread).
The two ports are actually named after their traditional usage. A tty.*
port was intended to run getty on a directly connected terminal, a
terminal that, if wired correctly, asserts DTR (one of the RS232
signals). A getty process using a tty.* serial connection would block
in open until the TTY asserted DTR (that is the terminal was switched
on).
The cu (call unix) port was used mostly by the uucp family of unix
communication tools, that is the unix email system used before the
advent of the internet. To cause a typical modem to dial, it was
necessary to open the port without waiting for DTR, which is typically
only asserted one a connection has been established after dialing. WIth
an open port uucp could then issue an AT command and wait for a
connection with the other side. With an established connection the
modem asserts DTR, from that point on the cu and tty ports are exactly
the same. Note with many modems the DTR signal often tracks DCD
(carrier detect).
With either port type once a raised DTR signal is dropped the port is
disconnected and will start returning EIO errors. This is basically a
hint to the client process that things have come to an end and need to
terminate all processes in the process group connected to the terminal
port.
One problem with this basic design is that sometimes tty or other serial
devices are connected using only 3-wires, that is ground, txdata,
rxdata. In this case the standard tty port will not open. You have two
options in this circumstance. The more difficult option is to loopback
the DSR to the DTR on the computer side of the rs232 plug, or
alternatively you can open the port with O_NONBLOCK then use tcsetattr
to set the CLOCAL flag indicating that DTR should be ignore.
Finally although this is the canonical interface the only serial drivers
that I know implement the full RS232 signal protocol are Apple’s 16x50
drivers. I’m not sure how much of this signalling is implemented by
any other driver, so your milage will vary. In retrospect it perhaps
would have been a good idea to document this somewhere ;-).
Cheers
Godfrey[/quote]
But still I don’t know why:
StringValue = aSerialPort.Name
Stringvalue differs depending how I connect port:
System.SerialPort ( Index as Integer ) As SerialPort
or
System.SerialPort ( Path as String ) As SerialPort