597-599.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 122 行

HTML
122
字号
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Devices</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=33//-->

<!--PAGES=597-599//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="595-597.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="599-601.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading14"></A><FONT COLOR="#000077">Adding Serial Port Terminals</FONT></H4>

<P>You can use the serial ports on the PC to add remote terminals. The terminal can be a dedicated terminal or another PC running terminal-emulation software. Linux doesn&#146;t really care about the identity of the remote machine, except when it comes to sending instructions for screen displays.

</P>

<P>The wiring of cables between the remote terminal and the PC hosting the Linux operating system depends on the type of connectors at both ends. In most cases, the cable is a DTE- (Data Terminal Equipment) to-DTE type, although some terminals and PC serial ports require DCE (Data Communications Equipment) cabling. As a general rule, terminals and remote computers use DTE and modems use DCE. The difference between DTE and DCE cabling is in the way the wires run from each end connector.</P>

<P>When connecting a terminal, however, some of the pins must be crossed to permit signals to pass properly. The wiring of such a cable (often called a <I>null modem</I> cable or <I>hard wired</I> cable) requires several crosses or shorts to make the connection valid. Serial port connectors on a PC are either a DB9 (9-pin) or a DB25 (25-pin) connector. Not all of the wires in the 25-pin (or the 9-pin, for that matter) are required for a terminal device. A complete terminal cable can be made of only three pins (send, receive, and ground), although Linux also uses the Carrier Detect wire to tell when a terminal is attached and active.</P>

<P>A typical DCE cable (such as for a modem) uses straight-through wiring, meaning that pin 1 on the PC end goes to pin 1 on the modem end, pin 2 goes through to pin 2, and so on. This is called a <I>straight</I> cable (also called a <I>modem</I> cable by some). The important pins and their meanings for DTE (computer to terminal) 25-pin cables are shown in Table 33.1. The cable numbers are changed for 9-pin connectors, but the crossings are the same.</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 33.1.</B> DTE cables for a 25-pin connector.

<TR>

<TH COLSPAN="3"><HR>

<TR>

<TH WIDTH="25%" ALIGN="LEFT">Terminal Pin

<TH WIDTH="25%" ALIGN="LEFT">Computer Pin

<TH WIDTH="50%" ALIGN="LEFT">Meaning

<TR>

<TD COLSPAN="3"><HR>

<TR>

<TD>1

<TD>1

<TD>Ground

<TR>

<TD>2

<TD>3

<TD>Transmit data / receive data

<TR>

<TD>3

<TD>2

<TD>Receive data / transmit data

<TR>

<TD>4

<TD>4

<TD>Ready to send

<TR>

<TD>5

<TD>5

<TD>Clear to send

<TR>

<TD>6

<TD>20

<TD>Data set ready / data terminal ready

<TR>

<TD>7

<TD>7

<TD>Ground

<TR>

<TD>8

<TD VALIGN="TOP">20

<TD>Carrier detect / data terminal ready

<TR>

<TD VALIGN="TOP">20

<TD VALIGN="TOP">6, 8

<TD>Data terminal ready / data set ready, carrier detect

<TR>

<TD COLSPAN="3"><HR>

</TABLE>

<P>Because most users want to purchase premade cables to connect remote terminals, we won&#146;t deal with building your own cables. Instead, simply visit your local computer store and explain the equipment at both ends, as well as whether you have DB9 (9-pin) or DB25 (25-pin) connectors at each end. Also note whether the connectors at each end are male (pins sticking out) or female (no pins). Usually, the PC has male serial port connectors (requiring a female end on the cable) and a terminal has female connectors (requiring a male connector on the cable); but, if you&#146;re connecting a remote PC, you need female connectors at both ends.

</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>If the wiring of a cable isn&#146;t clearly indicated and the vendor doesn&#146;t know whether it&#146;s a straight-through or null modem cable, you might need to purchase a null modem device. A null modem is a short connector that has the pin crossings within it, effectively converting a straight-through cable to a null modem cable, and vice versa.<HR></FONT>

</BLOCKQUOTE>

<H4 ALIGN="LEFT"><A NAME="Heading15"></A><FONT COLOR="#000077">The Login Process</FONT></H4>

<P>To understand the files involved in a terminal configuration, it is useful to look at the process that occurs whenever a login occurs.

</P>

<P>The process begins with the <TT>/etc/init</TT> daemon executing when the Linux system is booted. The <TT>init</TT> daemon is responsible for running the <TT>/etc/getty</TT> program for each terminal that is connected to the system. The <TT>init</TT> daemon knows whether a terminal is connected because of entries in two files: <TT>/etc/ttys</TT> and <TT>/etc/inittab</TT>. The <TT>/etc/ttys</TT> file lists all ports on the system and the type of terminal that is connected. The <TT>/etc/inittab</TT> file has a complete list of all terminals and their parameters. We&#146;ll look at both files in more detail later, in the section &#147;Terminal Files: <TT>/etc/ttys</TT> and <TT>/etc/inittab</TT>.&#148;</P>

<P>When the <TT>/etc/ttys</TT> and <TT>/etc/inittab</TT> files indicate that a terminal is connected and active, the <TT>init</TT> daemon runs the <TT>/etc/getty</TT> program for that terminal. The <TT>getty</TT> program sets the communications parameters for the terminal and displays the login prompt on the screen.</P>

<P>When a user logs in on the terminal, the <TT>getty</TT> process executes the login program to request a password. The login program then validates the username and password against the entries in the <TT>/etc/passwd</TT> file. If the login is valid, the login program displays the message of the day (stored in the file <TT>/etc/motd</TT>) and executes whatever shell the user is supposed to run (as specified in <TT>/etc/passwd</TT>). Finally, the login program sets the <TT>TERM</TT> environment variable and exits.</P>

<P>When the login process terminates, the shell continues to execute and reads the startup files; then, it generates the shell prompt and waits for the user to issue instructions.</P>

<P>As you have seen, many files are involved in the startup process, all in the <TT>/etc</TT> direc-tory. We can look at the important files (at least for terminal characteristics) in more detail.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="595-597.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="599-601.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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