[cups.general] socket backend pagecounting off by one

alet at librelogiciel.com alet at librelogiciel.com
Thu Aug 19 11:27:26 PDT 2010


On Thu, Aug 19, 2010 at 09:36:46AM -0700, John A. Murdie wrote:
> I've done some little tests of the SNMP page counting in the 1.4.4 socket backend with some HP printers (an HP Color LaserJet 5550dtn, for a start). When printing just one page, the difference between the start_count and the page_count - see CUPS 1.4.4 socket.c line 440:
>
> if (have_supplies &&
>       !backendSNMPSupplies(snmp_fd, &(addr->addr), &page_count, NULL) &&
>       page_count > start_count)
>     fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
>
> is zero, so the "PAGE: total ..." log line is never emitted. (Incidentally, I think that page counts of 0 should be recorded.)
>
> In general, when printing N pages, N - 1 pages are (often?/always?)
> recorded. I think that the reason is that the HP printers take some time
> for the page count to stabilise. If I do place an experimental
> 'sleep(10)' just before the 'after' page_count SNMP code in socket.c,
> the page count is correct. Naturally, I wouldn't want to add a useless
> delay in the socket backend, but some of us do want reliable, actual,
> per-job page counts. I've found that even when these printers report
> themselves idle (hrPrinterStatus == CUPS_TC_idle) the page count is
> still not stable.

I've not seen socket's code in a logn time, however from my experience
what should be done is first waiting some time for the printer to be in
'printing' state, and then waiting for it to become 'idle' again but for
a minimum amount of time in order for this 'idle' state to be reliable :
some printers even go from printing to idle to printing between pages of
the same job !

bye

Jerome Alet





More information about the cups mailing list