Subject: Re: which tty device files for talking to serial devices?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Bill Stouder-Studenmund <>
List: tech-userlevel
Date: 07/05/2007 14:03:27
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jun 23, 2007 at 08:40:26PM -0400, der Mouse wrote:
> > from reading tty(4) I understand that /dev/dty?? are the device files
> > one should use to talk to an external device connected to one of the
> > serial ports.  Is this correct?
> As I understand it, "maybe".
> My understanding is that /dev/dty* are the devices to use if the port
> in question is used for both dial-in and dial-out (or some comparable
> externally-vs-internally-initiated connection), and you're dialing out.
> This makes a difference in respects such as the port not needing
> carrier-detect in order to let the open succeed, and it locks out the
> /dev/tty* version for the duration of the call.
> If you're ignoring modem control, and/or don't have both incoming and
> outgoing on the same line, then I think you can use /dev/tty* and
> ignore /dev/dty*.
> My understanding may be wrong.

I believe your understanding is correct.

[for the original poster] /dev/tty* files came first, and they were part=20
of original Unix. You could hook lots of things up to serial ports,=20
including modems, tty's (as in the glass things people typed at) and other=

Since with modems and tty's, there may or may not be something there when=
you go to open the device, open() calls on ttys will block waiting for=20
something to be there (usually for CD to be asserted). You also can open=20
tty's such that they ignore modem control, so you can just talk to the=20

That was great. Decades passed. Then people wanted to do things like make
their modems dial out in addition to receiving calls. Think about a Fax
line. You want something there to receive faxes, but if nothing's there,
you want to be able to dial out & send a fax.

So Sun came up with /dev/dty* devices. You leave your fax-receiving=20
program using the normal tty (in blocking mode), and you use these new=20
devices, dty*, to send faxes.

If you aren't both dialing in and out, der Mouse is right that you can=20
ignore one or the other set of devices.

As for devices, MAKEDEV(8) is a little confusing. ttyC?? are the "com" =20
serial ports on certain architectures. Not i386 or amd64.  On i386 and
amd64, you just want "tty00" or "tty01". In other words, on i386 & amd64,=
the "native" serial ports are "com", and they are tty??.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.3 (NetBSD)