[Foomatic] My Lexmark X125 driver needs to read from the printer

Roger Leigh roger at whinlatter.uklinux.net
Tue Jan 13 11:11:02 PST 2004


markroth8 at yahoo.com (Mark Roth) writes:

> In article <mailman.1074006961.28040.foomatic-devel at linuxprinting.org>, David
> Chappell <David.Chappell at trincoll.edu> writes:
>> Does this code really belong in the driver?  The only reason I can think 
>> of is if the driver actually uses the returned data stream.  I think 
>> that the driver should generate the byte stream and then pass it on to 
>> the spooler for transmission.  The spooler can then take care of 
>> whatever has to be done to send it over a paralell port, USB, TCP, etc 
>> without getting locked up.  Interface-specific codes just doesn't belong 
>> in the driver.
>
> Putting the code in the spooler makes sense to me, and it would work for my
> driver.
>
> However, that would mean that the spooler might need specific plugins for each
> printer to correctly handle status codes.

Absolutely correct.  This is why CUPS separates the printing into a
"filter chain":

PS file (application/postscript)
   | pstops
   V
Normalised PS (application/postscript)
   | pstoraster
   V
Raster page image (application/vnd.cups-raster)
   | filter e.g. rastertoprinter (Gimp-Print), rastertohp etc.
   V
Printer-specific data
   | backend e.g. parallel, serial, usb
   V
Printer device node and the real hardware


The "driver" is the filter stage.  The "backend" is responsible for
sending the data to the printer.  As an example, Gimp-Print includes
"epson" and "canon" backends, which are specialised parallel port
backends (they read back ink level data etc.).

This is just one advantage of the CUPS architecture.  Drivers are just
executables under /usr/lib/cups/filter, and data just flows through on
stdin/stdout and stderr is logged by cupsd.  The whole chain above is
just a set of processes linked by pipes.


Regards,
Roger

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.




More information about the Printing-foomatic mailing list