How to get a reason? Was the CUPS task stopped?

How to get the cause of a failed CUPS print job using the CUPS API?

Using the CUPS API, I printed two jobs that could not be printed. On the CUPS web interface, I can understand why they failed: "Unsupported print data." and "Cannot write print data."

CUPS print job error description

However, the API does not seem to contain these reasons. The cupsGetJobs() method returns cups_job_s structs, which looks like this:

 struct cups_job_s { time_t completed_time; time_t creation_time; char *dest; char *format; int id; int priority; time_t processing_time; int size; ipp_jstate_t state; char *title; char *user; }; 

I checked all of these fields, none of them contain the error lines shown in the screenshot.

+7
message jobs cups
source share
2 answers

I believe this boils down to the job-state-message attribute. To get job attributes, I believe that you will have to use the IPP API, though, for example (unchecked):

 ipp_t *request = ippNewRequest(IPP_GET_JOBS); ... ipp_t *response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/"); ... ipp_attribute_t *attr = ippFindAttribute(response, "job-state-message", IPP_TAG_TEXT); 

It is important to note that job-state attributes can be updated at some point after the job has already been accepted. Since the server does not know whether the print will be really successful (due to Murphy Law there are many factors), the job is accepted, and after a failure, it updates the job-state and the corresponding attributes, respectively. job-state-message is optional, though.

If you want your application to respond to these events rather than continuing to request a CUPS server at a fixed interval, you can subscribe to some D-Bus events ( see Apple implementation ). If you want an example consumer implementation, you can read the printer panel code from the gnome control center .

Below I will try to list some relevant parts of RFC 2911 (IPP 1.1):

3.1.9 Task creation operations

...

During job processing, since the Printer object already responded with a successful status code in response to the creation of the request, if the Printer object detects an error, the Printer object cannot inform the end user of the error using the status code operation. In this case, the printer, depending on the error, can set the job object "job status", "job reasons" or "job - state-message" to the corresponding values ​​(s) so that later requests can report the correct job status.

Note. Asynchronous event notification is beyond the scope of this IPP / 1.1 document.

4.3.7 job status (enumeration type1)

...

6 “processing-stopped”: the task stopped during processing for a number of reasons and will return to “processing” as soon as the reasons are no longer present.

The job-state-reason-job MAY attribute indicates why work stopped processing. For example, if the output device is stopped, the value "printer is stopped" MAY be included in the job attribute "Status-reason-job".

Note. When the output device is stopped, the device usually indicates its state in a human readable form locally on the device. The client can obtain a more complete remote device by requesting the "Printer Object" object "printer status", "printer status reasons" and "printer-state-message".

4.3.9 status message (text (MAX))

This attribute defines information about the "state of the job" and the "job - state-reason" in a human-readable text. If the printer object supports this attribute, the Printer object MUST be able to generate this message in any of the natural languages ​​defined by the "natural language-generated" attribute (see the attribute attribute "natural language operation" specified in Section 3.1.4.1) .

The value SHOULD NOT contain additional information that is not contained in the values ​​of the attributes “work state” and “state of job-causes”, such as information about interpreter errors. Otherwise, application programs may try to parse (localized text). For such additional information, such as interpreter errors for the application, program consumption or access errors to a specific document, new attributes with keyword values ​​must be developed and recorded.

footnote : I did not do this personally, but the RFC does tell you exactly what you should expect.

+4
source share

In Debian 8.6 Cinnamon 2.2.16 (linux), from the Start menu, do the following:

  • Click "Administration" | Print options,
  • Then select your stopped CUPS printer,
  • Click "Unblock" (and enter the administrator password),
  • Click "Server" | Settings
  • There are blue “Problems?” In this click. link.

The print troubleshooting tool opens. He will tell you what to do next.

You probably just need to check the Enabled property for your CUPS printer in the print settings. (First you need to unlock).

Finally, so that this does not happen again, change the "printers" policy to "re-set" in the printer setup described above (in accordance with the property policies).

This is fixed for me!

What causes this problem: If my wifi printer is disabled when I print to CUPS PRINTER and my policy is to “stop the printer”, then I get a message that I could not print and the printer is disabled (Enabled not installed). Only if the re-setting is set for the policy setting, the value Enabled will not be canceled. A few minutes after the printer is turned on, your jobs will begin to print.

(My others about it.)

0
source share

All Articles