LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2006, 12:28 AM   #1
g4j31a5
Member
 
Registered: Sep 2006
Distribution: open SuSE 10.0
Posts: 116

Rep: Reputation: 15
CUPS error states


Hi, I'm planning to make an application that can print a file. Because the application runs in realtime, I needed it to handle the printer error such as:
1. Printer turned off
2. Printer out of paper
3. Printer out of ink
4. Cannot detect printer
5. Paper printed but stuck inside the printer

When I consulted the CUPS Programming, I found these constants:

Quote:
Job States

The job state values are used to represent the current job state.

* IPP_JOB_PENDING - Job is pending
* IPP_JOB_HELD - Job is held
* IPP_JOB_PROCESSING - Job is processing
* IPP_JOB_STOPPED - Job is stopped
* IPP_JOB_CANCELLED - Job is cancelled
* IPP_JOB_ABORTED - Job is aborted
* IPP_JOB_COMPLETED - Job is completed

Printer States

The printer state values are used to represent the current printer state.

* IPP_PRINTER_IDLE - Printer is idle
* IPP_PRINTER_PROCESSING - Printer is processing
* IPP_PRINTER_STOPPED - Printer is stopped
Status Codes

Status codes are returned by all IPP requests.

* IPP_OK - Request completed with no errors
* IPP_OK_SUBST - Request completed but some attribute values were substituted
* IPP_OK_CONFLICT - Request completed but some attributes conflicted
* IPP_BAD_REQUEST - The request was bad
* IPP_FORBIDDEN - You don't have access to the resource
* IPP_NOT_AUTHENTICATED - You are not authenticated for the resource
* IPP_NOT_AUTHORIZED - You not authorized to access the resource
* IPP_NOT_POSSIBLE - The requested operation cannot be completed
* IPP_TIMEOUT - A timeout occurred
* IPP_NOT_FOUND - The resource was not found
* IPP_GONE - The resource has gone away
* IPP_REQUEST_ENTITY - The request was too large
* IPP_REQUEST_VALUE - The request contained a value that was unknown to the server
* IPP_DOCUMENT_FORMAT - The document format is not supported by the server
* IPP_ATTRIBUTES - Required attributes are missing
* IPP_URI_SCHEME - The URI scheme is not supported
* IPP_CHARSET - The charset is not supported
* IPP_CONFLICT - One or more attributes conflict
* IPP_COMPRESSION_NOT_SUPPORTED - The specified compression is not supported
* IPP_COMPRESSION_ERROR - The compressed data contained an error
* IPP_DOCUMENT_FORMAT_ERROR - The document data contained an error in it
* IPP_DOCUMENT_ACCESS_ERROR - The remote document could not be accessed
* IPP_INTERNAL_ERROR - The server encountered an internal error
* IPP_OPERATION_NOT_SUPPORTED - The requested operation is not supported
* IPP_SERVICE_UNAVAILABLE - The requested service is unavailable
* IPP_VERSION_NOT_SUPPORTED - The IPP request version is not supported
* IPP_DEVICE_ERROR - The output device encountered an error
* IPP_TEMPORARY_ERROR - A temporary error occurred
* IPP_NOT_ACCEPTING - The destination is not accepting jobs
* IPP_PRINTER_BUSY - The destination is busy
* IPP_ERROR_JOB_CANCELLED - The requested job has been cancelled
* IPP_MULTIPLE_JOBS_NOT_SUPPORTED - The server does not support multiple jobs
My question is: how can I handle those 5 errors above with CUPS? As I see it, there's no straightforward way to check whether a printer is out of paper or ink. So I guess I have to make another way.

Thanks in advance.
 
Old 12-08-2006, 08:33 PM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Hmm....well, I don't do any C programming (just to warn you) so, my suggestions may not be of any value, but my suggestion would be to install any CUPS devel packages or header/include files (to /usr/include) and read through the header files and see if you can interface through the CUPS API to send CUPS calls and trap any CUPS errors within your own program.

With some fandangling, I'm sure you could interface with the APIs in Java or Lisp - if you're not a C/C++ programmer, either.

That's my suggestion for trapping CUPS errors and such. As for low ink alerts, you might want to "reverse engineer" (or scrounge up) some Epson drivers. I know Epson has always had ink level monitors for Windows printer properties. You might even have to email Epson directly and ask for devel headers and includes, but I can't see them being very supportive if they catch on you're orienting towards Linux.

I hope that helps in any way, shape or form.
 
Old 12-10-2006, 09:21 PM   #3
g4j31a5
Member
 
Registered: Sep 2006
Distribution: open SuSE 10.0
Posts: 116

Original Poster
Rep: Reputation: 15
Ah thanks. I'll do that.
 
Old 12-10-2006, 10:42 PM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Sweet.
Be sure to post your results, as I'm sure there are more people interested in the same issue.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Suse CUPS error: cups(File)DoRequest error:client-error-bad-request smdonelan Linux - Hardware 6 04-17-2007 06:46 PM
Moving to the states! Sava General 17 06-24-2005 08:45 AM
cups error: "error-client-not-possible MAGOVIA Linux - Newbie 4 06-18-2005 11:44 PM
thread states klocko316 Linux - Newbie 1 09-12-2004 05:25 PM
cups Error "CUPS daemon has died" susesarus Linux - Software 2 08-21-2004 03:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration