[cups.development] [RFE] STR #1655: Add SNMP page counter and printer status support to socket and lpd backends
Michael R Sweet
msweet at apple.com
Thu May 1 10:24:57 PDT 2008
Jerome Alet wrote:
> On Wed, Apr 30, 2008 at 04:52:42PM -0700, Michael Sweet wrote:
>> [STR Closed w/Resolution]
>> Fixed in Subversion repository.
> Looks like the code is not consistent between socket and lpd
> backend :
> grep CUPS_TC_idle lpd.c socket.c
> In lpd.c you wait for the printer being idle before accepting the
> internal page counter's value. This is the correct way to do it.
For socket, we close the outgoing side of the socket and only get
the page counter when the printer closes its side of the socket.
That happens, by definition, when the print job is finished printing.
(that's part of the AppSocket/JetDirect/etc. "protocol")
> The solution I've found is to check if the printer's status
> stabilizes to 'idle' over time (around 30 configurable seconds in
That's too long to wait between jobs. Almost all network printers
support port 9100/socket printing, and that's what we recommend
these days. LPD is only there for backwards-compatibility.
> I've not checked if you also retrieve the page counter before the
> backend is launched, but if this is the case you must ensure the
> printer is not still in 'printing' status (previous job) before
> trusting the SNMP answer. This can happen if the printer can be
> accessed by several print servers or directly by some clients).
We rely on printers only accepting a connection when they are not
busy. For the class of printers that will use SNMP page counters
(basically all network printers under $20k), this is a safe
Once we can connect, we query the page counter and then start
sending the job. Once we have finished sending the job, we wait
for the job to finish and then use the last page counter value to
get the total number of pages printed. The wait method depends on
the protocol - for IPP we query the job status, LPD uses the SNMP
printer state, and socket uses the shutdown/wait-for-close method.
Printers that do not support the standard protocols will require
their own driver or port monitor to collect status, supply, and
page count information.
Michael R Sweet Senior Printing System Engineer
More information about the cups