📄 printing-intro-setup.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Basic Setup</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="Printing" href="printing.html" /><link rel="PREVIOUS" title="Introduction" href="printing-intro-spooler.html" /><link rel="NEXT" title="Advanced Printer Setup" href="printing-advanced.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="printing-intro-spooler.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 11. Printing</td><td width="10%" align="right" valign="bottom"><a href="printing-advanced.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="PRINTING-INTRO-SETUP" name="PRINTING-INTRO-SETUP">11.3. BasicSetup</a></h1><p>To use printers with the <b class="APPLICATION">LPD</b> spooling system, you will needto set up both your printer hardware and the <b class="APPLICATION">LPD</b> software.This document describes two levels of setup:</p><ul><li><p>See section <a href="printing-intro-setup.html#PRINTING-SIMPLE">Simple PrinterSetup</a> to learn how to connect a printer, tell <b class="APPLICATION">LPD</b> how tocommunicate with it, and print plain text files to the printer.</p></li><li><p>See section <a href="printing-advanced.html">Advanced Printer Setup</a> to find outhow to print a variety of special file formats, to print header pages, to print across anetwork, to control access to printers, and to do printer accounting.</p></li></ul><div class="SECT2"><h2 class="SECT2"><a id="PRINTING-SIMPLE" name="PRINTING-SIMPLE">11.3.1. Simple PrinterSetup</a></h2><p>This section tells how to configure printer hardware and the <bclass="APPLICATION">LPD</b> software to use the printer. It teaches the basics:</p><ul><li><p>Section <a href="printing-intro-setup.html#PRINTING-HARDWARE">Hardware Setup</a> givessome hints on connecting the printer to a port on your computer.</p></li><li><p>Section <a href="printing-intro-setup.html#PRINTING-SOFTWARE">Software Setup</a> showshow to setup the <b class="APPLICATION">LPD</b> spooler configuration file (<ttclass="FILENAME">/etc/printcap</tt>).</p></li></ul><p>If you are setting up a printer that uses a network protocol to accept data to printinstead of a serial or parallel interface, see <ahref="printing-advanced.html#PRINTING-ADVANCED-NETWORK-NET-IF">Printers With NetworkedData Stream Interfaces</a>.</p><p>Although this section is called ``Simple Printer Setup'', it is actually fairlycomplex. Getting the printer to work with your computer and the <bclass="APPLICATION">LPD</b> spooler is the hardest part. The advanced options like headerpages and accounting are fairly easy once you get the printer working.</p><div class="SECT3"><h3 class="SECT3"><a id="PRINTING-HARDWARE" name="PRINTING-HARDWARE">11.3.1.1. HardwareSetup</a></h3><p>This section tells about the various ways you can connect a printer to your PC. Ittalks about the kinds of ports and cables, and also the kernel configuration you may needto enable FreeBSD to speak to the printer.</p><p>If you have already connected your printer and have successfully printed with it underanother operating system, you can probably skip to section <ahref="printing-intro-setup.html#PRINTING-SOFTWARE">Software Setup</a>.</p><div class="SECT4"><h4 class="SECT4"><a id="PRINTING-PORTS" name="PRINTING-PORTS">11.3.1.1.1. Ports andCables</a></h4><p>Nearly all printers you can get for a PC today support one or both of the followinginterfaces:</p><ul><li><p><span class="emphasis"><i class="EMPHASIS">Serial</i></span> interfaces use a serialport on your computer to send data to the printer. Serial interfaces are common in thecomputer industry and cables are readily available and also easy to construct. Serialinterfaces sometimes need special cables and might require you to configure somewhatcomplex communications options.</p></li><li><p><span class="emphasis"><i class="EMPHASIS">Parallel</i></span> interfaces use aparallel port on your computer to send data to the printer. Parallel interfaces arecommon in the PC market. Cables are readily available but more difficult to construct byhand. There are usually no communications options with parallel interfaces, making theirconfiguration exceedingly simple.</p><p>Parallel interfaces are sometimes known as ``Centronics'' interfaces, named after theconnector type on the printer.</p></li></ul><p>In general, serial interfaces are slower than parallel interfaces. Parallel interfacesusually offer just one-way communication (computer to printer) while serial gives youtwo-way. Newer parallel ports (EPP and ECP) and printers can communicate in bothdirections under FreeBSD when a IEEE1284 compliant cable is used.</p><p>Usually, the only time you need two-way communication with the printer is if theprinter speaks <span class="TRADEMARK">PostScript</span>®. <spanclass="TRADEMARK">PostScript</span> printers can be very verbose. In fact, <spanclass="TRADEMARK">PostScript</span> jobs are actually programs sent to the printer; theyneed not produce paper at all and may return results directly to the computer. <spanclass="TRADEMARK">PostScript</span> also uses two-way communication to tell the computerabout problems, such as errors in the <span class="TRADEMARK">PostScript</span> programor paper jams. Your users may be appreciative of such information. Furthermore, the bestway to do effective accounting with a <span class="TRADEMARK">PostScript</span> printerrequires two-way communication: you ask the printer for its page count (how many pages ithas printed in its lifetime), then send the user's job, then ask again for its pagecount. Subtract the two values and you know how much paper to charge the user.</p></div><div class="SECT4"><h4 class="SECT4"><a id="PRINTING-PARALLEL" name="PRINTING-PARALLEL">11.3.1.1.2. ParallelPorts</a></h4><p>To hook up a printer using a parallel interface, connect the Centronics cable betweenthe printer and the computer. The instructions that came with the printer, the computer,or both should give you complete guidance.</p><p>Remember which parallel port you used on the computer. The first parallel port is <ttclass="FILENAME">/dev/ppc0</tt> to FreeBSD; the second is <ttclass="FILENAME">/dev/ppc1</tt>, and so on. The printer device name uses the same scheme:<tt class="FILENAME">/dev/lpt0</tt> for the printer on the first parallel ports etc.</p></div><div class="SECT4"><h4 class="SECT4"><a id="PRINTING-SERIAL" name="PRINTING-SERIAL">11.3.1.1.3. SerialPorts</a></h4><p>To hook up a printer using a serial interface, connect the proper serial cable betweenthe printer and the computer. The instructions that came with the printer, the computer,or both should give you complete guidance.</p><p>If you are unsure what the ``proper serial cable'' is, you may wish to try one of thefollowing alternatives:</p><ul><li><p>A <span class="emphasis"><i class="EMPHASIS">modem</i></span> cable connects each pinof the connector on one end of the cable straight through to its corresponding pin of theconnector on the other end. This type of cable is also known as a ``DTE-to-DCE''cable.</p></li><li><p>A <span class="emphasis"><i class="EMPHASIS">null-modem</i></span> cable connects somepins straight through, swaps others (send data to receive data, for example), and shortssome internally in each connector hood. This type of cable is also known as a``DTE-to-DTE'' cable.</p></li><li><p>A <span class="emphasis"><i class="EMPHASIS">serial printer</i></span> cable, requiredfor some unusual printers, is like the null-modem cable, but sends some signals to theircounterparts instead of being internally shorted.</p></li></ul><p>You should also set up the communications parameters for the printer, usually throughfront-panel controls or DIP switches on the printer. Choose the highest <varclass="LITERAL">bps</var> (bits per second, sometimes <span class="emphasis"><iclass="EMPHASIS">baud rate</i></span>) rate that both your computer and the printer cansupport. Choose 7 or 8 data bits; none, even, or odd parity; and 1 or 2 stop bits. Alsochoose a flow control protocol: either none, or XON/XOFF (also known as ``in-band'' or``software'') flow control. Remember these settings for the software configuration thatfollows.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="PRINTING-SOFTWARE" name="PRINTING-SOFTWARE">11.3.1.2. SoftwareSetup</a></h3><p>This section describes the software setup necessary to print with the <bclass="APPLICATION">LPD</b> spooling system in FreeBSD.</p><p>Here is an outline of the steps involved:</p><div class="PROCEDURE"><ol type="1"><li><p>Configure your kernel, if necessary, for the port you are using for the printer;section <a href="printing-intro-setup.html#PRINTING-KERNEL">Kernel Configuration</a>tells you what you need to do.</p></li><li><p>Set the communications mode for the parallel port, if you are using a parallel port;section <a href="printing-intro-setup.html#PRINTING-PARALLEL-PORT-MODE">Setting theCommunication Mode for the Parallel Port</a> gives details.</p></li><li><p>Test if the operating system can send data to the printer. Section <ahref="printing-intro-setup.html#PRINTING-TESTING">Checking Printer Communications</a>gives some suggestions on how to do this.</p></li><li><p>Set up <b class="APPLICATION">LPD</b> for the printer by modifying the file <ttclass="FILENAME">/etc/printcap</tt>. You will find out how to do this later in thischapter.</p></li></ol></div><div class="SECT4"><h4 class="SECT4"><a id="PRINTING-KERNEL" name="PRINTING-KERNEL">11.3.1.2.1. KernelConfiguration</a></h4><p>The operating system kernel is compiled to work with a specific set of devices. Theserial or parallel interface for your printer is a part of that set. Therefore, it mightbe necessary to add support for an additional serial or parallel port if your kernel isnot already configured for one.</p><p>To find out if the kernel you are currently using supports a serial interface,type:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">grep sio<varclass="REPLACEABLE">N</var> /var/run/dmesg.boot</kbd></pre><p>Where <var class="REPLACEABLE">N</var> is the number of the serial port, starting fromzero. If you see output similar to the following:</p><pre class="SCREEN">sio2 at port 0x3e8-0x3ef irq 5 on isasio2: type 16550A</pre><p>then the kernel supports the port.</p><p>To find out if the kernel supports a parallel interface, type:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">grep ppc<varclass="REPLACEABLE">N</var> /var/run/dmesg.boot</kbd></pre><p>Where <var class="REPLACEABLE">N</var> is the number of the parallel port, startingfrom zero. If you see output similar to the following:</p><pre class="SCREEN">ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE modeppc0: FIFO with 16/16/8 bytes threshold</pre><p>then the kernel supports the port.</p><p>You might have to reconfigure your kernel in order for the operating system torecognize and use the parallel or serial port you are using for the printer.</p><p>To add support for a serial port, see the section on kernel configuration. To addsupport for a parallel port, see that section <span class="emphasis"><iclass="EMPHASIS">and</i></span> the section that follows.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="PRINTING-DEV-PORTS" name="PRINTING-DEV-PORTS">11.3.1.3. Adding<tt class="FILENAME">/dev</tt> Entries for the Ports</a></h3><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> FreeBSD 5.0 includes the <var class="LITERAL">devfs</var> filesystemwhich automatically creates device nodes as needed. If you are running a version ofFreeBSD with <var class="LITERAL">devfs</var> enabled then you can safely skip thissection.</p></blockquote></div><p>Even though the kernel may support communication along a serial or parallel port, youwill still need a software interface through which programs running on the system can
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -