Hi there, I don't know if you'll find these usefull but we've been using
them here for a little while now.

Both patches are against ifhp-3.5.10

The nopoll patch is used because our fast printers can actually process
the PJL endname commands before the original job has ejected all the
paper.  It was causing problems with our page accounting.  Our printers
have no problems with reporting EOJ when the job is actually finished.

The pages patch may only be usefull on our HP printers.  We're just
showing the progress of the print job.  Some of our users with large print
jobs found it usefull to be able to check the status without having to get
up and leave their office... :)

I believe the feedback from the pages patch also stops LPRng from stalling
when there are large jobs or a short stall time - or else I keep meaning
to write code to do this...

Both patches have been tested against: HP5si HP8150 and HP9000
I can't try any other printers 'cause that's all I have access to.

I sent these to Patrick some time ago, but haven't heard anything back...


Please let me know how they work for you if you use them!



Matt

----------------------------------------------------------
Matthew Forrest - System Administrator

School of Computer Science       Phone: 416-979-5000 x16964
Ryerson Polytechnic University   Fax:   416-979-5064
----------------------------------------------------------

--- ifhp.c.Orig Thu Feb 20 14:32:47 2003
+++ ifhp.c      Thu Feb 20 16:15:52 2003
@@ -3234,8 +3234,8 @@
 {
        char *sync_str, *s, *t, *u, buffer[SMALLBUFFER], endname[SMALLBUFFER];
        int len, elapsed, timeout, waitend,
-               use, use_pjl, use_ps, use_job, c,
-               echo_received = 0;
+               use, use_pjl, use_ps, use_job, use_job_nopoll, c,
+               pages_printed = 0, echo_received = 0;
        time_t start_t, current_t, interval_t;
        char *status;
        char *use_prog = 0;
@@ -3250,7 +3250,7 @@
                );
 
        /* we see if we can do sync */
-       use = use_pjl = use_ps = use_job = 0;
+       use = use_pjl = use_ps = use_job = use_job_nopoll = 0;
        sync_str = 0;
        if( !Is_flag( s, &use ) ){
                /* we check to see if the string is specifying */
@@ -3264,7 +3264,7 @@
                }
                use = 1;
        } else if( use ){
-               use_job = use_pjl = Pjl;
+               use_job = use_pjl = use_job_nopoll = Pjl;
                use_ps = Ps;
        } else {
                return;
@@ -3275,9 +3275,12 @@
 
        if( use_pjl ){
                use_job = GET_HASH_IVAL_OBJ(Model,"pjl_job");
+               use_job_nopoll = GET_HASH_IVAL_OBJ(Model,"pjl_job_nopoll");
+               if( use_job_nopoll )
+                    use_job=0;
                if( use_job && ( (LEN_HASH_OBJ(Pjl_only) && 
!GET_HASH_IVAL_OBJ(Pjl_only, "job"))
                                || (LEN_HASH_OBJ(Pjl_except) && GET_HASH_IVAL_OBJ( 
Pjl_except, "job"))) ){
-                       use_job = 0;
+                       use_job = use_job_nopoll = 0;
                }
                if( !use_job && ( (LEN_HASH_OBJ(Pjl_only) && 
!GET_HASH_IVAL_OBJ(Pjl_only, "echo"))
                                || (LEN_HASH_OBJ(Pjl_except) && GET_HASH_IVAL_OBJ( 
Pjl_except, "echo"))) ){
@@ -3289,6 +3292,7 @@
                FATAL(LOGINFO)_("Do_waitend: waitend '%s' and method not supported"), 
s );
        }
        if( use_pjl ) use_ps = 0;
+       if( !sync_str && use_job_nopoll ) sync_str = "ustatus";
        if( !sync_str && use_job ) sync_str = "pjl job/eoj";
        if( !sync_str && use_pjl ) sync_str = "pjl echo";
        if( !sync_str && use_ps ) sync_str = "ps";
@@ -3299,8 +3303,8 @@
        waitend = 0;
 
        /* find if we need to periodically send the waitend value */
-       DEBUG3("Do_waitend: use_pjl %d, use_job %d, use_ps %d, timeout %d, interval 
%d",
-               use_pjl, use_job, use_ps, waitend_timeout, waitend_interval );
+       DEBUG3("Do_waitend: use_pjl %d, use_job %d, use_job_nopoll %d, use_ps %d, 
timeout %d, interval %d",
+               use_pjl, use_job, use_job_nopoll, use_ps, waitend_timeout, 
waitend_interval );
 
 
        SNPRINTF(endname, sizeof(endname))  "%s PID %d",
@@ -3332,6 +3336,9 @@
                        Put_pjl(buffer);
                        Put_pjl( PJL_USTATUS_JOB_str );
                        Pjl_eoj(endname);
+               } else if( use_job_nopoll ) {
+                       SNPRINTF(buffer, sizeof(buffer))  PJL_ECHO_str, Jobname );
+                       Put_pjl(buffer);
                } else {
                        SNPRINTF(buffer, sizeof(buffer))  PJL_ECHO_str, endname );
                        Put_pjl(buffer);
@@ -3415,7 +3422,9 @@
                        t = GET_HASH_STR_OBJ( Devstatus, "name", MEMINFO);
                        u = GET_HASH_STR_OBJ( Devstatus, "result", MEMINFO);
                        DEBUG2("Do_waitend: job '%s', name '%s', result '%s', endname 
'%s'", s, t, u, endname );
-                       if( s && safestrstr(s,"END") && t && safestrstr(t,endname) ){
+                       if( use_job && s && safestrstr(s,"END") && t && 
safestrstr(t,endname) ){
+                               waitend = 1;
+                       } else if( use_job_nopoll && s && safestrstr(s,"END") && t && 
safestrstr(t,Jobname) ){
                                waitend = 1;
                        }
                        /* we have the job cancelled, so we retry */ 
--- ifhp.c.Orig Thu Feb 20 14:32:47 2003
+++ ifhp.c      Thu Feb 20 16:15:52 2003
@@ -3426,6 +3435,19 @@
                                LOGMSG(LOG_INFO)_("Do_waitend: job canceled"));
                                goto again;
                        }
+                       s = GET_HASH_STR_OBJ( Devstatus, "page", MEMINFO);
+                       if( s && pages_printed != atoi(s) ) {
+                               LOGMSG(LOG_INFO)_("Do_waitend: Printed %s page(s)"), 
s);
+                               pages_printed=atoi(s);
+                       }
+                       if( use_job ) {
+                               s = GET_HASH_STR_OBJ( Devstatus, "pages", MEMINFO);
+                               if( s ) {
+                                       LOGMSG(LOG_INFO)_("Do_waitend: Finished 
Printing %s page(s)"), s);
+                               }
+                       }
+
+
                        s = GET_HASH_STR_OBJ( Devstatus, "echo", MEMINFO);
                        DEBUG2("Do_waitend: echo '%s', want '%s'", s, endname );
                        if( safestrstr(s,endname) ){

Reply via email to