Update Question 15.6:

- Point to Handbook for more up-to-date information

Reviewed by:  trhodes
Approved by:  gabor
This commit is contained in:
Gabor Pali 2008-07-05 02:45:41 +00:00
parent 51de441079
commit 224b0690dd
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=32454

View file

@ -9536,51 +9536,9 @@ hint.sio.7.irq="12"</programlisting>
</question>
<answer>
<para>The
<devicename>ttyd<replaceable>X</replaceable></devicename>
(or
<devicename>cuaa<replaceable>X</replaceable></devicename>)
device is the regular device you will want to open for
your applications. When a process opens the device, it
will have a default set of terminal I/O settings. You can
see these settings with the command</para>
<screen>&prompt.root; <userinput>stty -a -f /dev/ttyd1</userinput></screen>
<para>When you change the settings to this device, the settings
are in effect until the device is closed. When it is reopened,
it goes back to the default set. To make changes to the
default set, you can open and adjust the settings of the
<quote>initial state</quote> device. For example, to turn on
<acronym>CLOCAL</acronym> mode, 8 bits, and
<acronym>XON/XOFF</acronym> flow control by default for
ttyd5, do:</para>
<screen>&prompt.root; <userinput>stty -f /dev/ttyid5 clocal cs8 ixon ixoff</userinput></screen>
<para>A good place to do this is in
<filename>/etc/rc.serial</filename>. Now, an application
will have these settings by default when it opens
<filename>ttyd5</filename>. It can still change these
settings to its liking, though.</para>
<para>You can also prevent certain settings from being
changed by an application by making adjustments to the
<quote>lock state</quote> device. For example, to lock
the speed of <devicename>ttyd5</devicename> to 57600 bps,
do</para>
<screen>&prompt.root; <userinput>stty -f /dev/ttyld5 57600</userinput></screen>
<para>Now, an application that opens
<devicename>ttyd5</devicename> and tries to change the
speed of the port will be stuck with 57600 bps.</para>
<para>Naturally, you should make the initial state and lock
state devices writable only by
<username>root</username>. The &man.MAKEDEV.8; script does
<emphasis>NOT</emphasis> do this when it creates the
device entries.</para>
<para>See the <ulink
url="&url.books.handbook;/serial.html#SERIAL-HW-CONFIG">Serial Communications</ulink>
section in the &os; Handbook.</para>
</answer>
</qandaentry>