Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Mar 2016 12:33:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 207738] print/hplip: hpcups send 10000 bytes of garbage (0x00) to the printer
Message-ID:  <bug-207738-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207738

            Bug ID: 207738
           Summary: print/hplip: hpcups send 10000 bytes of garbage (0x00)
                    to the printer
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: makc@FreeBSD.org
          Reporter: guru@unixarea.de
             Flags: maintainer-feedback?(makc@FreeBSD.org)
          Assignee: makc@FreeBSD.org

While hunting some other problem with a HP Deskjet 2510 printer, I discover=
ed
that due to a bug in print/hplip source prnt/hpcups/Encapsulator.cpp 10000
bytes
of 0x00 are send to the printer before the real PCL commands:


prnt/hpcups/CommonDefinitions.h:

#define PCL_BUFFER_SIZE    10000

prnt/hpcups/Encapsulator.cpp:

    cur_pcl_buffer_size =3D PCL_BUFFER_SIZE;
    pcl_buffer =3D new BYTE[cur_pcl_buffer_size + 2];
    if (pcl_buffer =3D=3D NULL) {
        return ALLOCMEM_ERROR;
    }
    memset(pcl_buffer, 0, cur_pcl_buffer_size);
    cur_pcl_buffer_ptr =3D pcl_buffer;

    err =3D flushPrinterBuffer();

prnt/hpcups/Encapsulator.h:

    virtual DRIVER_ERROR    flushPrinterBuffer()
    {
        return m_pSystemServices->Send((const BYTE *) pcl_buffer, 10000);
    }


$ od -c printer24674.prn | head -5
0000000   \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0023420  033   E 033   %   -   1   2   3   4   5   X   @   P   J   L=20=20=
=20=20
0023440    S   E   T       S   T   R   I   N   G   C   O   D   E   S   E
0023460    T   =3D   U   T   F   8  \n   @   P   J   L       C   O   M   M
...

Perhaps this should be fixed upstream in the original sources, but
I do not know to whom direkt this.

For our port a patch is simple and tested here:

--- prnt/hpcups/Encapsulator.cpp.orig   2014-10-07 10:55:45.000000000 +0200
+++ prnt/hpcups/Encapsulator.cpp        2016-03-06 12:32:07.780767000 +0100
@@ -65,7 +65,9 @@
     memset(pcl_buffer, 0, cur_pcl_buffer_size);
     cur_pcl_buffer_ptr =3D pcl_buffer;

-    err =3D flushPrinterBuffer();
+//  We should not send 10000 NULL bytes to the printer
+//  err =3D flushPrinterBuffer();
+    err =3D NO_ERROR;

     struct    tm    *t;
     time_t    long_time;

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-207738-13>