Close
0%
0%

Modern HP5N

Dragging a mid 90's laser printer, kicking and screaming into the 21st century

Similar projects worth following
A quest to get an old laser-printer up to snuff in a modern 2019 home network using CUPS and Avahi on a Rpi (not a hack) and a smart plug to power on and off the unit automatically.

This projects has a bit of everything. Shell scripting, the inner workings of CUPS, PJL, CUPS filter wrappers, strange combinations of hardware and more.

    Back in the day when men were men and printers were only build to put ink to paper as effectively as possible, some amazingly robust and capable machine were build. The HP laser-jets of the 90's hold a special place in my heart as I came to know them well. Maintaining a small army of HP 5N printers which were by that time already 10 years old, I really liked these workhorse tanks. As per Unix philosophy, they did one thing but they did it very well indeed.

    The abuse my fleet endured in the factory I worked in was something else. Continues use in a harsh climate with powdery residue everywhere. A typical unit needed a clean about every 3 months after which it ran like new. This apposed to newer hardware that would simply give up the ghost after 2 month with no hope in hell of recovering.

    Of course the maintenance drill was more involved than simply shaking the cartridge. The unit had to be blown clean with an air hose and the mirror assembly had to be cleaned with wipes, but eventually I could do this in less than 15 minutes, which is less then a new office laser printer for every department every few months. The factory really was terribly dusty.. by design!

    So when it came to a home printing solution for al users and devices, I bought me a second hand HP 5N as cartridges are still available in extended versions. Nothing can beat the printing costs for B&W costing about 50 Euros for 10000 prints. TEN *&^&*@# THOUSAND!!! Seeing as 99% of the stuff we print is B&W, this made perfectly good sense.

    The only problem with this generation of printers is that they do not perform and connect like modern machine do. These are power hungry beasts even in standby mode and they do not play well with mobile printing protocols. For the later, of course there is CUPS and Avahi got you covered and of course all of you have a Raspberry Pi in your network for various tasks and if you do not? What are you thinking?

    But the power thing is a bit of a problem. At idle the thing probably pulls 1.21 Jiggawats and it is LOUD!!! So the current state of affairs that when we print a document, we walk upstairs to the office, turn on the printer and the document starts coming out after about 30 seconds. After the spooler is empty and printing has finished, we turn off the machine and go back to what we were doing. What I would like is for this 25 year old behemoth to have my pages ready when I choose to go and fetch said pages, so some auto power on function that is better than its idle mode.

    Introducing the TP Link HS100 grade-A Chinesium el cheapo "smart" plug. A 20 euro device that hooks up to your network and let you control a socket from a mobile device. It needs an app and an account in the cloud and all that jazz. But I do not want to control it from a bloody phone, nor do I want a cloud service to have any type of control over my outlets. I want my printer server to do that.

    Luckily this model "smart" plug has already been cracked wide open and a simple bash script can toggle it and get it's status without any added fuss. Here is the github for the script I used. hs100 bash script I did not upgrade the firmware due to the possibility that perhaps new firmware would brick this solution.

    The real trick here is to write a script that can accurately determine what is going on. Turning on the printer when a print job is active is simple enough, but to know how long to stay one or when to shut the printer off is going to be the technical part of this gig. At this moment I have the simplest version of the script running on the RPi. When lpstat returns a job, the printer will power on for 10 minutes.

    This works perfectly fine for any job 50 pages or less, but it could be a whole lot better. So on this page I'll like to discuss about various options to build...

Read more »

ncpjltest.sh

Same concept as pjlTest, but with NC instead of Telnet. Does not exit cleanly, but give the same result.

x-sh - 227.00 bytes - 11/24/2019 at 17:09

Download

pjlTest.sh

Generates PJL and used Telnet to diliver the data. This script exits cleanly.

x-sh - 191.00 bytes - 11/24/2019 at 17:05

Download

nctest.pjl

Run this file through nc for a similar effect. Does not exit cleanly. cat <file>.pjl | nc -v -v <IP> 9100 or netcat <IP> 9100 < <file>.pjl

pjl - 67.00 bytes - 11/24/2019 at 17:05

Download

  • 1 × HP 5N Laser Jet
  • 1 × Raspberry Pi
  • 1 × TP Link HS100 "smart" Plug.

  • Wrapping it up? Not quite.

    Timescale11/27/2019 at 16:57 7 comments

    After my log entry, star date 12345 yesterday, about my idea to simply inject PJL code at the beginning and the end of the stream, Ken Yap, again, gave some valuable pointers on what to look for.

    He told me to look at the filters in cups, which I did and I found a massive amount of potential there. Examples of using PJL with PCL looked like what I wanted to try was perfectly possible. Here is a link to a site where a lot of examples are given : Using your own filters to print with cups


    Looking into it further, I realized that a lot of examples would only work on older CUPS versions. The way filters work on the latest version is often somewhat different and the various degrees of up-to-date documents make it a bit confusing at times. Luckily, while trying to figure out how data is routed through CUPS (I have use cups for decades, but never dove in so deep), I figured out that the PPD file for the 5N held the target filter that outputs the data that the printer can read. In this case it was rastertogutenprint5.3 which is an binary executable.

    Also in this folder /usr/lib/cups/filters/ were a number of wrapper scripts for various filters, most of them for legacy purposes, so I copied the code ( from rastertopclm ) of a wrapper file, put it in a script and after some trial and error, I got the wrapper file, which I set as the filter in the HP5's PPD file to pass though the data and get a good print.

    #!/bin/sh
    
    # Wrapper filter for PJL injection
    
    echo "DEBUG: rastertopclm argv[$#] = $@" >&2
    echo "DEBUG: PPD: $PPD" >&2
    
    if [ -n "$6" ]; then
        exec <"$6"
    fi
    
    OUTFORMAT=PCLM $CUPS_SERVERBIN/filter/rastertogutenprint.5.3 "$1" "$2" "$3" "$4" "$5"
    
    

    Bare in mind that I have no clue what I'm doing here, and the subsequent experiment will attest to that fact. After this script neatly passed the data from the wrapper to the filter, I thought to go for it and try and combine some of the stuff from the earlier link, for what I suspect were examples for cups < 2.0. So I took this command :

    echo -en "\033%-12345X@PJL RDYMSG = Printing\n\033E"

    And I just pasted it in there. It did not work! But it did do something. The print job was a success and the result was 1 page with "-en" on it and the second with the actually print on it. If it put this line after the OUTFORMAT line, the last page would be the "-en" page and unsurprisingly, two lines before and after resulted in 3 pages! "-en" - "Hello World" - "-en".

    Without the "-en" flags, there is no effect at all. Perhaps the PJL arrived correctly but did not set the message, so I put this in :

    echo "\033%-12345X@PJL INFO STATUS\n\033E"

    Hoping to get a first page with the output of the INFO STATUS command.. No such page.

     
    I guess it is a start, but I am still a bit in the dark by ECHO is behaving that like and frankly how the whole thing works. I have a basic understanding, but many key details and mechanisms elude me.

    On another note, this wrapper could be a better way of turning on power to the printer, so even if I am completely mistaken, something rather good has come from this.

    Thanks to Ken Yap for pointing me in this direction. Often a small nudge is what gets balls rolling, or printer drums in this case.

    EDIT : Just tried to power up the printer from the wrapper with this code :

    /home/pi/automation/./hs100.sh -i 192.168.1.4 on  > /dev/null
    sleep 30s
    

    The sleep command makes the spooler wait for the printer. Sometimes the job was lost without it. Of course this needs a bit more work with a check if the TP-Link device is already on. In which case, nothing has to be done.

  • PJL Injection?

    Timescale11/26/2019 at 20:26 2 comments

    While this little group effort has given some interesting insights into 90's printer protocols, the practical side of things has yet to be completely satisfied! While we have prodded our ancient laser-printer tanks in all sorts of interesting ways, I at least am still not able to determine by a shell script if the printer is actually done.

    Last thing we tried was to determine is power-save mode was on via a PJL command that gets the current status which includes the display text. For me this text was always the "processing job" text, so that was completely useless.

    I did notice one odd behavior which was when I set the "ready message" by the PJL command: @PJL RDYMSG DISPLAY = "Some Text" , the status would not return the job message, but the new message. In itself, this is also not very helpful, but then I started to thing how CUPS talks to the printer.

    Effectively, CUPS does not do a whole lot different than we did via Telnet or Netcat. It opens up a connection to the printer via port 9100 and essentially just dumps the job data there. After that is done, CUPS really could not care less as the printer will handle the rest.

    Here is my latest idea to abuse PJL to get this working. What if we could attach a PJL command before the data stream and afterwards as well? The stream is just another bunch on commands that are executed mostly in a serial manner.

    Suppose we'd start the data with setting a RDYMSG that reads "printing". Then the data is send and at the end of it, after the last command that has anything to do with the document itself, we set RDYMSG to something like "Bazinga".

    Assuming all commands are executed in serial and the last command will always signal the end of the job, using the Netcat method to poll status would only resolve "Bazinga" if the job is actually done. Any fault would cease operation so jams and paper out scenarios won't cause premature power-off.

    Anybody out there with experience in messing with CUPS printer drivers?

  • Dead N'd

    Timescale11/24/2019 at 17:04 5 comments

    Over the last couple of days, there has been a lot of tinkering going on. Trying several things and exchanging ideas with user Instruct, tutor, train... and with some help from Ken Yap we dove into the wonderful world that is PJL. A HP developed printer language that governs just about every aspect of printing.

    The premise was that if we could read the display status while printing, we'd know when the job was done. This would mean no complex hacky scripts counting jobs and pages going through CUPS.

    Alas for me it seems this approach is a dead end. I have tried various methods to use PJL to get status information, but it just does not seem to work for me. Regardless of the state of the printer and regardless of the method I use to communicate be it Telnet or Netcat, I only get this result :

    I some cases I can change the display text, which is fun , but not helpful in this case. What I think is going on is that every PJL session is regarded as a job on the 5N. There isn't much there about the current job. No ID's no setting, not a single printer state that would indicate something useful.

    I guess the correct information would exist on the session that CUPS opened to deliver the job, but CUPS just breaks the connection after sending is done and considers it done!

    One interesting piece of information did come out of this and it is a testament to the way things were build back when my head was freakishly large but my belly wasn't

    That is right, My 5N is slowly closing in on a cool million. One megaprint! Surely that is more than one tree! Despite of this, the quality of the print is still fantastic. In fact, you can FEEL the toner on the paper. It does not smudge and it could possibly produce readable Braille!

    Well, until something new crops up, I think I'll start looking at catching the spooler information again and start scripting around that.

    As other printer may behave differently, I'll put the bash and PJL files online. The later can be fed into Netcat any which way you like, they all seem to work the same for me!

  • Ghost in the machine

    Timescale11/23/2019 at 13:18 0 comments

    I've been poking and prodding around the bits and pieces that make up my print environment with some community help to boot. I was especially interested where the messages about number of pages and percentages came from. Ken Yap chipped in and offered a couple of suggestion how to go about figuring this out. Using Wireshark, I logged some network traffic between the client, printer server and printer to see who was talking to whom about what!

    Turns out, the "Printing page X, xx%" is generated by the cups driver and set as the last "message" of the spooler, regardless of what the printer is doing (or not doing).

    There is some communications going on between the printer and the print server because it knows it's out of paper. I also know this from the syslog server.

    I still need to do some analysis on the Wireshark data to figure out precisely which cups driver is doing this messaging, but it seems reasonably the same across all devices, although on the tablet, it behaved differently than on the laptop.

    The laptops report the same page and percentage data as found in "lpstat -p" and continue until "rendering" is completed, while the tablet generated the same messages, but stopped at a certain percentage when "out of paper" was reported, hinting at the local cups driver generating these messages. This should not be much of a problem as all devices here use cups as we only run Linux boxes and Apple machines. But mileage may vary on windows OR with other drivers. Not sure yet!

    Essentially, I think we have plenty of data to manage and control the automated on/off function relatively accurately. We have two questions we need answered.

    1. Do we have a reasonable idea how much pages are put in the queue?
    2. Do we have a reasonable indication if the printer is running or not?

    I think we can answer these question with the data we have so far and I think I have found a way to script in such a way that adding to the queue at any time will make the printer stay on for longer.

    The method will rely on two scripts. The first is the timer and the second the monitor.

    The timer will be a very simple while loop that, once a minute, subtracts 1 from the timer variable. When it reaches 0 AND if a state variable is set true, the printer powers down. When the state variable is false, the timer also does not subtract.

    The monitor script will continuously try to intercept the number of pages and add minutes to the timer variable calculated from the intercepted highest page number. This script will also check syslog and lpstat for any indication that something is wrong. If paper is out, a tray is open or something does not communicate, the state variable will be set false.

    This way, the printer will not shut down if there is doubt about the state of the printer and jobs will not be lost or cut short.. hopefully.

  • Why we can't have nice things.

    Timescale11/21/2019 at 16:02 3 comments

    Playing around with various methods to determine a workable more advanced method to control the HP 5N printer, I have come to realize how naive we were back in the 90's. So I figured I might be able to use the syslog server functionality of the printer to actually get the data I need to figure out the state of the printer and this is partially true, but seemingly nobody ever thought it a good idea to actually log jobs! I can find no way to "set" the log level.

    So now I have a nice centralized log on my Raspberry Pi on whether or not the covers are open or not! This DOES report paper jams and is there for useful to stop the script from turning off the printer when something goes awry, but it tells us nothing about starting or finishing a job. Why?

    Anyway, I stated in the description of this project that CUPS does not count pages.. This is apparently not true. I can't find any evidence in any log of numbers of pages, but when running "lpstat -p" in a loop, it got me this :

    I definitely see some pages and percentages going on there. If I could catch that data and distil the highest number, adding some margins, I could come pretty close to the correct amount of time needed to print the batch and power off the printer after cool down.

    I did play around with printing multiple blank pages, both as one document and as one page duplicated a number of times, and as I suspected, the spooler queue is useless to determine anything other than "A job has been added".

    At this point in time, I think the most effective way forward is to do something like this.

    • Check for job
    • Job detected, power on printer and start scanning lpstat -p for page count
    • determine power on time from page count
    • continue checking syslog for errors
    • if error occurs, stop script from turning off printer.

    In this scenario, a print would always be ready with the printer neatly turned off unless it ran out of paper or had a jam.

    So we found out where the "hack" lies. Good times.

  • Control

    Timescale11/21/2019 at 13:42 0 comments

    The core of this project is the ability to reliably turn on and off the printer when there are job in the printer spooler. Seems simple enough. Alas, it is never so! There are many edge cases to factor in and it all depends on how reliable we can get certain data.


    In the most simple model, we'd do something like this.

    if job {
        waitTime = startupTime + (pages * perPageTime) + cooldownTime
        wait waitTime
        powerDownPrinter
    }

    But lives never that easy is it? The first problem is that by default, CUPS does not count pages. We have a document size, but that tells precious little about the length of the physical document. It is also uncertain if "lpstat" can be accurately used to determine the state of the job. For instance, what if you print 10 copies of 1 page and CUPS sends off the data with the command, ten times please. The spooler would show no job after the first page came out. And then there are the cases where we have paper jams or ran out of paper. This all has to be tested and considered.

    There is a CUPS wrapper called TEA4CUPS which gives much more tools and option which I'm looking at, but for the moment I'd like to keep it simple.

    Another option would have been to buy the TP link hs110 version of the "smart" plug. Essentially it is the same as the HS100, but with the added functionality that it can monitor and report on power usage. Depending on how this power data worked, It would be rather simple to monitor the power usage after a job started and only shut the printer off after it returned to "stand-by". Only problem here would be when the printer jams or runs out of paper as it would stop using power and probably hit that low power state.

    But for now, we'll just do it the Q&D way. Detect job turn on for 10 minutes and then turn off unless there is still a job in the spooler.

    echo "Printer power socket controller 0.1b"
    while true; do
            PRINTERSTAT=`lpstat -u`
            if [ -n "$PRINTERSTAT"  ]; then
                    echo "Turn On Printer!"
                    ./hs100.sh -i 192.168.1.4 on
                    sleep 10m
                    PRINTERSTAT=`lpstat -u`
                    if [ ! -n "$PRINTERSTAT"  ]; then
                            echo "Turn Off Printer"
                            ./hs100.sh -i 192.168.1.4 off
                    fi
            fi
            sleep 2
    
    done
    

    Put this in rc.local and we're golden! For now.

View all 6 project logs

Enjoy this project?

Share

Discussions

instruct, tutor, train... wrote 11/24/2019 at 18:47 point

@voxnulla, does not your LJ5 go into POWERSAVE mode?  I'm looking at an LJ5 manual and it says after 30 minutes this will happen.  Further the manual (http://h10032.www1.hp.com/ctg/Manual/bpl03055.pdf) says the 30 minutes can be shortened (of course it refers to another document for how to do it):

"  To change the PowerSave setting:You can change this setting using the software that came with yourprinter (see software and online helps) or through the printer controlpanel by following these steps:1Press[Menu]untilPRINTINGMENUappears.2Press[Item]untilPWRSAVE=settingappears.3Press- Value +]until the setting you want appears.The options are Off, 15 min., 30 min., 1 hr., 2 hrs., or 3 hrs.4Press[Select]to save your selection. An asterisk (*) appears next toyour selection.5Press[Go]to exit the menus  "

BTW, my POWERSAVE setting (LJ4) is under the JOBS menu not the PRINTING menu.  Mine was set to 30 minutes (default?).  So I changed it to 15 minutes.

So, if you let your LJ5 idle until the POWERSAVE message appears on the display what does the script return?

BTW, your (LJ5) manual also says this:

"   If the printer is on a network, you will probably want to turn AUTO CONTINUE to ON.   "

Guessing, from what I'm reading, this change to ON will stop issues like Paper jams and Out of paper events from taking the printer off line until the even is cleared.  I'm still trying to figure out if this is the reason such events prevent the script from working.  So far no luck on an LF4. The script continues to not work during such events.

(I see you change this web page to include our attempts at PJL.  Nice.  Good heavens, it that my hackaday.io name?  I registered a long time ago and thought that field was a kind of CV / description.  I'll have to mull that over that a bit.)

  Are you sure? yes | no

Timescale wrote 11/25/2019 at 14:28 point

"I registered a long time ago and thought that field was a kind of CV / description.  I'll have to mull that over that a bit.)"

Haha, I did not assume that was what it says on you passport!, but what else could I call you? The LJ4 guy?

Anyway, I tried your suggestion and the HP5 does indeed have it, but the problem persists. Even when in powersave mode, using telnet to directly type PJL commands, the display always returns "processing job" (in Dutch), OR, which is really odd, the RDYMSG if it was set before. It is like the command RDYMDG DISPLAY="xyz" replaces the "proccessing job" string instead of the "Klaar/Ready" string.

The display itself also shows this behavior, so the printer is not even lying to me as often printer do!

I also tried end of job commands to see if that would stop the "job processing", but until now to no avail.

Checked Auto Continue and it is on, thanks.

  Are you sure? yes | no

instruct, tutor, train... wrote 11/23/2019 at 22:19 point

@voxnulla, just realized mine is a LJ4, not 5.  I edited my posts accordingly.  Also tried your script and it works for me.  I get:

> bash lpq2_query
@PJL INFO STATUS
CODE=10001
DISPLAY="00 READY"
ONLINE=TRUE

I tried netcat but it did not return control to the console.  Probably need to double check how the script handles the end of the session. 

If I run your script during a paper jam I get nothing back.  I think I get nothing back for an empty paper try too.  But I do get messages back for warming up and for power save.  I think the power save is the important one because it indicates (on my printer) that it has been idle for a while and can probably be turned off.  I'm not sure if the LJ5 goes into a power save mode.  But to be sure, in the power save mode on a LJ4, the fan is still running full speed.  Maybe in a business environment this is not so bad.  But at home the printer could be running like this for days before the next print job.

BTW, when my printer displays "READY" it's consuming about 20.8 Watts.

Well, it's later.  And the LJ4 does say "POWERSAVE" on its display.  But the meter is still saying the printer is drawing about 20.8 Watts.  So no difference at all.  POWER THIS THING OFF WHEN NOT IN USE!

  Are you sure? yes | no

Ken Yap wrote 11/23/2019 at 22:30 point

>I tried netcat but it did not return control to the console.

You might want to look at the -N option of netcat.

  Are you sure? yes | no

instruct, tutor, train... wrote 11/24/2019 at 18:52 point

Yes, that worked.

  Are you sure? yes | no

Timescale wrote 11/23/2019 at 22:47 point

Good to hear you are getting results. What is your readout when the printer is processing a job and you run the script?

With paper jams and out of paper, I get the same result so for monitoring these types of occurrences, I'm still using the RPi as a syslog server that the 5N reports to. It is unfortunate that the syslogging of the 5N does not include job status.

That enormous amount of idle power (and the noise) is the reason I'm trying to get this to work. Well to be honest, it works fine with the ugly hack of detecting job, stay on for 10 minutes! That covers 98% of all scenarios!

This is just for fun! Especially as it seems we have a small but knowledgeable little community over here!

  Are you sure? yes | no

instruct, tutor, train... wrote 11/24/2019 at 17:54 point

>  What is your readout when the printer is processing a job and you run the script?

The display on this LaserJet 4 Plus always says READY during printing.  And the script, when it works, always returns READY.  I tried running the script about a half dozen times during the print.  Sometimes it did not work and returned nothing.  I assumed it can not always connect as the test print from FireFox had to connect to the same port at some point.

>  With paper jams and out of paper, I get the same result...

My thinking is, unless I see a POWERSAVE message then I assume the printer is either Ready, Paper-jam, Talking-to-someone-else or Out-of-paper and should be left powered up.  In this way, I believe I will know when it is safe to externally power down the LJ4 printer. 

  Are you sure? yes | no

instruct, tutor, train... wrote 11/23/2019 at 22:07 point

You are using a RPi, right?  I believe the current RPi's distribution comes w/Node-Red installed.  And I believe you can install a Node into Node-Red that someone wrote to specifically use PJL to inquire about a printer's state.  If it works, it should be possible to create a flow to decide what to do for each case of interest.  I've only been a Node-Red user for a couple of months - but have found it always better to write my own javascript functions w/in the context of node-red as "other people's" nodes are usually too specific to their application.

  Are you sure? yes | no

Timescale wrote 11/23/2019 at 22:25 point

The lack of deep nesting is a bit of a shame, but as it is not too crowded on my pages, it is not to hard to keep track of things.

Yeah, I'm using a RPi(4) for this. It does everything really! (Air) Print, Air play, VPN server, pi-hole, the lot! Marvelous little machines.

At the moment, I'm trying netcat as Ken Yap suggested. I bungled my files, so I printed a lot of nonsense! Right now the experimentation has stopped as my significant other is sleeping and the printer in the next room. Starting up that tank now won't end well for me!

Personally not a fan of node.js stuff.

I have also found this : https://git.scuttlebot.io/%25aUbwcfClaYffF2n5a21zpsQ4LLGbj6CLPdazKvwx4fI%3D.sha256

Haven't tried to compile it yet, but it seems promising.

First thing however is to document the various attempts so far and post another log about this fine quest.

  Are you sure? yes | no

Ken Yap wrote 11/23/2019 at 20:19 point

Use netcat instead of telnet for talking to port 9100 using Linux scripts. Telnet is designed for interactive use and might not use stdin.

  Are you sure? yes | no

Timescale wrote 11/23/2019 at 20:47 point

Was already trying some things with nc! Thanks.

Oddly enough, results with telnet were far more stable than NC, but in the end, neither provided me with the information I was after!. Well, back to the uglier hack!

  Are you sure? yes | no

instruct, tutor, train... wrote 11/23/2019 at 17:12 point

Just read your intro and find that I'm nearly at the same point.  Got my LJ4 out of a factory.  Air blasted it clean (still could use a new annealing drum), transferred the memory and JetDirect out of a high end (irreparable) HP ink jet and run it from an instance of CUPS.  But I'm still turning it on/off.  This is a great idea!

But I'm thinking of taking a different approach.  I think there should be a way to determine the state of the printer over the network.  Unfortunately I do not believe my JetDirect card is new enough to support http.  And I do not see a "status" feature in the normal telnet session.  But I do see a way to use what little I know of PJL (HP's Printer Job Language) to see what is displayed on the printer.  But, a telnet session to the JetDirect printing port will block CUPS.  So, this will sound like a hack, I propose that the script is periodically run only after  turning the printer on and that the script will tolerate failed logins and that the script will be looking for the LJ4's  "Power Saver Mode" display message upon which it will turn the LJ4's power off and stop its self from running again until the next power on event.

  Are you sure? yes | no

instruct, tutor, train... wrote 11/23/2019 at 17:43 point

Well, initial testing looked promising.  I could pull the "READY" text off the display.  But when I went off line the telnet session did not die, but the PJL commands returned nothing.  Same problem when I opened up the printer simulating a paper jam.  Then, when I put the printer back on line the PJL commands were printed out.  While the printer was "ready", subsequent PJL commands worked fine.  Clearly I don't understand how PJL works.  Anyone?

  Are you sure? yes | no

Timescale wrote 11/23/2019 at 18:08 point

I remember something about being able to get the display text, but I could not find it. I found that old hack where you can set the display, but nothing on how you can get that info. At some point I thought I imagined it, but now I'll look into PJL. How did you do it initially? I did muck about in telnet.

Ah, the olden days when large machine on the network were controlled by non password protected plain text protocols. Those were simpler times!

I'm still going to use the syslog server entries to detect "out of paper" and paper jam errors. These should be easy to manage in a bash script.

  Are you sure? yes | no

instruct, tutor, train... wrote 11/23/2019 at 18:16 point

Ah! Good news.  The LJ4 finally went into power saver mode and the PJL command worked returning several lines including: DISPLAY="00 POWERSAVE"  So, this may be a useful method to determine when the printer thinks its got nothing to do.

The command I am using is "@PJL INFO STATUS" (no quotes).  The syntax appears to be very picky.  I tried to cut and past the command but I think there is an extra LF or CR so had to resort to pasting it then hitting the Enter key.  Enter commands after telnet ing to the print port: "telnet <yourPrintersIPAddress> 9100".


The PJL document that I have been scanning is here: http://lprng.sourceforge.net/DISTRIB/RESOURCES/DOCS/pjltkref.pdf

  Are you sure? yes | no

Timescale wrote 11/23/2019 at 18:42 point

I'm getting this :

@PJL INFO STATUS
CODE=10023
DISPLAY="TAAKVERWERKING"
ONLINE=TRUE

It stays the same regardless if there is an active job or not. But I am able to execute the command and cleanly exit the session with this titbit I found :

{ echo -e "\033%-12345X@PJL";

echo -e @PJL INFO STATUS;

echo -e "\033%-12345X";

sleep 3; } | telnet 192.168.1.5 9100 | sed -e 's/\r$//'

EDIT : This script is not working for me as it is. Directly via telnet 9100, the PJL commands work, but not via the script. 

Yet Another Edit : I think I know why the script keeps returning the Dutch equivalent of "Processing job" which does not happen when I use Telnet. It is DOING the job or A job when parsing the command..

  Are you sure? yes | no

Timescale wrote 11/23/2019 at 18:56 point

I found the same document at HP's!

The odd thing is that my display text stays the same. It is always "TAAKVERWERKING", which is processing job in Dutch. But Regardless of the screen, this is what PJL gives back.

  Are you sure? yes | no

Dan Maloney wrote 11/21/2019 at 16:57 point

My workplace was lousy with LaserJet 5s too! Sadly, in our shop, they were pretty much consumables - you'd see them sitting out in the hallways for asset disposal if the slightest thing went wrong with them. 

Curious though - IIRC, all these had for interfaces were Centronics ports. Did they add USB at some point and I missed it?

  Are you sure? yes | no

Ken Yap wrote 11/21/2019 at 18:24 point

Later models supported network cards running the Jetdirect protocol which is simply a listener to a byte stream on port 9100/TCP.

  Are you sure? yes | no

Timescale wrote 11/21/2019 at 20:13 point

This is the 5N model, so it was sold with the Jetdirect module installed. If you only had a centronics port, you could still get it to work via a parallel-to-usb or parallel-to-ethernet adapter.

Indeed, I started maintaining these machines after seeing people tossing them out for minor faults and replacing them with more expensive and often inferior machines.

Often I only needed the user to learn to lightly bend and shake up the paper when resupplying. 90% of all paper related errors are caused by the pages slightly interlocking due to the edge left by the knife.

  Are you sure? yes | no

Dan Maloney wrote 11/22/2019 at 19:45 point

Yes, many were the days when I walked the halls at the old place wishing for a scrap pass and a cart to wheel all the goodies I found in the hallway out to my truck. I could have filled a warehouse with barely used stuff. Corporate America is incredibly wasteful that way.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates