Signaling printer status from a filter

Michael Sweet mike at easysw.com
Wed Apr 19 13:27:11 PDT 2006


Josh Mathis wrote:
> With the backchannel support in v1.2, I would like to add 
> vendor-specific printer status support. I can get my appropriate status 
> via the backchannel write/read functions, but what do I do with this 
> info? For example, if my printer returns hex 15 01, then that means I 
> have a paper jam. How do I cancel my current job and then tell CUPS that 
> I have a paper jam? I didn't see anything particularly helpful in the 
> documentation. If it is in the docs, please point me there, I'm not 
> afraid to read!

Normally you don't want to cancel a job for this type of error, just
wait until the condition is cleared and continue.

If you exit from a filter, the job will be cancelled.  If you exit from
a backend, you can use the backend exit codes defined in
<cups/backend.h> to control the disposition of the job.

> Also, if it turns out that I can signal errors like paper jam, paper 
> out, etc, can I also send vendor-specific status information, or am I 
> limited to a few general printer status messages?

Send STATE: messages to signal new printer-state-reasons keywords,
and ERROR: messages to provide alternate human-readable text.

For example, you can use:

     fputs("STATE: +media-jam-error\n", stderr);
     fputs("ERROR: Paper jam!\n", stderr);

to signal a paper jam and provide a human-readable message.

Once the jam is resolved, use:

     fputs("STATE: -media-jam-error\n", stderr);
     fputs("INFO: Resuming print job...\n", stderr);

to clear the media-jam-error reason and continue with the job.

RFC 2911 lists the standard keywords supported by IPP, and you can
use vendor keywords of the form "com.vendor.keyword" for custom
conditions.  In addition, you can add cupsIPPReason keywords to
your PPD file to provide human-readable messages for the keywords;
these are described in the CUPS PPD Extensions help document
available at "http://localhost:631/help/spec-ppd.html".

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com




More information about the cups-devel mailing list