ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.