Networked program has problem "waking up" HP printer to print - printing

I am writing some software that tries to print via IPP to typical HP laser printers like the M605, for example, and it is having a hard time "waking up" the printer sometimes. What happens is that the software tries to connect to the printer's IP address on the local network (10.1.10.185 or whatever) and gets a "No route to host" error. If the user tries several times in a row, eventually the printer "wakes up" and begins responding.
I notice that regular Linux or Window programs that print to the printer do not seem to have this problem. So, either they are not using IP/networked printing or they have some way to deal with the "sleeping" problem that I am not aware of. I suppose I could put a tap on the ethernet cord, and print from a Windows program and see what it is doing, but that would be a very time consuming and laborious procedure.
Does anybody know what I am doing wrong here? Is there some way to wake up a printer via its internet connectivity access protocol?
One thing I noticed in one person's code is that they had a 30-second timeout specified on the connect, so that may be the issue, is that my connection timeout is just not what it should be. In that case, is there an established timeout period for waking up HP printers?

Related

Best approach to check if host / port (industrial device) is reachable using Delphi 6 (or 7)

I have a program in Delphi 6 which connects to an industrial device (2d barcode scanner), using TCP/IP on a specific port. The scanner socket is not connected all the time, only when operator performs a certain operation. At that time, I would like to connect to the scanner, or show that it's offline (example: someone could have taken the cable out).
I have
IDScannerConnection: TIdTelnet;
Assuming connection is not available - wrong IP setting, cable out, wrong port, ... : If I just do IDScannerConnection.connect; Windows will freeze the program until it times out, which is several long seconds. Even inside a try/except.
I have tried the procedure here but it does not register if connection is available.
So, what's the best approach ? Connection to said device is using Telnet, to get an even when data is available. I can run a console program externally if I have to. In general I am fairly flexible around solutions, as long as operator does not experience a long timeout.
Unfortunately I am stuck in D6 and Indy9, can't upgrade these at the moment.

How to allow CUPs to wake up printer once when in standby?

I an bringing up my home print server using RaspberryPi+CUPs
MY printer is HP Laserjet MTF m1212nf.
Apprently, I I was able to setup everything good enough to be able sending jobs over the network and get them printed.
However, one problem i am running into is that once I leave the printer Idle for some time, it seems to go into kinda standby mode (kinda power-saving mode) and then jobs i send show as completed in the CUPs interface, but they never get to be printed on paper.
From this point, the way to resume printing is to shut off and then on the printer and then things work again until next go into power saving mode.
What you look for is Tea4Cups, which is a bridge beetween commands and cups.
For installation on RPi see here: (step 1-3) https://github.com/Felixel42/Printer-Pi-DCP-115C#tea4cups
Prefix your printer line i.e. smb://yourprinter so that it looks like that
tea4cups:/smb://yourprinter
The configuration file is at /etc/cups/tea4cups.conf
A minimal example is
[global]
directory : /var/spool/cups/ #you might need to adjust this
prehook_0 : wakeonlan yourmac #or whatever command you want to execute

HPLIP 3.13-11, A LaserJet 4/4M with a JetDirect: no workie

I'm trying to get a very old, but working great C2001A/J4100A (HP LaserJet 4) to work with the HP Linux Imaging and Printing library, but I'm having an awful time of it.
1) There's no entry in /usr/share/hplip/data/models/models.dat for [hp_laserjet_4]. This is the first problem so far when I used Bonjour discovery through an avahi.service file I put on my OpenWRT router. I don't currently have an iPhone I want it to discover with AirPrint, but this is how I started off and helps CUPS finds printers anyways.
2) SLP discovery is a complete bomb. I've traced it down to the UDP packet the JetDirect sends off in response to the broadcast discovery request. The part that is 'x-hp-p1=0' should be something like 'x-hp-p1=MFG:HP;MDL:LaserJet4;etc..' and it causes hp-probe to fail to see what printer the JetDirect is plugged into.
I can't seem to force HPLIP to bypass the bad discovery methods and it's too smart and wants to verify.
I've posted to the HPLIP help area, but they seem to run a week slow.
Instead of doing JetDirect, try LPR directly to the IP address. And any of the older PCL drivers should work against that printer.

If i could print across network, why can't i scan?

I recently purchased an HP Deskjet wifi-enabled printer (model no. 3515). Set it up successfully as good as that both me (in the same network as the printer) as well as another person few miles apart from me (having different isp than mine) could print wirelessly successfully.
The printing across network (printing from a network other than that to which the printer is connected) has been set-up and tested successfully both through Google Cloud Print and HP ePrint Software.
However, when it comes to scanning across network, or cloud scan as we may call it, none of these two support, or even say anything about, it. Talking to an HP customer care executive about it was fruitless as i expectedly got no better answer than 'it is not possible'. Also, unfortunately, I have not found anything worthwhile on internet regarding this either.
What my understand is - if printing could be done wirelessly across network, so could be scanning. After all, in both we do roughly the same thing but in opposite direction. That is, in layman's terms, if i am not wrong, in printing we convert digital information into hardcopy document, and in scanning it is just the other way round.
Please correct me if am assuming too many things too wrong.
HP ePrint is email based, i.e. the printer acts as an email client that polls a mailbox for print jobs. When you print to the cloud, your printjob goes to your printer's mailbox and the printer fetches the job from there. It is pretty much one-way, in the sense that you just send off the print job and hope it gets printed and there can be many different clients submitting print jobs to the same printer.
Scanning is much more complex and actually requires a fully working two-way communication, i.e. the computer is interacting with the scanner to tell it do to do a preview scan, selecting scannable areas/size, setting resolutions, etc. while getting instantaneous responses and data from the scanner. So it is not really feasible to do via a mailbox, and at least not via the printer's mailbox as you cannot read results from its mailbox.
You would think it would be possible for the scanner to send scanned pages to your mailbox, but I guess the implementation is just not there yet. There are some security implications, such as it would be a bad idea to start a scan job from a remote location, because then any bad guy could try to scan whatever secret document you happen to have placed in the scanner. But if you were to initiate the scan from the scanner and there select the email address to send the results to, it should be secure enough. I guess the developers at HP are saving some features for the next generation of multi-purpose devices so they can sell you a new device next year.. :)

Simulate Printer Errors / Printed Pages Signals

I'm testing software that sends jobs to the printer queue and then rises a flag when they are successfully printed. It also needs to detect how many pages printed correctly in a failed job.
Although there are many "Virtual Printers" out there, they all process their jobs perfectly... And that's the problem.
Is there a printer simulator that can provide with control over the signals it sends back to the windows spooler, such as printed pages, out of paper errors, paper jams, etc?
I'm not interested in the raw output the printer driver handles to the printer, but rather the signals the driver passes back to the windows' spooler.

Resources