?? 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="打印" href="printing.html" /><link rel="PREVIOUS" title="介紹" 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">后退</a></td><td width="80%" align="center" valign="bottom">章 9. 打印</td><td width="10%" align="right" valign="bottom"><a href="printing-advanced.html"accesskey="N">前進</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">9.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">9.3.1. Simple PrinterSetup</a></h2><p>This section tells how to configure printer hardware and the <b<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 set up 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">9.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">9.3.1.1.1. Ports andCables</a></h4><p>Printers sold for use on PC's today generally come with one or more of the followingthree interfaces:</p><ul><li><p><span class="emphasis"><i class="EMPHASIS">Serial</i></span> interfaces, also known asRS232C or RS232D, or COM ports, use a serial port on your computer to send data to theprinter. Serial interfaces are common in the computer industry and cables are readilyavailable and also easy to construct. Serial interfaces sometimes need special cables andmight require you to configure somewhat complex communications options. Most PC serialports have a maximum transmission rate of 115200 bps, which makes printing largegraphic print jobs with them impractical.</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 and are faster than RS232 serial. Cables are readily availablebut more difficult to construct by hand. There are usually no communications options withparallel interfaces, making their configuration exceedingly simple.</p><p>Parallel interfaces are sometimes known as ``Centronics'' interfaces, named after theconnector type on the printer.</p></li><li><p>USB interfaces, named for the Universal Serial Bus, can run at even faster speeds thanparallel or RS232 serial interfaces. Cables are simple and cheap. USB is superior toRS232 Serial and to Parallel for printing, but it is not as well supported under <spanclass="TRADEMARK">UNIX</span>® systems. A way to avoid this problem is to purchase aprinter that has both a USB interface and a Parallel interface, as many printers do.</p></li></ul><p>In general, Parallel interfaces usually offer just one-way communication (computer toprinter) while serial and USB gives you two-way. Newer parallel ports (EPP and ECP) andprinters can communicate in both directions under FreeBSD when a IEEE1284 compliant cableis used.</p><p>Two-way communication to the printer over a parallel port is generally done in one oftwo ways. The first method uses a custom built printer driver for FreeBSD that speaks theproprietary language used by the printer. This is common with inkjet printers and can beused for reporting ink levels and other status information. The second method is usedwhen the printer supports <span class="TRADEMARK">PostScript</span>®.</p><p><span class="TRADEMARK">PostScript</span> jobs are actually programs sent to theprinter; they need not produce paper at all and may return results directly to thecomputer. <span class="TRADEMARK">PostScript</span> also uses two-way communication totell the computer about problems, such as errors in the <spanclass="TRADEMARK">PostScript</span> program or paper jams. Your users may be appreciativeof such information. Furthermore, the best way to do effective accounting with a <spanclass="TRADEMARK">PostScript</span> printer requires two-way communication: you ask theprinter for its page count (how many pages it has printed in its lifetime), then send theuser's job, then ask again for its page count. Subtract the two values and you know howmuch paper to charge the user.</p></div><div class="SECT4"><h4 class="SECT4"><a id="PRINTING-PARALLEL" name="PRINTING-PARALLEL">9.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">9.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">9.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">9.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">9.3.1.3. Adding<tt class="FILENAME">/dev</tt> Entries for the Ports</a></h3><div class="NOTE"><blockquote class="NOTE">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -