Embedded printer ( LJ1020 ) develop

Asked by nicholasldf

   Thanks for help.
   Our development platform is ADS1.2(An ARM software develop tool) under the windows XP Operating System.
   With hpijs-1.7.1 development kit, we have implemented embedded print with D2368, D2468, LJ P2015.
   Now we want to add support for printer LaserJet 1020 and LaserJet P1505, and have Several question listed Below:
   (1)what is "lj.so" in file ljzjs.cpp, is it necessary to make printer like LaserJet 1020 and LaserJet P1505 to work ?
   (2)if we don't define "HAVE_LIBDL", is it OK ?
   (3)To add support for printer which belong to LJZJSMono and LJM1005 using ADS1.2 develop tool under the windowsXP Operating System, what we Should do ?

Below is the related code in file ljzjs.cpp:

#ifdef HAVE_LIBDL
#include <dlfcn.h>
#endif

extern "C"
{
int (*HPLJJBGCompress) (int iWidth, int iHeight, unsigned char **pBuff,
                        HPLJZjcBuff *pOutBuff, HPLJZjsJbgEncSt *pJbgEncSt);
int (*HPLJSoInit) (int iFlag);
}

#ifdef HAVE_LIBDL
extern void *LoadPlugin (char *szPluginName);
#endif

#ifdef HAVE_LIBDL
    m_hHPLibHandle = LoadPlugin ("lj.so");
    if (m_hHPLibHandle)
    {
        dlerror ();
        *(void **) (&HPLJJBGCompress) = dlsym(m_hHPLibHandle, "hp_encode_bits_to_jbig");
        *(void **) (&HPLJSoInit) = dlsym (m_hHPLibHandle, "hp_init_lib");
        if (!HPLJSoInit || (HPLJSoInit && !HPLJSoInit (1)))
        {
            constructor_error = UNSUPPORTED_PRINTER;
        }
    }
#endif

#ifdef HAVE_LIBDL
    if (m_hHPLibHandle)
    {
        dlclose (m_hHPLibHandle);
    }
#endif

HPLJJBGCompress (m_dwWidth * 8 * m_iBPP, iHeight, &p, &myBuffer, &se);

Question information

Language:
English Edit question
Status:
Answered
For:
HPLIP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Rick Richardson (rick-richardson) said :
#1

http://foo2zjs.rkkda.com/

It is an complete Open Source solution, unlike hplip.

Revision history for this message
nicholasldf (nicholasldf) said :
#2

thanks for Rick Richardson, i will see foo2zjs.

we use S3C2410 ARM controller and ADS1.2 tool under WindowsXP Operating System.
now i want to add support for "LJ 1020plus" and "LJ P1505" using hplip-2.8.4, but i can't find "lj.so", that lead me can't use "hp_encode_bits_to_jbig".

so i modify some code in file ljzjs.cpp like below , but no help.

LJZjs::LJZjs (SystemServices* pSS, int numfonts, BOOL proto)
    : Printer(pSS, numfonts, proto)
{
    CMYMap = NULL;
#ifdef APDK_AUTODUPLEX
    m_bRotateBackPage = FALSE; // Lasers don't require back side image to be rotated
#endif
    m_pszInputRasterData = NULL;
    m_dwCurrentRaster = 0;
    m_bStartPageSent = FALSE;
    HPLJJBGCompress = NULL;
    m_hHPLibHandle = NULL;
    m_iPrinterType = UNSUPPORTED;
#ifdef HAVE_LIBDL
    m_hHPLibHandle = LoadPlugin ("lj.so");
    if (m_hHPLibHandle)
    {
        dlerror ();
        *(void **) (&HPLJJBGCompress) = dlsym (m_hHPLibHandle, "hp_encode_bits_to_jbig");
        *(void **) (&HPLJSoInit) = dlsym (m_hHPLibHandle, "hp_init_lib");
        if (!HPLJSoInit || (HPLJSoInit && !HPLJSoInit (1)))
        {
            constructor_error = UNSUPPORTED_PRINTER;
        }
    }
#endif
    if (HPLJJBGCompress == NULL)
    {
        //constructor_error = UNSUPPORTED_PRINTER;

        //modify here
        constructor_error = NO_ERROR; //add by me
    }
}

DRIVER_ERROR LJZjs::JbigCompress ()
{
    DRIVER_ERROR err = NO_ERROR;
    HPLJZjcBuff myBuffer;
    int iPlanes = (m_cmColorMode == COLOR) ? 4 : 1;
    int iIncr = (m_bIamColor) ? 100 : m_dwLastRaster;

    HPLJZjsJbgEncSt se;
    BYTE *bitmaps[4] =
            {
                m_pszInputRasterData,
                m_pszInputRasterData + (m_dwWidth * m_iBPP * m_dwLastRaster),
                m_pszInputRasterData + (m_dwWidth * m_iBPP * m_dwLastRaster * 2),
                m_pszInputRasterData + (m_dwWidth * m_iBPP * m_dwLastRaster * 3)
            };
    myBuffer.pszCompressedData = new BYTE[m_dwWidth * m_dwLastRaster * m_iBPP];
    myBuffer.dwTotalSize = 0;

    BYTE *p;
    int iHeight;
    for (DWORD y = 0; y < m_dwLastRaster; y += iIncr)
    {
        for (int i = 0; i < iPlanes; i++)
        {
            memset (myBuffer.pszCompressedData, 0, m_dwWidth * m_dwLastRaster * m_iBPP);
            myBuffer.dwTotalSize = 0;
            p = bitmaps[i] + (y * m_dwWidth * m_iBPP);
            iHeight = iIncr;
            if (y + iIncr > m_dwLastRaster)
            {
                iHeight = m_dwLastRaster - y;
            }

            //modify here
            //HPLJJBGCompress (m_dwWidth * 8 * m_iBPP, iHeight, &p, &myBuffer, &se);

            if (i == 0)
            {
                StartPage (se.xd, se.yd);
            }
            err = this->SendPlaneData (i + 1, &se, &myBuffer, (y + iIncr) >= m_dwLastRaster);
        }
    }

    delete [] myBuffer.pszCompressedData;
    m_dwCurrentRaster = 0;
    m_pszCurPtr = m_pszInputRasterData;
    memset (m_pszCurPtr, 0, (m_dwWidth * m_dwLastRaster * iPlanes * m_iBPP));

    err = EndPage ();

    return err;
}

Revision history for this message
nicholasldf (nicholasldf) said :
#3

this is where i modify

(1)in LJZjs::LJZjs (SystemServices* pSS, int numfonts, BOOL proto)
        : Printer(pSS, numfonts, proto)

        //constructor_error = UNSUPPORTED_PRINTER;
        //modify here
        constructor_error = NO_ERROR; //add by me

(2)in DRIVER_ERROR LJZjs::JbigCompress ()
        //modify here
        //HPLJJBGCompress (m_dwWidth * 8 * m_iBPP, iHeight, &p, &myBuffer, &se);

Revision history for this message
Aaron Albright (albrigha-deactivatedaccount) said :
#4

The non-HP Linux community delivers reverse-engineered HP printer Linux drivers. These drivers were not developed with assistance from Hewlett Packard and therefore lack the print quality and performance features included in HP printer drivers. HP recommends that customers use HP Linux printer drivers in order to optimize their printing experience. Customers will need to look for the driver name, “HP-developed…” when selecting a Linux printer driver.

I'm working on an answer for your question..however it may take some time for an answer.

Sorry for the delay.

A

Revision history for this message
Raghothama Cauligi (raghothama-cauligi) said :
#5

Printers supported by LJZjsMono and LJM1005 classes require raster data to be JBIG compressed.
lj.so is a shared object, run time loadable library similar to a DLL in Windows. HPLJJBGCompress
takes in raster data and returns a JBIG compressed data. Without this, the printer will not work.
Also bear in mind that LJ1020 requires firmware uploaded to the printer every time the printer is
powered on.
Hope this helps.
Raghu

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of nicholasldf
Sent: Monday, June 02, 2008 2:45 AM
To: Cauligi, Raghothama S
Subject: [Question #34995]: Embedded printer ( LJ1020 ) develop

New question #34995 on HPLIP:
https://answers.launchpad.net/hplip/+question/34995

   Thanks for help.
   Our development platform is ADS1.2(An ARM software develop tool) using the windows XP Operating System.
   With hpijs-1.7.1 development kit, we have implemented embedded print with D2368, D2468, LJ P2015.
   Now we want to add support for printer LaserJet 1020 and LaserJet P1505, and have Several question listed Below:
   (1)what is "lj.so" in file ljzjs.cpp, is it needed to make printer like LaserJet 1020 and LaserJet P1505 to work ?
   (2)if we don't define "HAVE_LIBDL", is it OK ?
   (3)To add support for printer which belong to LJZJSMono and LJM1005 using the windowsXP Operating System, what we Should do ?

Below is the related code in file ljzjs.cpp:

#ifdef HAVE_LIBDL
#include <dlfcn.h>
#endif

extern "C"
{
int (*HPLJJBGCompress) (int iWidth, int iHeight, unsigned char **pBuff,
                        HPLJZjcBuff *pOutBuff, HPLJZjsJbgEncSt *pJbgEncSt); int (*HPLJSoInit) (int iFlag); }

#ifdef HAVE_LIBDL
extern void *LoadPlugin (char *szPluginName); #endif

#ifdef HAVE_LIBDL
    m_hHPLibHandle = LoadPlugin ("lj.so");
    if (m_hHPLibHandle)
    {
        dlerror ();
        *(void **) (&HPLJJBGCompress) = dlsym(m_hHPLibHandle, "hp_encode_bits_to_jbig");
        *(void **) (&HPLJSoInit) = dlsym (m_hHPLibHandle, "hp_init_lib");
        if (!HPLJSoInit || (HPLJSoInit && !HPLJSoInit (1)))
        {
            constructor_error = UNSUPPORTED_PRINTER;
        }
    }
#endif

#ifdef HAVE_LIBDL
    if (m_hHPLibHandle)
    {
        dlclose (m_hHPLibHandle);
    }
#endif

HPLJJBGCompress (m_dwWidth * 8 * m_iBPP, iHeight, &p, &myBuffer, &se);

--
You received this question notification because you are a member of HP Linux Imaging and Printing, which is an answer contact for HPLIP.

Revision history for this message
nicholasldf (nicholasldf) said :
#6

   Aaron Albright and Raghothama Cauligi , thank you very much for your answer.
   I will upload my source code here to supply more information.
   thanks.

Revision history for this message
Aaron Albright (albrigha-deactivatedaccount) said :
#7

Converting this to a bug report. Please post updates to:

https://bugs.launchpad.net/hplip/+bug/237684

This allows for attachments and because it's not exactly a technical problem but a technical information solution.

Thanks!

A

Revision history for this message
nicholasldf (nicholasldf) said :
#8

   our embedded operating system is uCOS-II , CPU is ARM microcontroller , all is developed under windows-XP operating system .
   so I think the only method is to get the source code about hp_init_lib and hp_encode_bits_to_jbig ? is it right?

Revision history for this message
Raghothama Cauligi (raghothama-cauligi) said :
#9

That is correct. Function names explain what they do.
Raghu

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of nicholasldf
Sent: Monday, June 09, 2008 8:59 PM
To: Cauligi, Raghothama S
Subject: RE: [Question #34995]: Embedded printer ( LJ1020 ) develop

Question #34995 on HPLIP changed:
https://answers.launchpad.net/hplip/+question/34995

    Status: Answered => Open

nicholasldf is still having a problem:
   our embedded operating system is uCOS-II , CPU is ARM microcontroller , all is developed under windows-XP operating system .
   so I think the only method is to get the source code about hp_init_lib and hp_encode_bits_to_jbig ? is it right?

--
You received this question notification because you are a member of HP Linux Imaging and Printing, which is an answer contact for HPLIP.

Can you help with this problem?

Provide an answer of your own, or ask nicholasldf for more information if necessary.

To post a message you must log in.