How can i get the printer status such as "media-tray-empty-error" etc

Rakesh.vm vmrakesh at gmail.com
Mon Apr 6 20:33:59 PDT 2009


Hi,
 I wrote a program using CUPS for getting  the "media-tray-empty-error" but it is returning none value.Please help.

Program:
#include <cups/cups.h>
int  main()
{
	cups_dest_t *dests;
	int i=0,j=0;
	const char *value;
	int num_dests = cupsGetDests(&dests);
	printf ( " The number of Printers available is %d\n", num_dests);
	for (j =0;j<num_dests;j++,dests++)
	{
		cups_dest_t *dest = cupsGetDest(dests->name,
			dests->instance,
			dests->num_options,
			dests);
		printf("Printer name is %s\n",dest->name);
		for (i = 0; i < dest->num_options; i++)
		{
			if(NULL!= dest->options)
			{
				printf("The option name is : %s\n",dest->options[i].name);
				printf("The value is : %s\n",dest->options[i].value);
			}
		}
		printf("*********************************************\n");
	}
	cupsFreeDests((num_dests), dests);
	return 0;
}


Output:
 The number of Printers available is 1
Printer name is printer
The option name is : printer-info
The value is : printer
The option name is : printer-is-accepting-jobs
The value is : 1
The option name is : printer-is-shared
The value is : 1
The option name is : printer-make-and-model
The value is : HP LaserJet 4000 Series Postscript (recommended)
The option name is : printer-state
The value is : 3
The option name is : printer-state-change-time
The value is : 1239031230

*********************************************
The option name is : printer-state-reasons
The value is : none
**********************************************

The option name is : printer-type
The value is : 168148










More information about the cups mailing list