Filter - backend communication example?

Paul Newall p.newalls at ntlworld.com
Fri Feb 5 07:52:40 PST 2010


> >
> > --Apple-Mail-69--749116551
> > Content-Transfer-Encoding: quoted-printable
> > Content-Type: text/plain;
> > 	charset=us-ascii
> >
> > On Feb 4, 2010, at 1:45 PM, Paul Newall wrote:
> > >> ...
> > > Thank you, That was the roughly kind of thing I was trying. My filter =
> > code is like this
> > > fp is a FILE pointer to stdout
> > >=20
> > > 	fprintf(fp, "LockPrinter?");
> > > 	fflush(fp);
> > >=20
> > > Then I do the cupsSideChannelDoRequest call and get CUPS_SC_STATUS_OK
> > >=20
> > > But fflush(fp); is not causing the packet to be sent to the printer. I =
> > still get a large packet, starting with "LockPrinter?" followed by all =
> > my subsequent print data.
> > >=20
> > > My filter, written in c, is set up in a pipeline following ghostscript =
> > by a script (maybe that's relevant?)
> >
> >
> > Possibly.  However, it might be more relevant to know which backend you =
> > are using...
> >
> > ___________________________________________________
> > Michael Sweet, Senior Printing System Engineer
> >
>
> I think the backend is the standard socket backend /usr/lib/cups/backend/socket
> Maybe I'll try cutting the filter down to the bare minimum and see what happens.
>
> Paul Newall
>
Update 5/feb/2010:
I cut my filter right down to a minimum and called it directly in the PPD file:
*FoomaticRIPCommandLine: "myminifilter %A"

It still seems that fflush(stdout); does not cause the backend (the socket backend "$Id: socket.c 8707 2009-06-12 04:02:45Z mike $") to send a packet. My output before the fflush eventually appears on the network in the same packet as my output after the fflush.

Since I am a beginner at most of this (cups, ppd, even c) there are a lot of places that I might be going wrong.
I keep hoping I can find some source code and ppd for a cups filter that uses the socket backend and has some sort of conversation with the printer (any network connected printer) since I could see all the things I have to do there.
But I think that kind of driver seems pretty rare?

Paul Newall




More information about the cups mailing list