reading data from raw printer

Kurt Pfeifle kurt.pfeifle at infotec.com
Thu Jul 5 13:19:28 PDT 2007


Johannes Meixner recently wrote:

> > The command interface has the potential to be really useful, not least
> > for things like finding out ink levels.  It's just that no-one seems to
> > be using it or understand how it works...
>
> At least for me this is true.


I remember to have started to play with CUPS command files a loooong time ago, but I never followed up with it. There should be some initial
command filter script that I started with still sleeping somewhere in
my backup archives.

There are a lot of nice little things you can imagine that this interface could be used for. The thing I did was to send a CUPS-command
file to "print" on a network printer; that job contained the command "GetCounter".

The name of that command was completely arbitrary. The printer's PPD
had (additionally, on top of the existing ones) a "*cupsFilter:" line:

  *cupsFilter: "application/vnd.cups-command 0 count_requester.sh"

Then, my filter "count_requester" made sure it parsed and followed the
"GetCounter" command. (Of course, I could have sent an empty CUPS
command job as well, and made the count_requester to do what I meant it
to do regardless of the command.

Since the count_requester has access to all commandline arguments as
well as the environment variables handed over by CUPS, it could find
out what the target printer was.

It then run an snmpwalk command on that printer and grep-ped for the
current total life count in the response. That figure was then used
to send another job to (possibly another) printer reporting the
page count of $original printer.

[But instead of printing, it could have sent me an e-Mail, or written
the figure into a database, or whatever you can imagine...]

My original idea was to use the command file as a CUPS banner page.
That scenario possibly would be a bit shaky, because of timing issues,
and the "banner" not arriving immediately after the main job on very
busy printers. I never tested if this concept works for me like I
imagined, but I think the basics of it should.

Later tonight I'll have a look for my old scripting experiments and
see if it turns up something useful.

--
Kurt Pfeifle
System & Network Printing Consultant ---- Linux/Unix/Windows/Samba/CUPS
Infotec Deutschland GmbH  .....................  Hedelfinger Strasse 58
A RICOH Company  ...........................  D-70327 Stuttgart/Germany





More information about the cups mailing list