> Has anybody found a reasonable way to get pagecount data out of
> the HP Laserjet 4100?

Coincidently I've been looking at this as well, since I found the same
problem with zero page counts for 1 page print jobs.

I searched back through some previous mailing list messages I'd saved and found
one from Fernando Blanco Marcilla <[EMAIL PROTECTED]> sent on Jan 22nd
2002 with a subject "HP-4100 Pagecount problem. A possible solution."  I don't
think Fernando has said anything in to this thread so far so I hope he doesn't
mind if I do it for him!

I've attached his message below so you can see what he said back then.

I've also tried his patch with ifhp 3.5.10 (the code is essentially the same in
the affected areas but the line numbers are off so I've also attached an
"updated" version of the patch.

It actually does seem to work for me, in that if I run ifhp in debugging mode,
it exits with the correct page count almost exactly as soon as the last page of
a job finishes printing.

I've also tried this patch on an hp4000, a 4050 and an 8000 and it seems to
work on all of those.  However, it doesn't work on an older hp5m we still have.
So right now I'm attempting to understand more of what is going on here to see
if I can figure out *why* his patch works for the newer printers but not for
the 5m.  And I'd rather not put it into production use until I do understand
it, so if anyone can explain it I'd like to hear...

Duncan

Attachment: ifhp.patch
Description: Binary data


--- Begin Message ---
Hello. 

I have done some tests with the version of ifhp  3.5.2 and the pagecount
of HP-4100 printers, observing the messages of status that  it returns
as the job is being processed.

Unfortunately, unlike other HP printers, this model gives back 'END'
status a long before the job is completed; nevertheless, when it really
finishes a job, the following values  in Devstatus are given: 

        job="END"
        name=Jobname (or a substring of this.) 

Having this behavior into account, I modified a few lines in the routine
Do_waitend and finally I managed to count the pages correctly (at least
in the tests I did, using it for some days with five HP-4100 and several
other models, sending PCL files and Postscript).

The modification I have done in ifhp 3.5.2 has been:
        line 2912: I added the statusname variable
        lines 3085,3088: I modified the end of job detection criterion

See:
diff ifhp.c.orig ifhp.c
2911c2911
<       char *sync_str, *s, *t, *u, buffer[SMALLBUFFER],
endname[SMALLBUFFER];
---
> /* */ char *sync_str, *s, *t, *u, buffer[SMALLBUFFER], endname[SMALLBUFFER]; 
>statusname[SMALLBUFFER];
3084c3084,3087
<                       if( s && strstr(s,"END") && t &&
strstr(t,endname) ){
---
> /* hp4100 17.12.01 */ if (t) { strcpy(statusname,t+1);
>                                statusname[strlen(statusname)-1]='\0';
>                       }
> /* hp4100 17.12.01 */ if( s && strstr(s,"END") && t && strstr(Jobname,statusname) ){


This was sufficient. The statusname variable I used to remove the quotes
that are in the first and last character of t, due to problems when the
Jobname is too long or contains the character ','.
It was not necessary to put pagecount_poll and pagecount_interval in the
printcap file. 

As I do not know the code in depth, I do not know if this modification
might introduce any problem that I have not taken into account.

I also tried the same modification with 3.5.0 version, and it counts
correctly too.

Regards:
Fernando Blanco.
CIEMAT.

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------
--- End Message ---

Reply via email to