⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 term.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<div class="CALLOUTLIST"><dl compact="COMPACT"><dt><a href="term.html#CO-TTYS-LINE1COL1"><img src="./imagelib/callouts/1.png" hspace="0"vspace="0" border="0" alt="(1)" /></a></dt><dd>The first field normally specifies the name of the terminal special file as it isfound in <tt class="FILENAME">/dev</tt>.</dd><dt><a href="term.html#CO-TTYS-LINE1COL2"><img src="./imagelib/callouts/2.png" hspace="0"vspace="0" border="0" alt="(2)" /></a></dt><dd>The second field is the command to execute for this line, which is usually <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=getty&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">getty</span>(8)</span></a>. <ttclass="COMMAND">getty</tt> initializes and opens the line, sets the speed, prompts for auser name and then executes the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=login&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">login</span>(1)</span></a> program.</dd><dd><p>The <tt class="COMMAND">getty</tt> program accepts one (optional) parameter on itscommand line, the <var class="REPLACEABLE">getty</var> type. A <varclass="REPLACEABLE">getty</var> type configures characteristics on the terminal line,like bps rate and parity. The <tt class="COMMAND">getty</tt> program reads thesecharacteristics from the file <tt class="FILENAME">/etc/gettytab</tt>.</p></dd><dd><p>The file <tt class="FILENAME">/etc/gettytab</tt> contains lots of entries for terminallines both old and new. In almost all cases, the entries that start with the text <varclass="LITERAL">std</var> will work for hardwired terminals. These entries ignore parity.There is a <var class="LITERAL">std</var> entry for each bps rate from 110 to 115200. Ofcourse, you can add your own entries to this file. The <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=gettytab&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">gettytab</span>(5)</span></a> manualpage provides more information.</p></dd><dd><p>When setting the <var class="REPLACEABLE">getty</var> type in the <ttclass="FILENAME">/etc/ttys</tt> file, make sure that the communications settings on theterminal match.</p></dd><dd><p>For our example, the Wyse-50 uses no parity and connects at 38400&nbsp;bps. The286&nbsp;PC uses no parity and connects at 19200&nbsp;bps.</p></dd><dt><a href="term.html#CO-TTYS-LINE1COL3"><img src="./imagelib/callouts/3.png" hspace="0"vspace="0" border="0" alt="(3)" /></a></dt><dd>The third field is the type of terminal usually connected to that tty line. Fordial-up ports, <var class="LITERAL">unknown</var> or <var class="LITERAL">dialup</var> istypically used in this field since users may dial up with practically any type ofterminal or software. For hardwired terminals, the terminal type does not change, so youcan put a real terminal type from the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=termcap&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">termcap</span>(5)</span></a> databasefile in this field.</dd><dd><p>For our example, the Wyse-50 uses the real terminal type while the 286 PC running <bclass="APPLICATION">Procomm</b> will be set to emulate at VT-100.</p></dd><dt><a href="term.html#CO-TTYS-LINE1COL4"><img src="./imagelib/callouts/4.png" hspace="0"vspace="0" border="0" alt="(4)" /></a></dt><dd>The fourth field specifies if the port should be enabled. Putting <varclass="LITERAL">on</var> here will have the <tt class="COMMAND">init</tt> process startthe program in the second field, <tt class="COMMAND">getty</tt>. If you put <varclass="LITERAL">off</var> in this field, there will be no <tt class="COMMAND">getty</tt>,and hence no logins on the port.</dd><dt><a href="term.html#CO-TTYS-LINE1COL5"><img src="./imagelib/callouts/5.png" hspace="0"vspace="0" border="0" alt="(5)" /></a></dt><dd>The final field is used to specify whether the port is secure. Marking a port assecure means that you trust it enough to allow the <tt class="USERNAME">root</tt> account(or any account with a user ID of 0) to login from that port. Insecure ports do not allow<tt class="USERNAME">root</tt> logins. On an insecure port, users must login fromunprivileged accounts and then use <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=su&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">su</span>(1)</span></a> or a similarmechanism to gain superuser privileges.</dd><dd><p>It is highly recommended that you use ``insecure'' even for terminals that are behindlocked doors. It is quite easy to login and use <tt class="COMMAND">su</tt> if you needsuperuser privileges.</p></dd></dl></div></div></div><div class="SECT3"><h3 class="SECT3"><a id="TERM-HUP" name="TERM-HUP">20.3.2.2 Force <ttclass="COMMAND">init</tt> to Reread <tt class="FILENAME">/etc/ttys</tt></a></h3><p>After making the necessary changes to the <tt class="FILENAME">/etc/ttys</tt> file youshould send a SIGHUP (hangup) signal to the <tt class="COMMAND">init</tt> process toforce it to re-read its configuration file. For example:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kill -HUP 1</kbd></pre><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> <tt class="COMMAND">init</tt> is always the first process run on asystem, therefore it will always have PID 1.</p></blockquote></div><p>If everything is set up correctly, all cables are in place, and the terminals arepowered up, then a <tt class="COMMAND">getty</tt> process should be running on eachterminal and you should see login prompts on your terminals at this point.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="TERM-DEBUG" name="TERM-DEBUG">20.3.3 Troubleshooting YourConnection</a></h2><p>Even with the most meticulous attention to detail, something could still go wrongwhile setting up a terminal. Here is a list of symptoms and some suggested fixes.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN28916" name="AEN28916">20.3.3.1 No Login PromptAppears</a></h3><p>Make sure the terminal is plugged in and powered up. If it is a personal computeracting as a terminal, make sure it is running terminal emulation software on the correctserial port.</p><p>Make sure the cable is connected firmly to both the terminal and the FreeBSD computer.Make sure it is the right kind of cable.</p><p>Make sure the terminal and FreeBSD agree on the bps rate and parity settings. If youhave a video display terminal, make sure the contrast and brightness controls are turnedup. If it is a printing terminal, make sure paper and ink are in good supply.</p><p>Make sure that a <tt class="COMMAND">getty</tt> process is running and serving theterminal. For example, to get a list of running <tt class="COMMAND">getty</tt> processeswith <tt class="COMMAND">ps</tt>, type:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ps -axww|grep getty</kbd></pre><p>You should see an entry for the terminal. For example, the following display showsthat a <tt class="COMMAND">getty</tt> is running on the second serial port <varclass="LITERAL">ttyd1</var> and is using the <var class="LITERAL">std.38400</var> entryin <tt class="FILENAME">/etc/gettytab</tt>:</p><pre class="SCREEN">22189  d1  Is+    0:00.03 /usr/libexec/getty std.38400 ttyd1</pre><p>If no <tt class="COMMAND">getty</tt> process is running, make sure you have enabledthe port in <tt class="FILENAME">/etc/ttys</tt>. Also remember to run <ttclass="COMMAND">kill -HUP 1</tt> after modifying the <tt class="FILENAME">ttys</tt>file.</p><p>If the <tt class="COMMAND">getty</tt> process is running but the terminal still doesnot display a login prompt, or if it displays a prompt but will not allow you to type,your terminal or cable may not support hardware handshaking. Try changing the entry in<tt class="FILENAME">/etc/ttys</tt> from <var class="LITERAL">std.38400</var> to <varclass="LITERAL">3wire.38400</var> remember to run <tt class="COMMAND">kill -HUP 1</tt>after modifying <tt class="FILENAME">/etc/ttys</tt>). The <varclass="LITERAL">3wire</var> entry is similar to <var class="LITERAL">std</var>, butignores hardware handshaking. You may need to reduce the baud rate or enable softwareflow control when using <var class="LITERAL">3wire</var> to prevent buffer overflows.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN28949" name="AEN28949">20.3.3.2 If Garbage Appears Instead ofa Login Prompt</a></h3><p>Make sure the terminal and FreeBSD agree on the bps rate and parity settings. Checkthe <tt class="COMMAND">getty</tt> processes to make sure the correct <varclass="REPLACEABLE">getty</var> type is in use. If not, edit <ttclass="FILENAME">/etc/ttys</tt> and run <tt class="COMMAND">kill -HUP 1</tt>.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN28956" name="AEN28956">20.3.3.3 Characters Appear Doubled;the Password Appears When Typed</a></h3><p>Switch the terminal (or the terminal emulation software) from ``half duplex'' or``local echo'' to ``full duplex.''</p></div></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="serial.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="dialup.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Introduction</td><td width="34%" align="center" valign="top"><a href="serialcomms.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Dial-in Service</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -