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.
- Do we have a reasonable idea how much pages are put in the queue?
- 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.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.