Let me say up front, I am new to the mailing list.  I'm also not an
expert on PJL, so some of my comments will probably be naive or just
plain wrong.  I have written a patch based on an earlier one by
Fernando Blanco Marcilla to fix the waitend/pagecount problems
frequently mentioned on this list for the hp4100 printer.  I found the
same problems occuring on the hp4550n printer, for which I needed a
fix quickly.  If it turns out to be useful, I'd be glad to see it
merged into the main source, as I think many people are having this
problem.

In the attached patch, I added a new configuration flag
"pjl_waitend_byjobname" that will allow the fix to be activated on a
per-model or per-printer basis.  It is a unified diff to ifhp-3.5.10.
To apply it, run the following from the top level of the distribution:

'patch -p1 < ifhp.patch'

Give it a try and let me know what you think.

I've included some details so that the printing experts on this list
can tell me if I'm making sense, but anything from here on is
unneccessary if you just want to use the patch.

The way the waitend=pjl ssystem seems to work on many printers seems
to follow a timeline something like this: 

1. ifhp submits the user's job:
@PJL JOB NAME = "reskusic (STDIN):thehut" ...

2. ifhp submits an empty job with a name like "16-24-44.737 PID 24583"
@PJL JOB NAME = "16-24-44.737 PID 24583"

3. ifhp waits for the "16-24-44.737 PID 24583" to complete

4. the printer sends back infomation about the end of the jobs
END^M
NAME="reskusic (STDIN):thehut"^M
PAGES=1^M
...
END^M
NAME="16-24-44.737 PID 24583"^M
PAGES=0^M

5. ifhp checks the final pagecounter and does accounting.  This works
because the printer finishes "reskusic (STDIN):thehut" before starting
on the empty job "16-24-44.737 PID 24583".

What happens in the old code when used on the hp4550n(or probably
4100) is more like this:

1. ifhp submits the user's job:
@PJL JOB NAME = "reskusic (STDIN):thehut" ...

2. ifhp submits an empty job with a name like "16-24-44.737 PID 24583"
@PJL JOB NAME = "16-24-44.737 PID 24583"

3. ifhp waits for the "16-24-44.737 PID 24583" to complete

4. the printer, seeing "16-24-44.737 PID 24583" is empty, reports that
it is done without waiting
END^M
NAME="16-24-44.737 PID 24583"^M
PAGES=0^M

5. ifhp checks the pagecounter, gets erroneous data, and does bad
accounting

6. "reskusic (STDIN):thehut" finishes, and the printer reports back
END^M
NAME="reskusic (STDIN):thehut"^M
PAGES=1^M

Which is the reason for the bad page counts and the early exits.  The
way the patch works is more like this:

1. ifhp submits the user's job:
@PJL JOB NAME = "reskusic (STDIN):thehut" ...

2. ifhp waits for the "reskusic (STDIN):thehut" to complete

3. "reskusic (STDIN):thehut" finishes, and the printer reports back
END^M
NAME="reskusic (STDIN):thehut"^M
PAGES=1^M

4. ifhp checks the final pagecounter and does accounting.

I feel a little uneasy about removing the empty job, but in the
context of this printer I can't see any reason for it.  Any opinions?

Raymond M. Reskusich
diff -u -r ifhp-3.5.10/ifhp.conf.in ifhp-3.5.10-ewshack/ifhp.conf.in
--- ifhp-3.5.10/ifhp.conf.in    2002-07-22 11:19:02.000000000 -0500
+++ ifhp-3.5.10-ewshack/ifhp.conf.in    2002-10-16 17:18:56.000000000 -0500
@@ -76,6 +76,7 @@
 ### hp2500cm - HP Design Jet 2500cm - PCL and PostScript
 ### hpdj2500cp - HP DesignJet 2500CP, not HP2500, HP2500c, HP2500cm
 ### hp4500 - HP Color LaserJet Printer 4500
+### hp4550n - HP Color Laserjet 4550n
 ### hp8500 - HP Color LaserJet Printer 8500
 ### hp8550 - HP Color LaserJet Printer 8550
 ### hp5000 - HP5000  Model number: C4111A (LaserJet 5000N)
@@ -2338,7 +2339,7 @@
 
 
 # PRINTER % - HP Color LaserJet Printer {/hp(.*)/$1/}
-[ hp4500 hp8500 hp8550 ]
+[ hp4500 hp8500 hp8550 hp4550n]
 
 # Apparently this printer does not like ^D at start of job
 ps_eoj_at_start@
@@ -2438,6 +2439,11 @@
        lduplex sduplex tumble shortedge
 ]
 
+# PRINTER hp4550n - HP4550N 
+[ hp4550n ]
+# to fix waitend
+pjl_waitend_byjobname
+
 # PRINTER hp5000 - HP5000  Model number: C4111A (LaserJet 5000N)
 #
 # Hewlett Packard 5000 Series
diff -u -r ifhp-3.5.10/src/ifhp.c ifhp-3.5.10-ewshack/src/ifhp.c
--- ifhp-3.5.10/src/ifhp.c      2002-07-22 11:19:05.000000000 -0500
+++ ifhp-3.5.10-ewshack/src/ifhp.c      2002-10-16 17:41:36.000000000 -0500
@@ -3309,13 +3309,20 @@
 
        DEBUG1("Do_waitend: endname '%s'", endname );
 
+       if ( Pjl_waitend_byjobname )
+               strcpy(endname, Jobname);
+
  again:
 
        Init_outbuf();
        if( use_pjl ){
                Put_outbuf_str( PJL_UEL_str );
                Put_outbuf_str( PJL_str );
-               if( use_job ){
+               if ( Pjl_waitend_byjobname )
+               {
+                       /* do nothing, just wait for the end of the real job */
+               }
+               else if( use_job ){
                        buffer[0] = 0;
                        len = safestrlen(buffer);
                        SNPRINTF(buffer+len, sizeof(buffer)-len) Jobreset_str);
diff -u -r ifhp-3.5.10/src/ifhp.h ifhp-3.5.10-ewshack/src/ifhp.h
--- ifhp-3.5.10/src/ifhp.h      2002-07-22 11:19:05.000000000 -0500
+++ ifhp-3.5.10-ewshack/src/ifhp.h      2002-10-16 17:18:50.000000000 -0500
@@ -213,6 +213,8 @@
        Pjl_console,    /* use the PJL Console */
        Pjl_display_size,       /* use the PJL Console */
        Pjl_enter,      /* use the PJL ENTER command */
+       Pjl_waitend_byjobname,  /* wait for the specific job name string with the
+                                  end of job string */
        Reopen_for_job, /* open the device read/write */
        Ps,                     /* has PostScript support */
        Psonly, /* only recognizes PostScript */
diff -u -r ifhp-3.5.10/src/vars.c ifhp-3.5.10-ewshack/src/vars.c
--- ifhp-3.5.10/src/vars.c      2002-07-22 11:19:06.000000000 -0500
+++ ifhp-3.5.10-ewshack/src/vars.c      2002-10-16 17:18:50.000000000 -0500
@@ -54,6 +54,7 @@
     {  "Pjl_display_size", "pjl_display_size", (char **)&Pjl_display_size, INTV,0 },
     {  "Pjl_done_msg", "pjl_done_msg", &Pjl_done_msg, STRV ,0 },
     {  "Pjl_enter", "pjl_enter", (char **)&Pjl_enter, FLGV,0 },
+    {  "Pjl_waitend_byjobname", "pjl_waitend_byjobname", (char 
+**)&Pjl_waitend_byjobname, FLGV, 0},
     {  "Pjl_ready_msg", "pjl_ready_msg", &Pjl_ready_msg, STRV ,0 },
     {  "Ps", "ps", (char **)&Ps, FLGV,0 },
     {  "Ps_ctrl_t", "ps_ctrl_t", (char **)&Ps_ctrl_t, FLGV,0 },

Attachment: msg04847/pgp00000.pgp
Description: PGP signature

Reply via email to