svn commit: r44529 - head/en_US.ISO8859-1/books/handbook/printing
Warren Block
wblock at FreeBSD.org
Fri Apr 11 13:48:55 UTC 2014
Author: wblock
Date: Fri Apr 11 13:48:55 2014
New Revision: 44529
URL: http://svnweb.freebsd.org/changeset/doc/44529
Log:
A from-scratch rewrite of the Printing chapter, designed to address
issues with the old chapter. It adds a quick-start section, simplifies
setup, vastly reduces the section on shared printers in schools and
businesses, and provides a framework that allows the addition of other
printing systems.
Reviewed by: freebsd-doc and IRC, no objections
Modified:
head/en_US.ISO8859-1/books/handbook/printing/chapter.xml
Modified: head/en_US.ISO8859-1/books/handbook/printing/chapter.xml
==============================================================================
--- head/en_US.ISO8859-1/books/handbook/printing/chapter.xml Fri Apr 11 02:10:56 2014 (r44528)
+++ head/en_US.ISO8859-1/books/handbook/printing/chapter.xml Fri Apr 11 13:48:55 2014 (r44529)
@@ -1,5033 +1,1142 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
- The FreeBSD Documentation Project
+ The FreeBSD Documentation Project
- $FreeBSD$
+ $FreeBSD$
-->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="printing">
- <info><title>Printing</title>
- <authorgroup>
- <author><personname><firstname>Sean</firstname><surname>Kelly</surname></personname><contrib>Contributed by </contrib></author>
- <!-- 30 Sept 1995 -->
- </authorgroup>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+ xml:id="printing">
+
+ <info>
+ <title>Printing</title>
+
<authorgroup>
- <author><personname><firstname>Jim</firstname><surname>Mock</surname></personname><contrib>Restructured and updated by </contrib></author>
+ <author>
+ <personname>
+ <firstname>Warren</firstname>
+ <surname>Block</surname>
+ </personname><contrib>Originally contributed by </contrib>
+ </author>
</authorgroup>
</info>
-
+ <para>Putting information on paper is a vital function, despite many
+ attempts to eliminate it. Printing has two basic components. The
+ data must be delivered to the printer, and must be in a form that
+ the printer can understand.</para>
+
+ <sect1 xml:id="printing-quick-start">
+ <title>Quick Start</title>
+
+ <para>Basic printing can be set up quickly. The printer must be
+ capable of printing plain <acronym>ASCII</acronym> text. For
+ printing to other types of files, see
+ <xref linkend="printing-lpd-filters"/>.</para>
+
+ <procedure>
+ <step>
+ <para>Create a directory to store files while they are being
+ printed:</para>
+
+ <screen>&prompt.root; <userinput>mkdir -p /var/spool/lpd/lp</userinput>
+&prompt.root; <userinput>chown daemon:daemon /var/spool/lpd/lp</userinput>
+&prompt.root; <userinput>chmod 770 /var/spool/lpd/lp</userinput></screen>
+ </step>
+
+ <step>
+ <para>As <systemitem class="username">root</systemitem>,
+ create <filename>/etc/printcap</filename> with these
+ contents:</para>
+
+ <programlisting>lp:\
+ <replaceable>:lp=/dev/unlpt0:\</replaceable> <co xml:id="printing-qs-co-printcap"/>
+ :sh:\
+ :mx#0:\
+ :sd=/var/spool/lpd/lp:\
+ :lf=/var/log/lpd-errs:</programlisting>
+
+ <calloutlist>
+ <callout arearefs="printing-qs-co-printcap">
+ <para>This line is for a printer connected to a
+ <acronym>USB</acronym> port.</para>
+
+ <para>For a printer connected to a parallel or
+ <quote>printer</quote> port, use:</para>
+
+ <programlisting>:lp=/dev/lpt0:\</programlisting>
+
+ <para>For a printer connected directly to a network,
+ use:</para>
+
+ <programlisting>:lp=:rm=<replaceable>network-printer-name</replaceable>:rp=raw:\</programlisting>
+
+ <para>Replace
+ <replaceable>network-printer-name</replaceable> with the
+ <acronym>DNS</acronym> host name of the network
+ printer.</para>
+ </callout>
+ </calloutlist>
+ </step>
+
+ <step>
+ <para>Enable <command>lpd</command> by editing
+ <filename>/etc/rc.conf</filename>, adding this line:</para>
+
+ <programlisting>lpd_enable="YES"</programlisting>
+
+ <para>Start the service:</para>
+
+ <screen>&prompt.root; <userinput>service lpd start</userinput>
+Starting lpd.</screen>
+ </step>
- <sect1 xml:id="printing-synopsis">
- <title>Synopsis</title>
+ <step>
+ <para>Print a test:</para>
- <indexterm><primary>LPD spooling system</primary></indexterm>
- <indexterm><primary>printing</primary></indexterm>
+ <screen>&prompt.root; <userinput>printf "1. This printer can print.\n2. This is the second line.\n" | lpr</userinput></screen>
+
+ <tip>
+ <para>If both lines do not start at the left border, but
+ <quote>stairstep</quote> instead, see
+ <xref linkend="printing-lpd-filters-stairstep"/>.</para>
+ </tip>
- <para>&os; can be used to print with a wide variety of printers,
- from the oldest impact printer to the latest laser printers,
- and everything in between, allowing you to produce high-quality
- printed output from the applications you run.</para>
-
- <para>&os; can also be configured to act as a print server on a
- network; in this capacity &os; can receive print jobs from a
- variety of other computers, including other &os; computers,
- &windows; and &macos; hosts. &os; will ensure that one job
- at a time is printed, and can keep statistics on which users
- and machines are doing the most printing, produce
- <quote>banner</quote> pages showing whose printout is whose,
- and more.</para>
-
- <para>After reading this chapter, you will know:</para>
-
- <itemizedlist>
- <listitem>
- <para>How to configure the &os; print spooler.</para>
- </listitem>
-
- <listitem>
- <para>How to install print filters, to handle special print
- jobs differently, including converting incoming documents
- to print formats that your printers understand.</para>
- </listitem>
-
- <listitem>
- <para>How to enable header, or banner pages on your
- printout.</para>
- </listitem>
-
- <listitem>
- <para>How to print with printers connected to other
- computers.</para>
- </listitem>
-
- <listitem>
- <para>How to print with printers connected directly to the
- network.</para>
- </listitem>
-
- <listitem>
- <para>How to control printer restrictions, including limiting
- the size of print jobs, and preventing certain users from
- printing.</para>
- </listitem>
-
- <listitem>
- <para>How to keep printer statistics, and account for printer
- usage.</para>
- </listitem>
-
- <listitem>
- <para>How to troubleshoot printing problems.</para>
- </listitem>
- </itemizedlist>
-
- <para>Before reading this chapter, you should:</para>
-
- <itemizedlist>
- <listitem>
- <para>Know how to configure and install a new kernel
- (<xref linkend="kernelconfig"/>).</para>
- </listitem>
- </itemizedlist>
+ <para>Text files can now be printed with
+ <command>lpr</command>. Give the filename on the command
+ line, or pipe output directly into
+ <command>lpr</command>.</para>
+
+ <screen>&prompt.user; <userinput>lpr textfile.txt</userinput>
+&prompt.user; <userinput>ls -lh | lpr</userinput></screen>
+ </step>
+ </procedure>
</sect1>
- <sect1 xml:id="printing-intro-spooler">
- <title>Introduction</title>
+ <sect1 xml:id="printing-connections">
+ <title>Printer Connections</title>
- <para>In order to use printers with &os; you may set them up to
- work with the Berkeley line printer spooling system, also known
- as the <application>LPD</application> spooling system, or just
- <application>LPD</application>. It is the standard printer
- control system in &os;. This chapter introduces
- <application>LPD</application> and will guide you through its
- configuration.</para>
-
- <para>If you are already familiar with
- <application>LPD</application> or another printer spooling
- system, you may wish to skip to section <link linkend="printing-intro-setup">Basic Setup</link>.</para>
-
- <para><application>LPD</application> controls everything about
- a host's printers. It is responsible for a number of
- things:</para>
-
- <itemizedlist>
- <listitem>
- <para>It controls access to attached printers and printers
- attached to other hosts on the network.</para>
- </listitem>
-
- <listitem>
- <para>It enables users to submit files to be printed; these
- submissions are known as <emphasis>jobs</emphasis><indexterm><primary>print jobs</primary></indexterm>.</para>
- </listitem>
-
- <listitem>
- <para>It prevents multiple users from accessing a printer at
- the same time by maintaining a <emphasis>queue</emphasis>
- for each printer.</para>
- </listitem>
-
- <listitem>
- <para>It can print <emphasis>header pages</emphasis> (also
- known as <emphasis>banner</emphasis> or
- <emphasis>burst</emphasis> pages) so users can easily find
- jobs they have printed in a stack of printouts.</para>
- </listitem>
-
- <listitem>
- <para>It takes care of communications parameters for printers
- connected on serial ports.</para>
- </listitem>
-
- <listitem>
- <para>It can send jobs over the network to a
- <application>LPD</application> spooler on another
- host.</para>
- </listitem>
-
- <listitem>
- <para>It can run special filters to format jobs to be printed
- for various printer languages or printer
- capabilities.</para>
- </listitem>
-
- <listitem>
- <para>It can account for printer usage.</para>
- </listitem>
- </itemizedlist>
-
- <para>Through a configuration file
- (<filename>/etc/printcap</filename>), and by providing the
- special filter programs, you can enable the
- <application>LPD</application> system to do all or some subset
- of the above for a great variety of printer hardware.</para>
+ <para>Printers are connected to computer systems in a variety of
+ ways. Small desktop printers are usually connected directly to
+ computer's <acronym>USB</acronym> port. Older printers are
+ connected to a parallel or <quote>printer</quote> port. Some
+ printers are directly connected to a network, making it easy for
+ multiple computers share them. A few printers use a much less
+ common serial port connection.</para>
- <sect2 xml:id="printing-intro-why">
- <title>Why You Should Use the Spooler</title>
+ <para>&os; can communicate with all of these types of
+ printers.</para>
- <para>The spooler still provides benefit on a single-user system
- and should be used because:</para>
+ <variablelist>
+ <varlistentry xml:id="printing-connections-usb">
+ <term><acronym>USB</acronym></term>
- <itemizedlist>
<listitem>
- <para><application>LPD</application> prints jobs in the
- background; you do not have to wait for data to be copied
- to the printer.</para>
+ <para><acronym>USB</acronym> printers can be connected to
+ any available <acronym>USB</acronym> port on the
+ computer.</para>
+
+ <para>When &os; detects a <acronym>USB</acronym> printer,
+ two device entries are created:
+ <filename>/dev/ulpt0</filename> and
+ <filename>/dev/unlpt0</filename>. Data sent to either
+ device will be relayed to the printer. After each print
+ job, <filename>ulpt0</filename> resets the
+ <acronym>USB</acronym>port. Resetting the port can cause
+ problems with some printers, so the
+ <filename>unlpt0</filename> device is used instead.
+ <filename>unlpt0</filename> does not reset the USB port at
+ all.</para>
</listitem>
+ </varlistentry>
- <listitem>
- <para><application>LPD</application> can conveniently run
- a job to be printed through filters to add date/time
- headers or convert a special file format (such as a &tex;<indexterm><primary>&tex;</primary></indexterm>
- DVI file) into a format the printer will understand.
- You will not have to do these steps manually.</para>
- </listitem>
+ <varlistentry xml:id="printing-connections-parallel">
+ <term>Parallel (<acronym>IEEE</acronym>-1284)</term>
<listitem>
- <para>Many free and commercial programs that provide a print
- feature usually expect to talk to the spooler on your
- system. By setting up the spooling system, you will more
- easily support other software you may later add or already
- have.</para>
+ <para>The parallel port device is
+ <filename>/dev/lpt0</filename>. This device appears
+ whether a printer is attached or not, it is not
+ autodetected.</para>
+
+ <para>Vendors have largely moved away from these
+ <quote>legacy</quote> ports, and many computers no longer
+ have them. Adapters can be used to connect a parallel
+ printer to a <acronym>USB</acronym> port. With such an
+ adapter, the printer can be treated as if it were actually
+ a <acronym>USB</acronym> printer. Devices called
+ <emphasis>print servers</emphasis> can also be used to
+ connect parallel printers directly to a network.</para>
</listitem>
- </itemizedlist>
- </sect2>
- </sect1>
-
- <sect1 xml:id="printing-intro-setup">
- <title>Basic Setup</title>
-
- <para>To use printers with the <application>LPD</application>
- spooling system, you will need to set up both your printer
- hardware and the <application>LPD</application> software. This
- document describes two levels of setup:</para>
-
- <itemizedlist>
- <listitem>
- <para>See section <link linkend="printing-simple">Simple
- Printer Setup</link> to learn how to connect a printer,
- tell <application>LPD</application> how to communicate with
- it, and print plain text files to the printer.</para>
- </listitem>
-
- <listitem>
- <para>See section <link linkend="printing-advanced">Advanced
- Printer Setup</link> to learn how to print a variety of
- special file formats, to print header pages, to print across
- a network, to control access to printers, and to do printer
- accounting.</para>
- </listitem>
- </itemizedlist>
-
- <sect2 xml:id="printing-simple">
- <title>Simple Printer Setup</title>
-
- <para>This section tells how to configure printer hardware
- and the <application>LPD</application> software to use the
- printer. It teaches the basics:</para>
+ </varlistentry>
- <itemizedlist>
- <listitem>
- <para>Section <link linkend="printing-hardware">Hardware
- Setup</link> gives some hints on connecting the printer
- to a port on your computer.</para>
- </listitem>
+ <varlistentry xml:id="printing-connections-serial">
+ <term>Serial (RS-232)</term>
<listitem>
- <para>Section <link linkend="printing-software">Software
- Setup</link> shows how to set up the
- <application>LPD</application> spooler configuration
- file (<filename>/etc/printcap</filename>).</para>
+ <para>Serial ports are another legacy port, rarely used for
+ printers except in certain niche applications. Cables,
+ connectors, and required wiring vary widely.</para>
+
+ <para>For serial ports built into a motherboard, the serial
+ device name is <filename>/dev/cuau0</filename> or
+ <filename>/dev/cuau1</filename>. Serial
+ <acronym>USB</acronym> adapters can also be used, and
+ these will appear as
+ <filename>/dev/cuaU<replaceable>0</replaceable></filename>.</para>
+
+ <para>Several communication parameters must be known to
+ communicate with a serial printer. The most important are
+ <emphasis>baud rate</emphasis> and
+ <emphasis>parity</emphasis>. Values vary, but typical
+ serial printers often use a baud rate of 9600 and no
+ parity.</para>
</listitem>
- </itemizedlist>
-
- <para>If you are setting up a printer that uses a network
- protocol to accept data to print instead of a computer's local
- interfaces, see <link linkend="printing-advanced-network-net-if">Printers With
- Networked Data Stream Interfaces</link>.</para>
-
- <para>Although this section is called <quote>Simple Printer
- Setup</quote>, it is actually fairly complex. Getting the
- printer to work with your computer and the
- <application>LPD</application> spooler is the hardest part.
- The advanced options like header pages and accounting are
- fairly easy once you get the printer working.</para>
-
- <sect3 xml:id="printing-hardware">
- <title>Hardware Setup</title>
-
- <para>This section tells about the various ways you can
- connect a printer to your PC. It talks about the kinds of
- ports and cables, and also the kernel configuration you may
- need to enable &os; to speak to the printer.</para>
-
- <para>If you have already connected your printer and have
- successfully printed with it under another operating system,
- you can probably skip to section <link linkend="printing-software">Software Setup</link>.</para>
-
- <sect4 xml:id="printing-ports">
- <title>Ports and Cables</title>
-
- <para>Printers sold for use on PC's today generally come
- with one or more of the following three interfaces:</para>
-
- <itemizedlist>
- <listitem>
- <para><emphasis>Serial</emphasis><indexterm><primary>printers</primary><secondary>serial</secondary></indexterm> interfaces, also known
- as RS-232 or COM ports, use a serial port
- on your computer to send data to the printer. Serial
- interfaces are common in the computer industry and
- cables are readily available and also easy to
- construct. Serial interfaces sometimes need special
- cables and might require you to configure somewhat
- complex communications options. Most PC serial ports
- have a maximum transmission rate of 115200 bps,
- which makes printing large graphic print jobs with
- them impractical.</para>
- </listitem>
-
- <listitem>
- <para><emphasis>Parallel</emphasis><indexterm><primary>printers</primary><secondary>parallel</secondary></indexterm> interfaces use a
- parallel port on your computer to send data to the
- printer. Parallel interfaces are common in the PC
- market and are faster than RS-232 serial. Cables are
- readily available but more difficult to construct by
- hand. There are usually no communications options
- with parallel interfaces, making their configuration
- exceedingly simple.</para>
-
- <para>Parallel interfaces are sometimes known as
- <quote>Centronics</quote><indexterm><primary>centronics</primary><see>parallel printers</see></indexterm> interfaces, named after the
- connector type on the printer.</para>
- </listitem>
-
- <listitem>
- <para>USB<indexterm><primary>printers</primary><secondary>USB</secondary></indexterm> interfaces, named for the Universal Serial
- Bus, can run at even faster speeds than parallel or
- RS-232 serial interfaces. Cables are simple and
- cheap. USB is superior to RS-232 Serial and to
- Parallel for printing, but it is not as well supported
- under &unix; systems. A way to avoid this problem is
- to purchase a printer that has both a USB interface
- and a Parallel interface, as many printers do.</para>
- </listitem>
- </itemizedlist>
-
- <para>In general, Parallel interfaces usually offer just
- one-way communication (computer to printer) while serial
- and USB gives you two-way. Newer parallel ports (EPP and
- ECP) and printers can communicate in both directions under
- &os; when a IEEE-1284-compliant cable is used.</para>
-
- <indexterm><primary>PostScript</primary></indexterm>
-
- <para>Two-way communication to the printer over a parallel
- port is generally done in one of two ways. The first
- method uses a custom-built printer driver for &os; that
- speaks the proprietary language used by the printer. This
- is common with inkjet printers and can be used for
- reporting ink levels and other status information. The
- second method is used when the printer supports
- &postscript;.</para>
-
- <para>&postscript; jobs are actually programs sent to the
- printer; they need not produce paper at all and may return
- results directly to the computer. &postscript; also uses
- two-way communication to tell the computer about problems,
- such as errors in the &postscript; program or paper jams.
- Your users may be appreciative of such information.
- Furthermore, the best way to do effective accounting with
- a &postscript; printer requires two-way communication:
- you ask the printer for its page count (how many pages
- it has printed in its lifetime), then send the user's job,
- then ask again for its page count. Subtract the two
- values and you know how much paper to charge to the
- user.</para>
- </sect4>
-
- <sect4 xml:id="printing-parallel">
- <title>Parallel Ports</title>
-
- <para>To hook up a printer using a parallel interface,
- connect the Centronics cable between the printer and the
- computer. The instructions that came with the printer,
- the computer, or both should give you complete
- guidance.</para>
-
- <para>Remember which parallel port you used on the computer.
- The first parallel port is
- <filename>ppc0</filename> to &os;;
- the second is <filename>ppc1</filename>, and so on. The
- printer device name uses the same scheme:
- <filename>/dev/lpt0</filename> for
- the printer on the first parallel ports etc.</para>
- </sect4>
-
- <sect4 xml:id="printing-serial">
- <title>Serial Ports</title>
-
- <para>To hook up a printer using a serial interface, connect
- the proper serial cable between the printer and the
- computer. The instructions that came with the printer,
- the computer, or both should give you complete
- guidance.</para>
-
- <para>If you are unsure what the <quote>proper serial
- cable</quote> is, you may wish to try one of the
- following alternatives:</para>
-
- <itemizedlist>
- <listitem>
- <para>A <emphasis>modem</emphasis> cable connects each
- pin of the connector on one end of the cable straight
- through to its corresponding pin of the connector on
- the other end. This type of cable is also known as a
- <quote>DTE-to-DCE</quote> cable.</para>
- </listitem>
-
- <listitem>
- <para>A <emphasis>null-modem</emphasis> cable<indexterm><primary>null-modem cable</primary></indexterm> connects
- some pins straight through, swaps others (send data to
- receive data, for example), and shorts some internally
- in each connector hood. This type of cable is also
- known as a <quote>DTE-to-DTE</quote> cable.</para>
- </listitem>
-
- <listitem>
- <para>A <emphasis>serial printer</emphasis> cable,
- required for some unusual printers, is like the
- null-modem cable, but sends some signals to their
- counterparts instead of being internally
- shorted.</para>
- </listitem>
- </itemizedlist>
-
- <indexterm><primary>baud rate</primary></indexterm>
- <indexterm><primary>parity</primary></indexterm>
- <indexterm><primary>flow control
- protocol</primary></indexterm>
- <para>You should also set up the communications parameters
- for the printer, usually through front-panel controls or
- DIP switches on the printer. Choose the highest
- <literal>bps</literal> (bits per second, sometimes
- <emphasis>baud rate</emphasis>) that both your computer
- and the printer can support. Choose 7 or 8 data bits;
- none, even, or odd parity; and 1 or 2 stop bits. Also
- choose a flow control protocol: either none, or XON/XOFF
- (also known as <quote>in-band</quote> or
- <quote>software</quote>) flow control. Remember these
- settings for the software configuration that
- follows.</para>
- </sect4>
- </sect3>
-
- <sect3 xml:id="printing-software">
- <title>Software Setup</title>
-
- <para>This section describes the software setup necessary
- to print with the <application>LPD</application> spooling
- system in &os;.</para>
-
- <para>Here is an outline of the steps involved:</para>
-
- <procedure>
- <step>
- <para>Configure your kernel, if necessary, for the port
- you are using for the printer; section <link linkend="printing-kernel">Kernel Configuration</link>
- tells you what you need to do.</para>
- </step>
-
- <step>
- <para>Set the communications mode for the parallel port,
- if you are using a parallel port; section <link linkend="printing-parallel-port-mode">Setting the
- Communication Mode for the Parallel Port</link> gives
- details.</para>
- </step>
-
- <step>
- <para>Test if the operating system can send data to the
- printer. Section <link linkend="printing-testing">Checking Printer
- Communications</link> gives some suggestions on how to
- do this.</para>
- </step>
-
- <step>
- <para>Set up <application>LPD</application> for the
- printer by modifying the file
- <filename>/etc/printcap</filename>. You will find out
- how to do this later in this chapter.</para>
- </step>
- </procedure>
-
- <sect4 xml:id="printing-kernel">
- <title>Kernel Configuration</title>
-
- <para>The operating system kernel is compiled to work with
- a specific set of devices. The serial or parallel
- interface for your printer is a part of that set.
- Therefore, it might be necessary to add support for an
- additional serial or parallel port if your kernel is not
- already configured for one.</para>
-
- <para>To find out if the kernel you are currently using
- supports a serial interface, type:</para>
-
- <screen>&prompt.root; <userinput>grep sioN /var/run/dmesg.boot</userinput></screen>
-
- <para>Where <replaceable>N</replaceable> is the number of
- the serial port, starting from zero. If you see output
- similar to the following:</para>
-
- <screen>sio2 at port 0x3e8-0x3ef irq 5 on isa
-sio2: type 16550A</screen>
-
- <para>then the kernel supports the port.</para>
-
- <para>To find out if the kernel supports a parallel
- interface, type:</para>
-
- <screen>&prompt.root; <userinput>grep ppcN /var/run/dmesg.boot</userinput></screen>
-
- <para>Where <replaceable>N</replaceable> is the number of
- the parallel port, starting from zero. If you see output
- similar to the following:</para>
-
- <screen>ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
-ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
-ppc0: FIFO with 16/16/8 bytes threshold</screen>
-
- <para>then the kernel supports the port.</para>
-
- <para>You might have to reconfigure your kernel in order
- for the operating system to recognize and use the parallel
- or serial port you are using for the printer.</para>
-
- <para>To add support for a serial port, see the section on
- kernel configuration. To add support for a parallel port,
- see that section <emphasis>and</emphasis> the section that
- follows.</para>
- </sect4>
- </sect3>
-
- <sect3 xml:id="printing-parallel-port-mode">
- <title>Setting the Communication Mode for the Parallel
- Port</title>
-
- <para>When you are using the parallel interface, you can
- choose whether &os; should use interrupt-driven or polled
- communication with the printer. The generic printer
- device driver (&man.lpt.4;) on &os;
- uses the &man.ppbus.4; system, which controls the port
- chipset with the &man.ppc.4; driver.</para>
-
- <itemizedlist>
- <listitem>
- <para>The <emphasis>interrupt-driven</emphasis> method
- is the default with the GENERIC kernel. With this
- method, the operating system uses an IRQ line to
- determine when the printer is ready for data.</para>
- </listitem>
-
- <listitem>
- <para>The <emphasis>polled</emphasis> method directs the
- operating system to repeatedly ask the printer if it is
- ready for more data. When it responds ready, the kernel
- sends more data.</para>
- </listitem>
- </itemizedlist>
-
- <para>The interrupt-driven method is usually somewhat faster
- but uses up a precious IRQ line. Some newer HP printers
- are claimed not to work correctly in interrupt mode,
- apparently due to some (not yet exactly understood) timing
- problem. These printers need polled mode. You should use
- whichever one works. Some printers will work in both
- modes, but are painfully slow in interrupt mode.</para>
-
- <para>You can set the communications mode in two ways: by
- configuring the kernel or by using the &man.lptcontrol.8;
- program.</para>
-
- <para><emphasis>To set the communications mode by configuring
- the kernel:</emphasis></para>
-
- <procedure>
- <step>
- <para>Edit your kernel configuration file. Look for
- an <literal>ppc0</literal> entry. If you are setting up
- the second parallel port, use <literal>ppc1</literal>
- instead. Use <literal>ppc2</literal> for the third
- port, and so on.</para>
-
- <itemizedlist>
- <listitem>
- <para>If you want interrupt-driven mode, edit the
- following line:</para>
-
- <programlisting>hint.ppc.0.irq="<replaceable>N</replaceable>"</programlisting>
-
- <para>in the <filename>/boot/device.hints</filename>
- file and replace <replaceable>N</replaceable> with
- the right IRQ number. The kernel configuration file
- must also contain the &man.ppc.4; driver:</para>
-
- <screen>device ppc</screen>
- </listitem>
-
- <listitem>
- <para>If you want polled mode, remove in your
- <filename>/boot/device.hints</filename> file, the
- following line:</para>
-
- <programlisting>hint.ppc.0.irq="<replaceable>N</replaceable>"</programlisting>
-
- <para>In some cases, this is not enough to put the
- port in polled mode under &os;. Most of
- time it comes from &man.acpi.4; driver, this latter
- is able to probe and attach devices, and therefore,
- control the access mode to the printer port. You
- should check your &man.acpi.4; configuration to
- correct this problem.</para>
- </listitem>
- </itemizedlist>
- </step>
-
- <step>
- <para>Save the file. Then configure, build, and install
- the kernel, then reboot. See <link linkend="kernelconfig">kernel configuration</link>
- for more details.</para>
- </step>
- </procedure>
-
- <para><emphasis>To set the communications mode with</emphasis>
- &man.lptcontrol.8;:</para>
-
- <procedure>
- <step>
- <para>Type:</para>
-
- <screen>&prompt.root; <userinput>lptcontrol -i -d /dev/lptN</userinput></screen>
-
- <para>to set interrupt-driven mode for
- <literal>lptN</literal>.</para>
- </step>
-
- <step>
- <para>Type:</para>
-
- <screen>&prompt.root; <userinput>lptcontrol -p -d /dev/lptN</userinput></screen>
-
- <para>to set polled-mode for
- <literal>lptN</literal>.</para>
- </step>
- </procedure>
-
- <para>You could put these commands in your
- <filename>/etc/rc.local</filename> file to set the mode each
- time your system boots. See &man.lptcontrol.8; for more
- information.</para>
- </sect3>
-
- <sect3 xml:id="printing-testing">
- <title>Checking Printer Communications</title>
-
- <para>Before proceeding to configure the spooling system, you
- should make sure the operating system can successfully send
- data to your printer. It is a lot easier to debug printer
- communication and the spooling system separately.</para>
-
- <para>To test the printer, we will send some text to it. For
- printers that can immediately print characters sent to them,
- the program &man.lptest.1; is perfect: it generates all 96
- printable ASCII characters in 96 lines.</para>
-
- <indexterm><primary>PostScript</primary></indexterm>
- <para>For a &postscript; (or other language-based) printer, we
- will need a more sophisticated test. A small &postscript;
- program, such as the following, will suffice:</para>
-
- <programlisting>%!PS
-100 100 moveto 300 300 lineto stroke
-310 310 moveto /Helvetica findfont 12 scalefont setfont
-(Is this thing working?) show
-showpage</programlisting>
-
- <para>The above &postscript; code can be placed into a file
- and used as shown in the examples appearing in the following
- sections.</para>
-
- <indexterm><primary>PCL</primary></indexterm>
- <note>
- <para>When this document refers to a printer language, it
- is assuming a language like &postscript;, and not Hewlett
- Packard's PCL. Although PCL has great functionality, you
- can intermingle plain text with its escape sequences.
- &postscript; cannot directly print plain text, and that
- is the kind of printer language for which we must make
- special accommodations.</para>
- </note>
-
- <sect4 xml:id="printing-checking-parallel">
- <title>Checking a Parallel Printer</title>
-
- <para>This section tells you how to check if &os; can
- communicate with a printer connected to a parallel<indexterm><primary>printers</primary><secondary>parallel</secondary></indexterm>
- port.</para>
-
- <para><emphasis>To test a printer on a parallel
- port:</emphasis></para>
-
- <procedure>
- <step>
- <para>Become <systemitem class="username">root</systemitem> with
- &man.su.1;.</para>
- </step>
-
- <step>
- <para>Send data to the printer.</para>
-
- <itemizedlist>
- <listitem>
- <para>If the printer can print plain text, then use
- &man.lptest.1;. Type:</para>
-
- <screen>&prompt.root; <userinput>lptest > /dev/lptN</userinput></screen>
-
- <para>Where <replaceable>N</replaceable> is the
- number of the parallel port, starting from
- zero.</para>
- </listitem>
-
- <listitem>
- <para>If the printer understands &postscript; or
- other printer language, then send a small program
- to the printer. Type:</para>
-
- <screen>&prompt.root; <userinput>cat > /dev/lptN</userinput></screen>
-
- <para>Then, line by line, type the program
- <emphasis>carefully</emphasis> as you cannot edit
- a line once you have pressed
- <literal>RETURN</literal> or
- <literal>ENTER</literal>. When you have finished
- entering the program, press
- <literal>CONTROL+D</literal>, or whatever your
- end of file key is.</para>
-
- <para>Alternatively, you can put the program in a
- file and type:</para>
-
- <screen>&prompt.root; <userinput>cat file > /dev/lptN</userinput></screen>
-
- <para>Where <replaceable>file</replaceable> is the
- name of the file containing the program you want
- to send to the printer.</para>
- </listitem>
- </itemizedlist>
- </step>
- </procedure>
-
- <para>You should see something print. Do not worry if the
- text does not look right; we will fix such things
- later.</para>
- </sect4>
-
- <sect4 xml:id="printing-checking-serial">
- <title>Checking a Serial Printer</title>
-
- <indexterm>
- <primary>printers</primary>
- <secondary>serial</secondary>
- </indexterm>
- <para>This section tells you how to check if &os; can
- communicate with a printer on a serial port.</para>
-
- <para><emphasis>To test a printer on a serial
- port:</emphasis></para>
-
- <procedure>
- <step>
- <para>Become <systemitem class="username">root</systemitem> with
- &man.su.1;.</para>
- </step>
-
- <step>
- <para>Edit the file <filename>/etc/remote</filename>.
- Add the following entry:</para>
-
- <programlisting>printer:dv=<filename>/dev/port</filename>:br#<replaceable>bps-rate</replaceable>:pa=<replaceable>parity</replaceable></programlisting>
-
- <indexterm><primary>bits-per-second</primary></indexterm>
- <indexterm><primary>serial port</primary></indexterm>
- <indexterm><primary>parity</primary></indexterm>
- <para>Where <replaceable>port</replaceable> is the
- device entry for the serial port
- (<literal>ttyu0</literal>, <literal>ttyu1</literal>,
- etc.), <replaceable>bps-rate</replaceable> is the
- bits-per-second rate at which the printer
- communicates, and <replaceable>parity</replaceable>
- is the parity required by the printer (either
- <literal>even</literal>, <literal>odd</literal>,
- <literal>none</literal>, or
- <literal>zero</literal>).</para>
-
- <para>Here is a sample entry for a printer connected via
- a serial line to the third serial port at
- 19200 bps with no parity:</para>
-
- <programlisting>printer:dv=<filename>/dev/ttyu2</filename>:br#19200:pa=none</programlisting>
- </step>
-
- <step>
- <para>Connect to the printer with &man.tip.1;.
- Type:</para>
-
- <screen>&prompt.root; <userinput>tip printer</userinput></screen>
-
- <para>If this step does not work, edit the file
- <filename>/etc/remote</filename> again and try using
- <filename>/dev/cuaaN</filename>
- instead of
- <filename>/dev/ttyuN</filename>.</para>
- </step>
-
- <step>
- <para>Send data to the printer.</para>
-
- <itemizedlist>
- <listitem>
- <para>If the printer can print plain text, then use
- &man.lptest.1;. Type:</para>
-
- <screen>&prompt.user; <userinput>$lptest</userinput></screen>
- </listitem>
-
- <listitem>
- <para>If the printer understands &postscript; or
- other printer language, then send a small program
- to the printer. Type the program, line by line,
- <emphasis>very carefully</emphasis> as backspacing
- or other editing keys may be significant to the
- printer. You may also need to type a special
- end-of-file key for the printer so it knows it
- received the whole program. For &postscript;
- printers, press
- <literal>CONTROL+D</literal>.</para>
-
- <para>Alternatively, you can put the program in a
- file and type:</para>
-
- <screen>&prompt.user; <userinput>>file</userinput></screen>
-
- <para>Where <replaceable>file</replaceable> is the
- name of the file containing the program. After
- &man.tip.1; sends the file, press any required
- end-of-file key.</para>
- </listitem>
- </itemizedlist>
- </step>
- </procedure>
-
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-doc-head
mailing list