• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/LPRng/DOCS/LPRng-Reference-Multipart/
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4  <head>
5    <meta name="generator" content="HTML Tidy, see www.w3.org">
6    <title>Parallel Port Printers</title>
7    <meta name="GENERATOR" content=
8    "Modular DocBook HTML Stylesheet Version 1.7">
9    <link rel="HOME" title=" LPRng Reference Manual" href=
10    "index.htm">
11    <link rel="UP" title="Printer Communication and Protocols "
12    href="printercomm.htm">
13    <link rel="PREVIOUS" title="Printing to AppleTalk Printers"
14    href="x5238.htm">
15    <link rel="NEXT" title="Serial Printers " href="secserial.htm">
16  </head>
17
18  <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
19  "#0000FF" vlink="#840084" alink="#0000FF">
20    <div class="NAVHEADER">
21      <table summary="Header navigation table" width="100%" border=
22      "0" cellpadding="0" cellspacing="0">
23        <tr>
24          <th colspan="3" align="center">LPRng Reference Manual: 5
25          Sep 2003 (For LPRng-3.8.22)</th>
26        </tr>
27
28        <tr>
29          <td width="10%" align="left" valign="bottom"><a href=
30          "x5238.htm" accesskey="P">Prev</a></td>
31
32          <td width="80%" align="center" valign="bottom">Chapter
33          11. Printer Communication and Protocols</td>
34
35          <td width="10%" align="right" valign="bottom"><a href=
36          "secserial.htm" accesskey="N">Next</a></td>
37        </tr>
38      </table>
39      <hr align="LEFT" width="100%">
40    </div>
41
42    <div class="SECT1">
43      <h1 class="SECT1"><a name="AEN5262">11.11. Parallel Port
44      Printers</a></h1>
45
46      <p>When installing a parallel port printer, there are three
47      elements of concern: the physical hardware connection (cable
48      and connectors), the IO device and Operating System support,
49      and finally the print spooler support for the device.</p>
50
51      <p>Originally most parallel port devices were strictly <span
52      class="emphasis"><i class="EMPHASIS">write only</i></span>
53      with a minimum amount of error information - only hardware
54      signals for <span class="emphasis"><i class=
55      "EMPHASIS">online</i></span>, <span class="emphasis"><i
56      class="EMPHASIS">out of paper</i></span> and <span class=
57      "emphasis"><i class="EMPHASIS">fault</i></span> were present.
58      Due to the lack of any other way to interface devices to the
59      Intel based PC platform, desperate hardware designers in
60      search of a cheap (free?) way to interface their IO devices
61      developed ways to manipulate the signals and do <span class=
62      "emphasis"><i class="EMPHASIS">bidirectional</i></span>
63      communication. Needless to say, no two companies developed
64      the same methods, and no two companies were compatible with
65      any other companies method.</p>
66
67      <p>In 1994, the IEEE 1284 standard was first developed,. The
68      following information is courtesy of Warp Nine Engineering,
69      of San Diego, CA, from the <a href=
70      "http://www.fapo.com/1284int.htm" target=
71      "_top">http://www.fapo.com/1284int.htm</a> web page.</p>
72
73      <p>When IBM introduced the PC, in 1981, the parallel printer
74      port was included as an alternative to the slower serial port
75      as a means for driving the latest high performance dot matrix
76      printers. The parallel port had the capability to transfer 8
77      bits of data at time whereas the serial port transmitted one
78      bit at a time. When the PC was introduced, dot matrix
79      printers were the main peripheral that used the parallel
80      port. As technology progressed and the need for greater
81      external connectivity increased, the parallel port became the
82      means by which you could connect higher performance
83      peripherals. These peripherals now range from printer sharing
84      devices, portable disk drives and tape backup to local area
85      network adapters and CD ROM players.</p>
86
87      <p>The problems faced by developers and customers of these
88      peripherals fall into three categories. First, although the
89      performance of the PC has increased dramatically, there has
90      been virtually no change in the parallel port performance or
91      architecture. The maximum data transfer rate achievable with
92      this architecture is around 150 kilobytes per second and is
93      extremely software intensive. Second, there is no standard
94      for the electrical interface. This causes many problems when
95      attempting to guarantee operation across various platforms.
96      Finally, the lack of design standards forced a distance
97      limitation of only 6 feet for external cables.</p>
98
99      <p>In 1991 there was a meeting of printer manufacturers to
100      start discussions on developing a new standard for the
101      intelligent control of printers over a network. These
102      manufacturers, which included Lexmark, IBM, Texas Instruments
103      and others, formed the Network Printing Alliance. The NPA
104      defined a set of parameters that, when implemented in the
105      printer and host, will allow for the complete control of
106      printer applications and jobs. While this work was in
107      progress it became apparent that to fully implement this
108      standard would require a high performance bi-directional
109      connection to the PC. The usual means of connection, the
110      ordinary PC parallel port, did not have the capabilities
111      required to meet the full requirements or abilities of this
112      standard.</p>
113
114      <p>The NPA submitted a proposal to the IEEE for the creation
115      of a committee to develop a new standard for a high speed
116      bi-directional parallel port for the PC. It was a requirement
117      that this new standard would remain fully compatible with the
118      original parallel port software and peripherals, but would
119      increase the data rate capability to greater than 1M bytes
120      per second, both in and out of the computer. This committee
121      became the IEEE 1284 committee. The IEEE 1284 standard,
122      "Standard Signaling Method for a Bi-directional Parallel
123      Peripheral Interface for Personal Computers", was approved
124      for final release in March of 1994.</p>
125
126      <p>Even if your hardware has support for the IEEE 1284 high
127      speed bidirectional data transfers, your Operating System
128      drivers must support it. Unfortunately, there is no universal
129      agreement on the capabilities that should be provided by the
130      low level printer port device drivers, and the method for
131      supporting them. A good example of the problem of OS support
132      and drivers is given by the Linux Parallel Port group,
133      currently headed by Tim Waugh, and which is documented in the
134      <a href="http://people.redhat.com/twaugh/parport/" target=
135      "_top">http://people.redhat.com/twaugh/parport/</a> and <a
136      href=
137      "http://people.redhat.com/twaugh/parport/html/parportguide.html"
138       target=
139      "_top">http://people.redhat.com/twaugh/parport/html/parportguide.html</a>
140      web pages.</p>
141
142      <p>Given this state of affairs, it should be no surprise that
143      there is no support for bidirectional parallel port printers
144      in <b class="APPLICATION">LPRng</b>. In fact, it turns out
145      that there are severe problems with many Unix implementations
146      that cause extreme headaches. These include:</p>
147
148      <ul>
149        <li>
150          <p>While a parallel port may be opened Read/Write, a
151          <code class="FUNCTION">read()</code> will either block
152          indefinitely or cause a major system failure (crash).</p>
153        </li>
154
155        <li>
156          <p>There is no buffering of data in the low level driver;
157          that is, once a <code class="FUNCTION">write()</code>
158          starts, then the process will block until the data is
159          written out. If the <code class="FUNCTION">write()</code>
160          call is interrupted by a <span class="emphasis"><i class=
161          "EMPHASIS">signal</i></span> and not immediately
162          restarted, then the status returned by the <code class=
163          "FUNCTION">write()</code> may be an error indication
164          (<var class="LITERAL">-1</var>) or the numbers of bytes
165          that were actually written. If an error is returned, then
166          an unknown number were written and the print job must be
167          aborted.</p>
168        </li>
169
170        <li>
171          <p>Many Operating systems do not implement a <code class=
172          "FUNCTION">select()</code> functionality for the parallel
173          port, which means that it is difficult to do a
174          multi-threaded implementation. Instead, a polling method
175          must be used.</p>
176        </li>
177      </ul>
178      <br>
179      <br>
180
181      <p>The good news is that on all known systems, if the
182      parallel port device is opened exclusively for writing, and a
183      blocking <code class="FUNCTION">write()</code> is used, and
184      the <code class="FUNCTION">write()</code> is not interrupted,
185      and there are no device errors, then data is delivered
186      correctly to the device.</p>
187
188      <p>In most UNIX systems the printer port has the name <tt
189      class="FILENAME">/dev/lpt</tt>, <tt class=
190      "FILENAME">/dev/prn</tt>, or something similar. On most
191      systems the <b class="APPLICATION">dmesg</b> utility will
192      print a list of IO devices found during system configuration.
193      Use the following commands to get the information and scan
194      for the device. You should also make sure that the printer
195      device is available.</p>
196
197      <div class="INFORMALEXAMPLE">
198        <a name="AEN5303"></a>
199<pre class="SCREEN">
200    dmesg &gt;/tmp/a
201    grep lp /tmp/a
202    ls /dev/lp*
203</pre>
204      </div>
205      <br>
206      <br>
207
208      <p>Gordon Haverland <code class="EMAIL">&lt;<a href=
209      "mailto:haverlan@agric.gov.ab.ca">haverlan@agric.gov.ab.ca</a>&gt;</code>
210      supplied this little script, that will assist with this:</p>
211
212      <div class="INFORMALEXAMPLE">
213        <a name="AEN5307"></a>
214<pre class="SCREEN">
215    #!/bin/sh
216    #set -v -x              # uncomment for debugging
217    PATH=/bin:/usr/bin
218    printer=
219    for printer in /dev/lp* ;
220    do
221        echo PRINTER TEST to $printer 1&gt;&amp;2
222        for i in 1 2 3 4 5 6 7 8 9;
223        do
224            echo PRINTER $printer $i &gt; $printer;
225        done
226        echo -e \\r\\f &gt; $printer
227    done
228    exit 0;
229</pre>
230      </div>
231      <br>
232      <br>
233
234      <p>If your printer is connected to the device name you
235      provided, then you should get a page of something out. If the
236      output suffers from the <span class="emphasis"><i class=
237      "EMPHASIS">staircase</i></span> effect, you will see the
238      numbers marching across the page, otherwise the numbers will
239      all be in a single column.</p>
240    </div>
241
242    <div class="NAVFOOTER">
243      <hr align="LEFT" width="100%">
244
245      <table summary="Footer navigation table" width="100%" border=
246      "0" cellpadding="0" cellspacing="0">
247        <tr>
248          <td width="33%" align="left" valign="top"><a href=
249          "x5238.htm" accesskey="P">Prev</a></td>
250
251          <td width="34%" align="center" valign="top"><a href=
252          "index.htm" accesskey="H">Home</a></td>
253
254          <td width="33%" align="right" valign="top"><a href=
255          "secserial.htm" accesskey="N">Next</a></td>
256        </tr>
257
258        <tr>
259          <td width="33%" align="left" valign="top">Printing to
260          AppleTalk Printers</td>
261
262          <td width="34%" align="center" valign="top"><a href=
263          "printercomm.htm" accesskey="U">Up</a></td>
264
265          <td width="33%" align="right" valign="top">Serial
266          Printers</td>
267        </tr>
268      </table>
269    </div>
270  </body>
271</html>
272
273