Translation(s): none
An account of the Debian utilities that may be used in investigating and debugging printing devices that interwork with the Internet Printing Protocol. The target distributions are Debian 11 (bullseye) and later.
Contents
Introduction
cups-ipp-utils is installed as a dependency when cups is installed. Without cups on the system the package can still be installed, but a user will also need avahi-daemon to make full use of the utilities provided. The utilities are ippfind, ipptool and the printer application, ippeveprinter. It is also worthwhile having avahi-browse at hand. All commands can be run as an ordinary user, unless otherwise specified.
ippfind
This is the only one of the three utilities that is employed by the printing system. It is necessary for the driverless utility that is in the cups-filters-core-drivers package. The driverless utility is treated on the driverless printing page. ippfind is used to discover internet printing protocol-capable printers or print queues locally or on the local network. An IPP-over-USB-connected printer would qualify as a local IPP printer. Print queues would be those advertised by any CUPS server. By design, CUPS is always IPP-capable. The simplest command to execute is
ippfind
The output is a list of URIs. If repeated executions are not consistent in their outputs (a busy network, for example) or have unexpectedly empty outputs, try
ippfind -T 5
ippfind ! --txt printer-type Only show IPP printers. ippfind --txt-color T Available color printers or queues. ippfind --txt-duplex T Printers or queues providing automatic duplex. ippfind --txt-note Library Printers located in the library. ippfind --txt urf AirPrint-capable devices. ippfind --exec echo '{txt_note}' \; Device location. ippfind --exec echo '{txt_urf}' \; The TXT record's URF key. ippfind --exec echo '{service_name}' \; Device destination.
These commands are intended for use on the local network. They do not work across networks.
ipptool
An IPP printer or print queue can be queried and tested as to its conformance to the IPP protocol or for information about the device. The URI needs to be known and may be discovered with the ippfind or driverless utilities. Standard test files are located in /usr/share/cups/ipptool/. Each test file defines one or more requests, the expected response status, attributes and attribute values that are utilised by ipptool. Asking to use a standard test file by name is sufficient; the full path is not required. The file format specification is detailed in ipptoolfile.
For all attributes and their values supported by an IPP printer or queue:
ipptool -tv <URI> get-printer-attributes.test
Customisation of a test file is possible. Copy the file to be edited from /usr/share/cups/ipptool/ and tell ipptool1 where it is. The full path is not necessary when the file is put in $HOME. For exaple, suppose it is wanted to test the operation of automatic duplex printing on a printer:
cp /usr/share/cups/ipptool/print-job.test $HOME/print-duplex-job.test
and edit the copy to add the line ATTR keyword sides two-sided-long-edge after the line ATTR integer copies 1. To print a file execute
ipptool -tv -f /path/to/file <URI> print-duplex-job.test
The file's MIME media type must be supported by the printer.
ippeveprinter
ippeveprinter is an IPP server conforming to the IPP Everywhere specification. For all intents and purposes it may be regarded as an IPP printer behaving in exactly the same way as any other IPP printer should when advertising itself on the network and accepting jobs. Where ippeveprinter doe s differ from an IPP printer is in being able to run a command and process the accepted job to send to a real non-IPP printer. For example, suppose the job is in PDF format and the non-IPP printer only accepts a vendor-specific PDL. The command could use the vendor driver and PPD to supply the non-IPP printer with data it can process. This is the basic idea underlying a Printer Application.
To start the server with a service name (a destination) of myprinter:
/usr/sbin/ippeveprinter -f application/pdf myprinter
lpstat -l -e, run from another console on the same machine or from another bullseye or later machine, should show the dynamically CUPS-created destination, myprinter. Using it to print or querying it (lpoptions -p myprinter -l is sufficient) will lead to the creation of a temporary queue and an associated PPD file.
The only PDL acceptable to the server is MIME media type application/pdf. This means that, if CUPS sends a job to myprinter, it will be obliged to produce a PDF. On starting the server a directory /tmp/ippeveprinter.xxxx is created. This is referred to as the spool directory. Files sent to the server will be held there for about a minute before being deleted. The server's -k option suppresses deletion.
Test printing to this temporary queue with lp -d myprinter /etc/nsswitch.conf and look in the spool directory. 1-nsswitch_conf.pdf is the file produced by CUPS and cups-filters. It becomes eligible to be taken out of the spool directory, processed by a command and sent either to a real printer or another destination with the server's -D option.
A sample output from avahi-browse -rt _ipp._tcp is
hostname = [test.local] address = [192.168.7.43] port = [8000] txt = ["qtotal=1" "txtvers=1" "TLS=1.2" "UUID=1da7d448-7587-35d3-540c-a032636d1c2c" "Duplex=F" "Color=F" "pdl=application/pdf" "note=" "adminurl=https://bullseye.local:8000/" "ty=Example Printer" "rp=ipp/print"]
The adminur key gives the location of the server's EWS.
CUPS has done its job once a file is delivered to the spool directory; the rest of the process is down to the command executed by the server (the printer application). The command has to be a command given without options or pipelines. The following script, pscommand, will take the submitted file out of the spool directory and convert it to a PostScript file, which will then be put in $HOME/Downloads/. The server is restarted with
/usr/sbin/ippeveprinter -D $HOME/Downloads/ -c $HOME/pscommand -f application/pdf myprinter
#!/bin/sh # pscommand. # The cups package is assumed to be installed on the same # machine as the server. /usr/sbin/cupsfilter -m application/vnd.cups-postscript $1
chmod 755 pscommand
Print with lp -d myprinter /etc/nsswitch.conf and check the MIME media type of the file in $HOME/Downloads.
file $HOME/Downloads/1-nsswitch_conf.prn
See Also